

MCQOPTIONS
Saved Bookmarks
This section includes 175 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 following C code?
|
A. | 1 |
B. | 9 |
C. | 8 |
D. | 10 |
E. | No output |
Answer» B. 9 | |
2. |
What will be the output of the following C code?
|
A. | -1, 6, 2, 1 |
B. | Compilation Error |
C. | 1, 6, 2, -1 |
D. | 6, 2, 1, -1 |
E. | None of these |
Answer» B. Compilation Error | |
3. |
What will be the size of the following C structure?
|
A. | 41 |
B. | 44 |
C. | 5 |
D. | 11 |
E. | None of these |
Answer» C. 5 | |
4. |
What will be the output of the following C code?
|
A. | Error, sizeof cannot evaluate size of a function |
B. | Output, 16 |
C. | Output, 4 |
D. | Output, 10 |
E. | None of these |
Answer» D. Output, 10 | |
5. |
Which among the following is never possible in C when members in a structure are same as that in a union?
|
A. | sizeof(P) is less than to sizeof(Q) |
B. | sizeof(P) is greater than sizeof(Q) |
C. | sizeof(P) is equal to sizeof(Q) |
D. | All of above |
E. | None of these |
Answer» B. sizeof(P) is greater than sizeof(Q) | |
6. |
What will be the output of the following C code?
|
A. | 1 |
B. | 4 |
C. | 8 |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
7. |
What will be the output of the following C code?
|
A. | Size of N is 4, Value of N is 15 |
B. | Compilation Error |
C. | Garbage value |
D. | Size of N is 15, Value of N is 4 |
E. | None of these |
Answer» B. Compilation Error | |
8. |
Which among the following is never possible in C when members are different in a structure and union?
|
A. | sizeof(P) is equal to sizeof(Q) |
B. | sizeof(P) is greater than sizeof(Q) |
C. | sizeof(P) is less than sizeof(Q) |
D. | All of above |
E. | None of these |
Answer» F. | |
9. |
Which of the following is the correct output for the program given below?
|
A. | a = 2 b = 1 c = 2 |
B. | a = 2 b = 2 c = 2 |
C. | a = 2 b = 2 c = 1 |
D. | a = 1 b = 2 c = 1 |
Answer» B. a = 2 b = 2 c = 2 | |
10. |
What will be the output of the following C code?
|
A. | 1 |
B. | Undefined behaviour |
C. | 2 |
D. | 3 |
E. | 4 |
Answer» F. | |
11. |
What will be the output of the following C code?
|
A. | 6 |
B. | 4 |
C. | 2 |
D. | 1 |
E. | None of these |
Answer» C. 2 | |
12. |
What will be the output of the following C code?
|
A. | 4 |
B. | 2 |
C. | 1 |
D. | All of above |
E. | None of these |
Answer» B. 2 | |
13. |
Size of an array can be evaluated by __________.
|
A. | 10 * sizeof(array); |
B. | sizeof(array[10]); |
C. | sizeof(*array); |
D. | sizeof(array); |
E. | None of these |
Answer» E. None of these | |
14. |
Which of the following statements are correct about the program given below?
|
A. | The output of the program would be "x and y are equal". |
B. | The statement if (x = y) would report a compilation error. |
C. | Floats cannot be compared using if. |
D. | should be used to compare |
E. | Conditional operates should be used to compare floats. |
Answer» B. The statement if (x = y) would report a compilation error. | |
15. |
Which of the following is correct order of evaluation for the expression given below ?
|
A. | * / % + - = |
B. | = * / % + - |
C. | / * % - + = |
D. | * / % - + = |
E. | - % / * + = |
Answer» B. = * / % + - | |
16. |
Which function in the following expression will be called first?
|
A. | functionA(); |
B. | functionC(); |
C. | Cannot be predicted |
D. | functionB(); |
E. | None of these |
Answer» D. functionB(); | |
17. |
What will be the output of the following C code?
|
A. | 0 |
B. | 1 |
C. | 2 |
D. | 3 |
E. | None of these |
Answer» B. 1 | |
18. |
What will be the output of the following C code?
|
A. | 3 |
B. | 4 |
C. | 3 4 |
D. | 4 1 |
E. | None of these |
Answer» E. None of these | |
19. |
What will be the final value of c in the following s statement? (Initial value: s = 2)
|
A. | s = 4; |
B. | s = 1; |
C. | s = 2; |
D. | s = 3; |
E. | None of these |
Answer» B. s = 1; | |
20. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 5 |
C. | 6 |
D. | Runtime Error |
E. | None of these |
Answer» C. 6 | |
21. |
What will be the output of the following C code?
|
A. | Multiplication of p and num |
B. | Division of p and num |
C. | Addition of p and num |
D. | Subtraction of p and num |
E. | It will not print any output. |
Answer» F. | |
22. |
What will be the final values of p and q in the following C statement? (Initial values: p = 2, q = 1)
|
A. | p = 1, q = 2; |
B. | p = 2, q = 2; |
C. | p = 2, q = 2; |
D. | p = 0, q = 0; |
E. | None of these |
Answer» E. None of these | |
23. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Runtime Error |
C. | Float |
D. | Short int |
E. | None of these |
Answer» D. Short int | |
24. |
What will be the output of the following C code?
|
A. | 0 |
B. | 1 |
C. | 2 |
D. | 3 |
E. | None of these |
Answer» E. None of these | |
25. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 4 |
C. | 3 |
D. | Whatever character getchar function returns |
E. | Ascii value of character getchar function returns |
Answer» F. | |
26. |
What will be the output of the following C code?
|
A. | 0 |
B. | 1 |
C. | 4 |
D. | Compilation Error |
E. | None of these |
Answer» C. 4 | |
27. |
What will be the output of the following C code?
|
A. | 15 |
B. | 16 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
28. |
Which of the following is the correct order of evaluation for the given expression?
|
A. | * % / = |
B. | = % * / |
C. | / * % = |
D. | % / * = |
E. | None of these |
Answer» E. None of these | |
29. |
What will be the output of the following C code?
|
A. | Undefined behaviour |
B. | 0 |
C. | 1 |
D. | 2 |
E. | Compilation Error |
Answer» C. 1 | |
30. |
What will be the output of the following C code?
|
A. | 10 |
B. | 11 |
C. | Runtime Error |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
31. |
What will be the output of the following C code?
|
A. | 9 |
B. | 5 |
C. | Garbage value |
D. | Compilation Error |
E. | Increment of read-only location compile error |
Answer» D. Compilation Error | |
32. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 0 |
C. | 1 |
D. | 2 |
E. | Runtime Error |
Answer» D. 2 | |
33. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 3 |
C. | 2 |
D. | 1 |
E. | Floating point exception |
Answer» F. | |
34. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Wrong |
C. | Runtime Error |
D. | Right |
E. | None of these |
Answer» C. Runtime Error | |
35. |
What will be the output of the following C code?
|
A. | 1 |
B. | 2 |
C. | 4 |
D. | 20 |
E. | None of these |
Answer» B. 2 | |
36. |
What will be the final values of p and q in the following C code?
|
A. | k value is 0 and L value is 0 |
B. | k and L value are undefined |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
37. |
What will be the output of the following C code?
|
A. | 5 5.000000 |
B. | 5.000000 5 |
C. | Compilation Error |
D. | 4 |
E. | None of these |
Answer» D. 4 | |
38. |
What will be the final values of k and L in the following C code?
|
A. | k value is 0 and L value is 0 |
B. | Compilation Error |
C. | k value is 1 and L value is 1 |
D. | Runtime Error |
E. | None of these |
Answer» B. Compilation Error | |
39. |
What will be the output of the following C function?
|
A. | 2 3 |
B. | 2 3 4 |
C. | 2 3 4 5 6 7 |
D. | 5 6 7 |
E. | 5 6 |
Answer» D. 5 6 7 | |
40. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 7 |
C. | Undefined behaviour due to order of evaluation can be different |
D. | 5 |
E. | 1 |
Answer» F. | |
41. |
What will be the output of the following C code?
|
A. | 9 |
B. | 8 |
C. | 10 |
D. | Compilation Error |
E. | Undefined behaviour |
Answer» B. 8 | |
42. |
What will be the output of the following C code?
|
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
E. | 5 |
Answer» C. 3 | |
43. |
What will be the output of the following C code?
|
A. | 40 |
B. | Compilation Error |
C. | 20 |
D. | 5 |
E. | None of these |
Answer» B. Compilation Error | |
44. |
What will be the output of the following C code?
|
A. | -3 |
B. | Compilation Error |
C. | -2 |
D. | Floating point Exception |
E. | None of these |
Answer» E. None of these | |
45. |
What will be the output of the following C code?
|
A. | compilation Error |
B. | 10 |
C. | 10.000000 |
D. | 11 |
E. | 11.000000 |
Answer» F. | |
46. |
What will be the output of the following C code?
|
A. | 8 |
B. | Compilation Error |
C. | 9 |
D. | 18 |
E. | Runtime Error |
Answer» E. Runtime Error | |
47. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 23 |
C. | Runtime Error |
D. | 26 |
E. | None of these |
Answer» E. None of these | |
48. |
What will be the output of the following C code?
|
A. | 12 13 |
B. | 13 14 |
C. | 14 15 |
D. | Compilation Error |
E. | None of these |
Answer» C. 14 15 | |
49. |
What will be the output of the following C code?
|
A. | 12 |
B. | 22 |
C. | 13 |
D. | 23 |
E. | 25 |
Answer» F. | |
50. |
What will be the output of the following C code?
|
A. | 11 |
B. | 12 |
C. | 13 |
D. | 14 |
E. | Syntax error |
Answer» F. | |