C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf
Answer of first question is correct. It will garbage. You may get output as "Network" but not always. I will publish explanation of all questions very soon. Please think little more why output is not "Network" ?
Even though Q1 will compile correctly with "gcc -pedantic -Wall -ansi -Werror" and give the output as 'expected', i.e., Network, it is not correct because you are not reserving space for the '\0' null character to make it a string.
cause u are declaring an array of 7 characters whereas Network has 7 characters yes but u leave no place for the null character '\0' so the compiler doesnt know where to stop printing and prints out some characters more. Btw sry for my english, gj for the site :) best regards
17 comments:
answer to the first question is "Network" and not garbage value...pls correct it.
Answer of first question is correct. It will garbage. You may get output as "Network" but not
always. I will publish explanation of all questions very soon. Please think little more why
output is not "Network" ?
plz give some explanation for question 8..
hoz these 2d n 3d array address location are given with respect to pointers.
in q1>
the actual size of array is 8 (arr[7])
string terminates with a \0, so it takes a garbage value.
Mainsh,please add the explanation of 2nd question.
Hey manish.....
your website is awesome yaar
it helps me to get comfort over the loops and much more....
keep rockin man.......
Here there are so many questions which i can not undeestand well please explain it with good method ...
Ok.
Sir please provide some explanation about the questions.
Even though Q1 will compile correctly with "gcc -pedantic -Wall -ansi -Werror" and give the output as 'expected', i.e., Network, it is not correct because you are not reserving space for the '\0' null character to make it a string.
plz sir upload the explanation too.... need them
hey where are the explanations
can any1 help to solve que. no. 11.
printf("%d\t",***(ptr+1));
how this statment printing address.
why garbage for the first question kindly explain
Pls provide the explanations
cause u are declaring an array of 7 characters whereas Network has 7 characters yes but u leave no place for the null character '\0' so the compiler doesnt know where to stop printing and prints out some characters more.
Btw sry for my english, gj for the site :)
best regards
I think For 2nd question the answer should be compile time error...
The answer of second question is wrong you should correct it. The output would be garbage value rather than null.
Post a Comment