Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of printf("%d", sizeof(double));?
1) 4
2) 8
3) 16
4) Depends on the system
Answer : 8
Which of the following is used to define a function in C?
1) def
2) function
3) void
4) None of the above
Answer : void
What will be the output of printf("%d", 4 + 2 * 3);?
1) 10
2) 8
3) 14
4) 12
Answer : 10
Which of the following is not a valid identifier in C?
1) int
2) float
3) myVar
4) var-1
Answer : var-1
What is the correct way to define a macro in C?
1) #define PI 3.14
2) PI = 3.14
3) const PI = 3.14
4) macro PI 3.14
Answer : #define PI 3.14
What is the output of printf("%d", 6 / 3 * 2);?
1) 4
2) 2
3) 1
4) 6
Answer : 4
Which of the following is used to terminate a loop in C?
1) exit
2) continue
3) break
4) return
Answer : break
What is the output of printf("%d", 7 * 3 / 3);?
1) 7
2) 21
3) 14
4) 0
Answer : 7
What will be the output of printf("%d", (5 == 5) && (3 > 1));?
1) 0
2) 1
3) Error
4) None of the above
Answer : 1
Which of the following is not a control structure in C?
1) if
2) while
3) loop
4) switch
Answer : loop