Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What is the correct syntax to declare a variable in C?
1) a int;
2) int a;
3) int:a;
4) None of the above
Answer : int a;
Which of the following is used to comment in C?
1) // comment
2) /* comment */
3) # comment
4) Both a and b
Answer : /* comment */
Which operator is used to access the value at the address of a pointer?
1) ->
2) &
3) @
4) *
Answer : *
Which function is used to print output in C?
1) printf()
2) print()
3) cout<<
4) console.log()
Answer : printf()
What is the return type of the main function in C?
1) int
2) void
3) float
4) None of the above
Answer : int
Which of the following is a valid loop in C?
1) for
2) foreach
3) loop
4) doWhile
Answer : for
How do you declare an array in C?
1) int array();
2) array arr(10);
3) int arr[10];
4) None of the above
Answer : int arr[10];
Which header file is required for using standard input and output functions in C?
1) stdio.h
2) stdlib.h
3) conio.h
4) math.h
Answer : stdio.h
What is the correct way to define a constant in C?
1) PI = 3.14
2) #define PI 3.14
3) const PI = 3.14;
4) None of the above
Answer : #define PI 3.14
What is the correct way to define a pointer in C?
1) int ptr;
2) ptr int*;
3) *int ptr;
4) int *ptr;
Answer : int *ptr;