Vous êtes sur la page 1sur 6

Duration : 40 Mts

SDM INSTITUTE OF TECHNOLOGY, UJIRE C OBJECTIVE TEST

Questions 1. If the storage class is declared to be _________ then all the array elements would have a default initial value as zero. a) Dynamic b) Static c) new d) Auto 2. Which of the storage class for only those variables that are being used by almost all the functions in the program a) Static b) Register c) Extern d) Auto 3) The formatted functions allow the input read from the keyboard or the output displayed on the VDU True/False 4) Execl is a a) Buffer manipulating function b) Process Control function c) Time Related Function d) Directory Control Function 5) Which of the follwing function repositions file pointer to a given location a) kbhit b) lseek c) ftell d) fscanf 6) Which one of the arithmetic functions finds largest integer less than or equal to argument a) Cosh b) modf c) floor d) lileq 7) memset implies a) Uses a given character to initialize a specified number of locations in the buffer. b) Uses a given character to initialize a specified number of lines in the memory. c)Uses a given character to initialize a specified number of byte in the buffer. d) Uses a given strings to initialize a specified number of byte in the buffer. 8) Which of the following searches file if the file exists its contents are overwriten a) r+ b) w+ c) r d) a+ 9) #prgma pack a) is a directive specifies packing alignment for structure members. b) is a directive specifies packing alignment for record members. c) is a directive specifies packing alignment for pointers members. d) is a directive specifies packing misalignment for structure and record members.

10) # include <stdio.h> main() { int i,j for(i=1;i<=2; i++) { for (j=1;j<=2; j++) { if(i==j) continue; } printf(\n%d%d,i,j); } } The output is a) 12,21 b) 12,20 c) 21, 41 d) none 11) In c variable name can be of maximum ________ characters. a) 51 b) 32 c) 31 d) 21 12. Which one of the following is correct related to function a) Functions with no arguments and no return values. b) Functions with arguments and no return values. c) Functions with arguments and return values. d) All the above 13. A static variable may be internal type but not external type, depending on the place of declaration True/False 14. What is the difference between ++*ip and *ip++ ? a) both increment value b) ++*ip increment value and *ip++ increment address c) both increment address d) ++*ip increment address and *ip++ increment value 15. main(){ char *p; p="%d\n"; p++; p++; printf(p-2,300);} a)compiler error b)300 c)Garbage value d)none of these

16. main(){ int a= 0;int b = 20;char x =1;char y =-1; if(a,b,x,y) printf("hello"); else printf(world\n);} a) hello b) world c) compiler error d) helloworld 17. main() { int i,k,l; printf("%d",scanf("%d%d%d",&i,&k,&l)); } what will be the output if, 0, 4, a are entered a)0 b)2 c)3 d)none of these 18. #include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); } a)L b)M c)N d)O

19. #include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d\n",s->x); printf("%s",s->name); } a)3 and hello b) compiler error 20. main() { int i=100000000097; printf("%d %c\n",i,i); } a)97,a b)unpredictable,a c)linker error d)none of these

c)97,unpredictable

d)compile time error

21. # include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); } a)hihellobyebye

b)hihellobye c)bye d)aaabbbcccbye

22. struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,pp->y); } a)origin is(garbage values) b)variables not initialized c)origin is(0,0) d)none of these 23. #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); } a)4 b)64 c)16 d)256

24. #include<stdio.h> #define FUN(i,j) i##j void main() { int val1=10; int val12=20; printf(%d,FUN(val1,2)); } a) 10 b) 20 c) 1020 25. main() { int i=0; if(i++) main(); { printf(f); exit(0);} main(); } a)f b)f f f f f c)run time error d)compiler time error 26. main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p...%p...%p",p,q,r); } a)000100010001 b)000100020004 c)111 d)compiler error 27. What is the output of the program. main() { printf("%d\n", f(7)); } f(int x) { if (x <=4) return x; else return (f(x--));} (a) 4 (b) 5 (c) 7 (d) infinite loop d) 12

28. main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; } a)1000 b) compiler error c)Garbage value d) none of these

29. void main() { static int i=5; printf(%d,i--); if(i) main(); } a)5 infinite times b)5 4 3 2 1 30. void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

c)run time error

d)unpredictable

a)here in 3 5 b)here in 3 6 c)here in 3 7 d)none of these