Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What will be the output of printf("%d", 5 & 3);?
1) 1
2) 0
3) 3
4) 2
Answer : 1
Which of the following is the correct syntax to define a function in C?
1) returnType functionName() {}
2) functionName() returnType {}
3) void functionName {}
4) None of the above
Answer : returnType functionName() {}
What is the output of printf("%d", 10 / 2 + 3);?
1) 8
2) 5
3) 10
4) 6
Answer : 8
Which of the following correctly declares a two-dimensional array?
1) int arr[3][4];
2) int arr(3)(4);
3) int arr{3}{4};
4) int arr[3,4];
Answer : int arr[3][4];
What will be the output of printf("%d", (1 << 3));?
1) 8
2) 16
3) 4
4) 2
Answer : 8
Which of the following is the correct way to define a function with parameters in C?
1) void function(int a, int b) {}
2) function(int a, int b) {}
3) void function() {int a, b;}
4) None of the above
Answer : void function(int a, int b) {}
What is the output of printf("%d", 4 + 2 / 2);?
1) 5
2) 6
3) 4
4) 7
Answer : 5
Which of the following is true about the `sizeof` operator?
1) It returns the size of the variable in bytes.
2) It can be used with any data type.
3) It returns a constant value.
4) All of the above
Answer : All of the above
What will be the output of printf("%d", 7 - 2 * 3);?
1) 1
2) 4
3) 3
4) 0
Answer : 1
Which of the following correctly defines a pointer to an integer?
1) int *p;
2) int p*;
3) *int p;
4) None of the above
Answer : int *p;