Sei sulla pagina 1di 8

1.main() { int i; i=(2,3); printf("%d",i); } a)2 b)3 c)Compiler error d)Syntax error. ans : 3 2.

main(){ char str[]="GESL"; printf("%d %d",sizeof(str),strlen(str)); } a)5,5 b)4,4 c)5,4 d)4,5 ans: 5, 4 3. main(){ for(i=0;i++;i<100) printf("hello world\n"); } a)100 times b)0 times c)Infinite loop d)None of the above. ans: 0 times. 4. main(){ for(i=1;i++;i<100) printf("hello world\n"); } a)100 times b)0 times c)Infinite loop d)None of the above. ans: infinite loop 5. main(){ char c; scanf("%s",c); } a)Compiler dependent b)unpredictable c)Compiler error d) scans the i/p. ans: Compiler dependent. 6. main(){

int k=5; for(++k<5 && k++/5 || ++k<8); printf("%d\n",k); } a)5 b)6 c)7 d)8 ans: 7 7. main(){ int *ptr1,*ptr2; ptr1=(int *)malloc(sizeof(int)); ptr2=func(20,10,ptr1); printf("%d %d\n",*ptr1,*ptr2); } int *func(int a, int b, int *c) { int x=a+b; *c=a-b; return(&x); } a)Bug in the code. b)No Bugs prints correctly c)Error d) None of the above. Ans: Bug in the code. 8). int main() { int i = 10, j ; if ( ( j = ~i ) < i ) printf ( "True" ) ; else

printf ( "False" ) ; } a) True b) False c) Compiler Dependent d) None of the above. ans : True 9. How many bytes are required to create a 3*3 matrix using double pointer ans: 12 10. take int=4,float=8,char=1 main() { FILE *fp; printf("%d\n",sizeof(fp) ); } a)2 b)4 c)Compiler dependent d)Error Ans:4 11. main() { int a=10,20; a^=b^=a^=b; printf("%d\n %d\n",a,b); a)a=20,b=10 b)a=10,b=20 c)Syntax error d)Unpredictable Ans : a=20 b=10 12. main() { int i=10; switch(i) { case 10: printf("Hello "); { case 1 : printf("World ");

} case 5: printf("Hello World ");

} } a) Hello b) Hello c) Hello World Hello World d) Syntax Error. Ans : Hello World Hello World 13. main() { char str1[]="Hello"; char str2[]="Hello"; if ( str1==str2 ) printf("True\n"); else printf("False\n"); } Ans: False. a)True b)False c)Error d) Unpredictable. 14. main() { # include <stdio.h> int i = 10 ; printf("%d\n", i/2 ); } a)10 b)5 c)error d) warning. ans : 5

15. #include <stdio.h> # pragma pack(2) struct SIZE { int i; char ch ; double db ; }; main () { printf ( "%d\n",sizeof(struct SIZE) ); } a)12 b)14 c)16 d)8 16. what is big-endian. a) MSB at lower address LSB at higher address b) LSB at lower address MSB at higher address c) memory mgmt technique d) none of the above ans:a 17. what is Little-endian. a) MSB at lower address LSB at higher address b) LSB at lower address MSB at higher address c) memory mgmt technique d) none of the above ans:b 18. 8086 has a)16 bit data bus ,16 bit address bus

b)16 bit data bus,32 bit address bus c)8 bit data bus,16 bit address bus d)8 bit data bus,8 bit address bus ans:a 19. what is the scheduling algorithm used in general operating systems. a) FCFS algorithm b) Highest Priority First algorithm c) Round-Robin algorithm d) None of the above ans:c 20. Router is present at a)Physical layer b)Data Link Layer c)Network Layer d)None of above ans:c 21. Condition for deadlock occurrence a) Mutual Exclusion b) no premption c) hold and wait d) circular wait e) all of the above ans:d 22. PCI stands for a)Programmable computer Interface

b)Peripheral Computer Interface c)programmable Control Interface d)Peripheral Component Interface ans:d 23. Toggle state in J-K flip-flop is a)0 1 b)1 0 c)1 1 d)0 0 ans :c 24. Interrupt is serviced a)Immediatly when it occurs b)After the completion of current instruction. c)Ignored d)None of the above. ans:b 25.what is the o/p ? void main() { char *mess[]={"Have","a","nice","day","Bye"); printf("%d \t %d",sizeof(mess),sizeof(mess[1])); } a. 16 4 b. 5 4 c. 20 4

d. Error answer: c

Potrebbero piacerti anche