|
1. #include<stdio.h> void main() { int k=2,j=3,p=0; p=(k,j,k); printf("%d\n",p); } a)2 b)error c)0 d)3 Ans: a 2. How to typedef a function pointer which takes int as a parameter and return an int a)Is not possible b)typedef int *funcptr int; c)typedef int * funcptr( int); d)typedef int (*funcptr)(int); Ans: d 3. Struct x { int i; char c; } union y{ struct x a; double d; }; printf("%d",sizeof(union y)); a)8 b)5 c)4 d)1 Ans: a 4. #include<stdio.h> void main() { unsigned int i=-1; printf("%d\n",i); printf("%u\n",i*-1); } a)runtime error b)compilation error c)prints -1 to 1 d)prints 1 and 1 Ans: c 5. #include<stdio.h> void main() { int i=-10; for(;i;printf("%d\n",i++)); } a)error b)prints -10 to -1 c)infinite loop d)does not print anything Ans: b 6. #include<stdio.h> void main() { int k=10; k<<=1; printf("%d\n",k); } a)10 b)0 c)20 d)compilation error Ans: c 7. struct x{ char c1; char c2; int i; short int j; }; struct y{ short int j; char c1; char c2; int i; }; printf("%d %d",size of (struct x),size of (struct y)); a) 12 12 b) 8 8 c) 12 8 d) 8 12 Ans: a 8. #include<stdio.h> void main(){ { # define x 10 } printf("%d \n",++x); } a)11 b)10 c)compile error d)runtime error Ans: c 9. #include<stdio.h> void main() { int I=65,j=0; for(;j<26; i++,j++){ printf("%s\n", i); } } a)compilation Error b)prints A to Z c)prints a to z d)runtime error Ans: b 10. enum x {a=1,b,c,d,f=60,y} printf("%d",y); a)5 b)61 c)6 d)60 Ans: b
|