Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What is the result of the expression (5 > 3) && (8 < 2)?
1) 1
2) 0
3) True
4) False
Answer : Option 2
Which function is used to free dynamically allocated memory in C?
1) free()
2) delete()
3) dealloc()
4) release()
Answer : free()
Which of the following is a correct syntax for a union in C?
1) union name {int a; float b;};
2) union {int a;};
3) struct name {int a;};
4) None of the above
Answer : union name {int a; float b;};
What is the value of `x` after the following statement: x = 10 % 3;
1) 1
2) 3
3) 2
4) 0
Answer : 1
Which of the following is true about the `main` function in C?
1) It must return an integer.
2) It cannot take arguments.
3) It can be defined with any name.
4) None of the above
Answer : It must return an integer.
Which of the following keywords is used for defining a function that does not return a value?
1) void
2) return
3) function
4) none
Answer : void
What will be the output of printf("%d", 5 * 6 / 3);?
1) 10
2) 15
3) 20
4) 30
Answer : 10
What does the `break` statement do in a loop?
1) Exits the loop.
2) Continues to the next iteration.
3) Stops the program.
4) None of the above
Answer : Exits the loop.
What will be the output of printf("%d", 10 - 3 + 2);?
1) 5
2) 7
3) 9
4) 10
Answer : 9
Which of the following correctly represents a single character variable in C?
1) char a;
2) char a[1];
3) char a();
4) char a{};
Answer : char a;