

MCQOPTIONS
Saved Bookmarks
This section includes 202 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will be the output of the program assuming that the array begins at location 1002? |
A. | 1002, 2004, 4008, 2 |
B. | 2004, 4008, 8016, 1 |
C. | 1002, 1002, 1002, 1 |
D. | Error |
Answer» D. Error | |
2. |
Which statement will you add to the following program to ensure that the program outputs "IndiaBIX" on execution? |
A. | *pt=''; |
B. | pt='\0'; |
C. | pt='\n'; |
D. | *pt='\0'; |
Answer» E. | |
3. |
In the following program add a statement in the function such that the factorial gets stored in . |
A. | j=s; |
B. | *j=s; |
C. | *j=&s; |
D. | &j=s; |
Answer» C. *j=&s; | |
4. |
Are the expression and are same? |
A. | True |
B. | False |
Answer» C. | |
5. |
Which of the following statements correct about used in the below statement? |
A. | is a pointer to a pointer to a pointer to a char |
B. | is a pointer to a pointer to a pointer to a pointer to a char |
C. | is a pointer to a char pointer |
D. | is a pointer to a pointer to a char |
Answer» C. is a pointer to a char pointer | |
6. |
In the following program add a statement in the function such that address of gets stored in ? |
A. | **k=a; |
B. | k=&a; |
C. | *k=&a |
D. | &k=*a |
Answer» D. &k=*a | |
7. |
Point out the compile time error in the program given below. |
A. | Error: invalid assignment for x |
B. | Error: suspicious pointer conversion |
C. | No error |
D. | None of above |
Answer» D. None of above | |
8. |
Will the program compile? |
A. | True |
B. | False |
Answer» B. False | |
9. |
The following program reports an error on compilation. |
A. | True |
B. | False |
Answer» C. | |
10. |
Are the three declarations and same? |
A. | True |
B. | False |
Answer» C. | |
11. |
Is there any difference between the following two statements? |
A. | Yes |
B. | No |
Answer» C. | |
12. |
Is this a correct way for NULL pointer assignment? |
A. | Yes |
B. | No |
Answer» C. | |
13. |
Will the program compile in Turbo C? |
A. | Yes |
B. | No |
Answer» C. | |
14. |
Will the following program give any warning on compilation in TurboC (under DOS)? |
A. | Yes |
B. | No |
Answer» C. | |
15. |
Can you combine the following two statements into one? |
A. | char p = *malloc(100); |
B. | char *p = (char) malloc(100); |
C. | char *p = (char*)malloc(100); |
D. | char *p = (char *)(malloc*)(100); |
Answer» D. char *p = (char *)(malloc*)(100); | |
16. |
What would be the equivalent pointer expression for referring the array element |
A. | ((((a+i)+j)+k)+l) |
B. | *(*(*(*(a+i)+j)+k)+l) |
C. | (((a+i)+j)+k+l) |
D. | ((a+i)+j+k+l) |
Answer» C. (((a+i)+j)+k+l) | |
17. |
How many bytes are occupied by and pointers (DOS)? |
A. | near=2 far=4 huge=4 |
B. | near=4 far=8 huge=8 |
C. | near=2 far=4 huge=8 |
D. | near=4 far=4 huge=8 |
Answer» B. near=4 far=8 huge=8 | |
18. |
What is the output of this C code?
|
A. | Compile time error |
B. | Undefined behavior |
C. | Interview Mania |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
19. |
What will be the output of the following C code?
|
A. | 4 |
B. | 6 |
C. | Compilation Error |
D. | Garbage value |
E. | 10 |
Answer» D. Garbage value | |
20. |
What will be the output of the following C code?
|
A. | 150 |
B. | 160 |
C. | 170 |
D. | 180 |
E. | 190 |
Answer» F. | |
21. |
What will be the output of the following C code?
|
A. | P A |
B. | PRAYAG P |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» B. PRAYAG P | |
22. |
What will be the output of the following C code?
|
A. | Ajit |
B. | A A |
C. | Compilation Error |
D. | I I |
E. | None of these |
Answer» E. None of these | |
23. |
Which of following logical operation can be applied to pointers?
|
A. | p ^ q |
B. | p & q |
C. | p | q |
D. | All of above |
E. | None of these |
Answer» F. | |
24. |
Which of the following arithmetic operation can be applied to pointers p and q?
|
A. | p / q |
B. | p + q |
C. | p q |
D. | p * q |
E. | None of these |
Answer» D. p * q | |
25. |
What will be the output of the following C code?
|
A. | 90 |
B. | Compilation Error |
C. | Garbage value |
D. | -1 |
E. | None of these |
Answer» E. None of these | |
26. |
What will be the output of the following C code?
|
A. | 80 |
B. | 40 |
C. | 30 |
D. | 20 |
E. | Compilation Error |
Answer» B. 40 | |
27. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Depends on the compiler |
C. | 16 |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
28. |
What will be the output of the following C code?
|
A. | 16 |
B. | 17 |
C. | 18 |
D. | Compilation Error |
E. | Garbage value |
Answer» E. Garbage value | |
29. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Compilation Error |
C. | Runtime Error |
D. | Undefined behaviour |
E. | None of these |
Answer» C. Runtime Error | |
30. |
What will be the output of the following C code?
|
A. | 8 16 |
B. | Compilation Error |
C. | Interview Mania |
D. | 16 8 |
E. | None of these |
Answer» E. None of these | |
31. |
What will be the output of the following C code?
|
A. | -7 |
B. | Compilation Error |
C. | Garbage value |
D. | 50 |
E. | None of these |
Answer» B. Compilation Error | |
32. |
What will be the output of the following C code?
|
A. | Interveiw Mania |
B. | Compilation Error |
C. | Interveiw.Mania |
D. | Segmentation fault |
E. | None of these |
Answer» D. Segmentation fault | |
33. |
What will be the output of the following C code?
|
A. | Segmentation fault |
B. | Compilation Error |
C. | Interview Mania |
D. | Undefined behaviour |
E. | None of these |
Answer» B. Compilation Error | |
34. |
What will be the output of the following C code?
|
A. | Welcome to |
B. | Interview Mania |
C. | Welcome to Interview Mania |
D. | All of above |
E. | None of these |
Answer» C. Welcome to Interview Mania | |
35. |
Comment on the output of the following C code.
|
A. | Output will be Interveiw, Mania |
B. | You cannot assign pointer like in Line 3 |
C. | Memory holding this is cleared at line 3 |
D. | Memory holding this loses its reference at line 3 |
E. | None of these |
Answer» E. None of these | |
36. |
What will be the output of the following C code?
|
A. | Nothing |
B. | Undefined behaviour |
C. | Interveiw Mania |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
37. |
What will be the output of the following C code?
|
A. | WELCOME |
B. | N |
C. | E |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
38. |
What will be the output of the following C code?
|
A. | Interveiw Mania |
B. | 15 15 |
C. | 15 |
D. | Compilation Error |
E. | Garbage value |
Answer» C. 15 | |
39. |
What will be the output of the following C code?
|
A. | A |
B. | AJIT |
C. | Compilation Error |
D. | Garbage value |
E. | None of these |
Answer» B. AJIT | |
40. |
What is the correct way to declare and assign a function pointer?
|
A. | int *fn_ptr(int, int) = multi; |
B. | int *fn_ptr(int, int) = &multi; |
C. | int (*fn_ptr)(int, int) = multi; |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
41. |
What will be the output of the following C code?
|
A. | 21 |
B. | 13 |
C. | Compilation Error |
D. | 34 |
E. | None of these |
Answer» E. None of these | |
42. |
What substitution should be made to //-Reference such that p1 points to variable t3 in the following C code?
|
A. | **p2 = &t3; |
B. | *p1 = &t3; |
C. | *p2 = &t3; |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
43. |
What will be the output of the following C code?
|
A. | Same memory address is printed |
B. | 10, 20 |
C. | 40, 50 |
D. | Different memory address is printed |
E. | None of these |
Answer» E. None of these | |
44. |
What will be the output of the following C code?
|
A. | p4 points to p2 |
B. | p1 points to p |
C. | p1 points to q |
D. | All of above |
E. | None of these |
Answer» B. p1 points to p | |
45. |
What will be the output of the following C code?
|
A. | Same memory address is printed. |
B. | Different memory address is printed. |
C. | 11, 21, 31, 41 |
D. | 41, 31 |
E. | None of these |
Answer» B. Different memory address is printed. | |
46. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 12 |
C. | 13 |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
47. |
What will be the output of the following C code?
|
A. | 10, 10, 10 |
B. | Same memory address |
C. | Different memory address |
D. | Garbage value |
E. | Compilation Error |
Answer» F. | |
48. |
What will be the output of the following C code?
|
A. | Garbage value, 151, 151 |
B. | 151, 151, Garbage value |
C. | Compilation Error |
D. | 151, 151, 151 |
E. | None of these |
Answer» E. None of these | |
49. |
Comment on the output of the following C code.
|
A. | Garbage value |
B. | Compilation Error |
C. | 151 |
D. | You cannot apply any arithmetic operand to a pointer |
E. | We don t have address of an address operator |
Answer» F. | |
50. |
What will be the output of the following C code?
|
A. | Welcome to Interview mania |
B. | Compilation Error |
C. | Garbage value |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |