Learn C MCQs
Prepare C MCQs (Multiple choice Questions) for exam and job interviews.
What is the size of an int in C?
1) Depends on the system
2) 2 bytes
3) 4 bytes
4) 8 bytes
Answer : Depends on the system
Which of the following is used for memory deallocation in C?
1) free()
2) clear()
3) delete()
4) None of the above
Answer : free()
Which keyword is used to define a macro in C?
1) const
2) macro
3) #macro
4) #define
Answer : #define
What is the output of printf("%d", 10 / 3);?
1) 3
2) Error
3) None
4) 3.33
Answer : 3
What is the correct way to access an element in an array in C?
1) array->index
2) index.array
3) array.index()
4) array[index]
Answer : array[index]
Which keyword is used to define a union in C?
1) combine
2) None of the above
3) struct
4) union
Answer : union
How do you declare a constant in C?
1) define a as 10;
2) None of the above
3) constant int a = 10;
4) const int a = 10;
Answer : const int a = 10;
What does sizeof() operator return?
1) The size of the variable in bytes
2) The length of a string
3) The memory address of a variable
4) None of the above
Answer : The size of the variable in bytes
Which function is used to concatenate strings in C?
1) strcat()
2) strjoin()
3) None of the above
4) strcopy()
Answer : strcat()
Which function is used to find the length of an array in C?
1) sizeof()
2) length()
3) strsize()
4) array_length()
Answer : sizeof()