C Program Output MCQ Examveda
C Program Output MCQ Examveda
C Program Output MCQ Examveda
1. Determine 3. Determine
output: void main() Output: void main()
{ {
int const *p=5; float me = 1.1;
printf("%d", ++(*p)); double you =
} 1.1; if(me==you)
printf("I hate
A. 6 Examveda"); else
B. 5 printf("I love Examveda");
C. Garbage Value }
D. Compiler Error
A. I hate Examveda
Answer: D B. I love Examveda
C. Error
Solution (By Examveda Team) D. None of These
p is a pointer to a "constant integer". But we
tried to change the value of the "constant Answer: B
integer".
Solution (By Examveda Team)
2. Determine For floating point numbers (float, double, long
Output: void main() double) the values cannot be predicted exactly.
{ Depending on the number of bytes, the
char s[]="man"; precession with the value represented varies.
int i; Float takes 4 bytes and long double takes 10
for(i=0; s[i]; i++) bytes. So float stores 0.9 with less precision than
printf("%c%c%c%c ", s[i], *(s+i), *(i+s), long double.
i[s]); Rule of Thumb: Never compare or at-least be
} cautious when using floating point numbers with
relational operators (== , >, <, <=, >=,!= ) .
A. mmm nnn aaa
B. mmmm nnnn aaaa 4. Determine
C. Compiler Error Output: void main()
D. None of These {
static int var = 5;
Answer: D printf("%d ", var--
); if(var)
Solution (By Examveda Team) main();
Correct Output : mmmm aaaa nnnn }
s[i], *(i+s), *(s+i), i[s] are all different ways of
expressing the same idea. Generally array name A.55555
is the base address for that array. Here s is the B.54321
base address. i is the index number/displacement C. Infinite Loop
from the base address. So, indirecting it with * is D. None of These
same as s[i]. i[s] may be surprising. But in the
case of C it is same as s[i]. Answer: B
A. hi friends
B. ij!gsjfoet
C. hj grjeodt
D. None of These
Answer: B
A. 0 A. 4..2
B. 1 B. 2..2
C. 100 C. 4..4
D. Error D. 2..4
Answer: C Answer: A
A. 3 hello Answer: C
B. Compiler Error
C. Linking error Solution (By Examveda Team)
D. None of these The value of i is 0. Since this information is
enough to determine the truth value of the
Answer: B boolean expression. So the statement following
the if statement is not executed. The values of i
Solution (By Examveda Team) and j remains unchanged and get printed.
Initialization should not be done for structure
members inside the structure declaration. 26. Determine Output:
void main()
24. Determine output: {
void main() static int
{ i=5; if(--i){
extern int main();
i; i=20; printf("%d ", i);
printf("%d", sizeof(i)); }
} }
A. 20 A.54321
B. 2 B.0000
C. Compiler Error C. Infinite Loop
D. Linker Error D. None of These
Answer: D Answer: B