Anda di halaman 1dari 8

C_Mock-I C Aptitude Multiple Choice Questions and Answers Q1.

What will be the output of the following arithmetic expression ? 5+3*2%10-8*6 a) -37 b) -42 c) -32 d) -28 Q2. What will be the output of the following statement ? int a=10; printf("%d &i",a,10); a) error b) 10 c) 10 10 d) none of these Q3. What will be the output of the following statement ? printf("%X%x%ci%x",11,10,'s',12); a) error b) basc c) Bas94c d) none of these Q4. What will be the output of the following statements ? int a = 4, b = 7,c; c = a = = b; printf("%i",c); a) 0 b) error c) 1 d) garbage value Q 5. What will be the output of the following statements ? int a = 5, b = 2, c = 10, i = a>b void main() { printf("hello"); main(); } a) 1 b) 2 c) infinite number of times d) none of these

Q7. What will be the output of the following statements ? int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]); a) 03%D b) 000 c) 032 d) 321 Q8. What will be the output of the following statement ? printf( 3 + "goodbye"); a) goodbye b) odbye c) bye d) dbye

Q9. What will be the output of the following statements ? long int a = scanf("%ld%ld",&a,&a); printf("%ld",a); a) error b) garbage value c) 0 d) 2 Q10. What will be the output of the following program ? #include void main() { int a = 2; switch(a) { case 1: printf("goodbye"); break; case 2: continue; case 3: printf("bye"); } } a) error b) goodbye c) bye d) byegoodbye

Q11. What will be the output of the following statements ? int i = 1,j; j=i--- -2; printf("%d",j); a) error b) 2 c) 3 d) -3 Q12. What will be the output of following program ? #include main() { int x,y = 10; x = y * NULL; printf("%d",x); } a) error b) 0 c) 10 d) garbage value Q13. What will be the output of following statements ? char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x)); a) 88 b) 18 c) 29 d) 19 Q14. What will be the output of the following statements ? int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf("%d",d); a) 1 b) 2 c) 6 d) 8 Q15. What will be the output of the following statements ? int i = 3; printf("%d%d",i,i++);

a) 34 b) 43 c) 44 d) 33 Q16. What will be the output of the following program ? #include void main() { int a = 36, b = 9; printf("%d",a>>a/b-2); } a) 9 b) 7 c) 5 d) none of these

Q17) int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What value does testarray[2][1][0] in the sample code above contain? a) 11 b) 7 c) 5 d) 9 Q18) void main() { int a=10,b=20; char x=1,y=0; if(a,b,x,y) { printf("EXAM"); } } What is the output? 1) XAM is printed 2) exam is printed 3) Compiler Error 4) Nothing is printed

Q19) What is the output of the following code? #include void main() { int s=0; while(s++<10)> # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 } 1) 10..10 2) 10..50 3) Error 4) 0 Q20) main() { struct { int i; }xyz; (*xyz)->i=10; printf("%d",xyz.i); } What is the output of this program? 1) program will not compile 2) 10 3) god only knows 4) address of I 21) . The memory address of the first element of an array is called a. floor address b. foundation address c. first address d. base addr

22) Which of the following data structures are indexed structures? a. linear arrays b. linked lists c. both of above d. none of above 23) Two dimensional arrays are also called a. tables arrays b. matrix arrays c. both of above d. none of above 24) A variable P is called pointer if a. P contains the address of an element in DATA. b. P points to the address of first element in DATA c. P can store only memory addresses d. P contain the DATA and the address of DATA

25) Which of the following data structure can't store the non-homogeneous data elements? a. Arrays b. Records c. Pointers d. None 26) When new data are to be inserted into a data structure, but there is no available space; this situation is usually called a. underflow b. overflow c. housefull d. Saturated 27) The situation when in a linked list START=NULL is a. underflow b. overflow c. housefull d. saturated 17. Which of the following name does not relate to stacks? a. FIFO lists b. LIFO list c. Piles d. Push-down lists

28) The term "push" and "pop" is related to the a. array b. lists c. stacks d. all of above

29) A data structure where elements can be added or removed at either end but not in the middle a. Linked lists b. Stacks c. Queues d. Deque 30) What is (void*)0? 01 . A Representation of NULL pointer . B.Representation of void pointer C.Error D None of above .

32)Can you combine the following two statements into one? char *p; p = (char*) malloc(100); A char p = *malloc(100); . B.char *p = (char) malloc(100); C.char *p = (char*)malloc(100); D char *p = (char *)(malloc*)(100); . .33 )In which header file is the NULL macro defined? A stdio.h . 2 C Stdio .h and stddef.h . .

B stddef.h . D stdlib.h .

34)How many bytes are occupied by near, far and huge pointers (DOS)? A B near=2 far=4 huge=4 near=4 far=8 huge=8 . . C D near=2 far=4 huge=8 near=4 far=8 huge=8 . .

35) If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable? A B '.' '&' . . '->' C D '*' . .

36) A pointer is A A keyword used to create variables . B.A variable that stores address of an instruction C.A variable that stores address of other variable D All of the above .

37) How will you free the allocated memory ? A.remove(var-name); C. delete(var-name);

B. free(var-name); D.dalloc(var-name);

38) What is the similarity between a structure, union and enumeration? A.All of them let you define new values B. All of them let you define new data types C. All of them let you define new pointers D.All of them let you define new structures

39) The keyword used to transfer control from a function back to the calling function is A.switch B. goto C. go back D.return

40)Which of the following function sets first n characters of a string to a given character? A.strinit() B. strnset() C. strset() 41) The library function used to reverse a string is A.strstr() C. revstr() D. strcset()

B. strrev() D.strreverse()

42) The library function used to find the last occurrence of a character in a string is A.strnstr() B. laststr() C. strrchr() D.strstr()

Anda mungkin juga menyukai