Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What will be the output of printf("%d", 2 * 3 + 4 * 5);?
1) 32
2) 26
3) 28
4) 22
Answer : 26
Which of the following is a correct way to declare a constant in C?
1) const int x = 10;
2) #define x 10
3) Both 1 and 2
4) Neither 1 nor 2
Answer : Both 1 and 2
What is the output of printf("%d", 5 ^ 3);?
1) 6
2) 4
3) 7
4) 2
Answer : 6
Which of the following operators is used to compare two values for equality?
1) ==
2) !=
3) <
4) >
Answer : ==
What will be the output of printf("%d", 10 - 2 * 3);?
1) 4
2) 8
3) 6
4) 5
Answer : 4
Which of the following functions is used to find the length of an array in C?
1) sizeof()
2) length()
3) count()
4) None of the above
Answer : None of the above
What is the output of printf("%d", 3 + 5 * 2);?
1) 10
2) 8
3) 12
4) 14
Answer : 13
What is the output of printf("%d", 10 & 2);?
1) 0
2) 2
3) 10
4) 12
Answer : Option 1
Which of the following statements is used to include a header file in C?
1) #include
2) #include <filename>
3) include <filename>
4) import <filename>
Answer : #include <filename>
What will be the output of printf("%d", 10 / 3);?
1) 3
2) 4
3) 2
4) 3.33
Answer : 3