1. What would be the output oI the Iollowing program?
void main() int a -1 , b 5; clrscr(); if(++a && b++) printf("True"); else printf("False"); printf("d d",a,b); getch(); ] a) True -1 5 b) False -1 5 c) False 0 5 d) True 0 5 Answer: (c)
2. What would be the output oI the Iollowing program? main( ) int a 5, b, c ; b a 15 ; c a < 15 ; printf ( "\na d b d c d", a, b, c ) ; ] (a) 15 15 15 (b) 5 garbage vale 15 (c) 15 15 0 (d) 0 0 0
Answer: (c) 3. Which explanation will be apt Ior the error in this program : main( ) float a 12.25, b 12.52 ; if ( a b ) printf ( "\n a and b are equal" ) ; ] (a) 12.25 is not equal to 12.52 (b) Instead oI equal operator assignment operator is used. (c) Syntax error in iI condition part. (d) Compile time error Answer: b 4. Point out the errors, iI any, in the Iollowing program: main( ) int x 10, y 15 ; if ( x 2 y 3 ) printf ( "\n What should I print?" ) ; ] (a) L value required error (b) R value required error (c) No error (d) Run time error Answer: a 5. What would be the output oI the Iollowing program? main( ) int a 0;int b 20;char x 1;char y 10; if(a,b,x,y) printf("hello"); ] a) hello b) No output C) Run Time Error d) Syntax Error Answer: a 6. What would be the output oI the Iollowing program? void main() static int i5; if(--i) main(); printf("d ",i); ] } a) 1 1 1 1 b) 0 0 0 0 c) 5 5 5 5 d) Compile time Error Answer: b 7. What would be the output oI the Iollowing program? main() int i10,j20; j i, j?(i,j)?i:j:j; printf("d d",i,j); } a) 20 20 b) 10 20 c) 20 10 d) 10 10 Answer d) 8. What would be the output oI the Iollowing program? void main() int i; clrscr(); for(;;); printf("Inside the loop"); getch(); ] Answer: b a) Inside the loop will be printed Ior inIinite times. b) Blank screen and hanging c) Run Time Error d) Syntax Error
9. What would be the output oI the Iollowing program? void main() float i10.1; clrscr(); switch(i) case 10: printf("Ten"); break; default: printf("Other than ten"); ] getch(); ] Answer: b a) Other than ten b) Switch statements can be applied only to integral types. c) Ten d) Run Time Error
10. What would be the output oI the Iollowing program? void main() char i99; clrscr(); switch(i) case 'c': printf("char c"); break; case 99: printf("int 99"); break; default: printf("Other than c or 99"); ] getch(); ] a) Other than c or 99 b) char c c) int 99 d) case values duplication Answer: d 11. What would be the output oI the Iollowing program?
main() float i1.5; switch(i)
case 1: printf("1"); case 2: printf("2"); default : printf("0"); ] ]
Answer: b a) Compiler Error b) Switch statements can be applied only to integral types. c) 1 2 0 d) Run Time Error
12. What is the output oI the Iollowing program? main() int a10]; printf(~d d,a-1], a12]); ] a) 0 0 b) 1 0 c) Garbage values d) -1 12 Answer: c 13. What is the output oI the Iollowing program? Assume that the beginning address oI array is 6008. main() int a5]; printf(~u u, &a-1], &a6]); ]
a) 6008 6018 b) -1 6 c) Garbage values d) 6006 6020 Answer: d 14. What is the output oI the Iollowing? main() char str1 ] ~abc; char str2 ] ~abc; if(str1 str2) printf(~true); else printf(~false); ] a) Ialse b) true c) Syntax error d) logic error Answer: a 15. What is the output oI the Iollowing? main() char str1 ] ~abc; char str2 ] ~abcd; printf(~d, strcmp(str1,str2)) ] a) 1 b) 100 c) 0 d) -100 Answer: d 16. What is the output oI the program? main() char arr] ~ hello\0\0\0\0\0; char arr1] ~ hello\n\n\n\n\n; clrscr(); printf(~ Values of arr d\td\n,sizeof (arr),strlen(arr)); printf(~Values of arr1 d\td,sizeof (arr1),strlen(arr1)); ] 'alues oI arr a) 11 5 b) 5 5 c) 5 11 d) 10 10 Answer: a 'alues oI arr1 a) 11 10 b) 5 5 c) 5 10 d) 10 10 Answer: A
17. What is the output oI the program?
void main() int a ]15,16,17,18]; clrscr(); printf(~d,a2.9999]); getch(); ]
a) Iloat cannot be used in index b) No error c) 17 d) all the above Answer (c) 18. What would be the output oI the Iollowing program?
int a ]1,2,4]; int b3]1,2,3]; main() printf(~d,ab1]]); ]
a) 4 b) CompilerError c) 2 d) garbage value
Answer (a) 19. Find the output Ior the Iollowing C program void main(void) char names6]7]"Raja","Vignesh","Pradeep","Vijay","Nishanth"]; printf("s s s", &names, names, names0]); ]
a) Garbage value Garbage value Garbage value b) Raja Raja Raja c) Raja Raja Garbage value d) Compiler error Answer b 20. What will be the output? void main() char arr|8|'S','A',''','R','I','Y','A'}; char *p; p(char *)(arr2)|2|; clrscr(); printI("c",p); getch(); }