C MCQ Questions
Our website offers a large collection of C programming MCQs to help learners practice and improve their coding skills. Covering essential topics like data types, pointers, arrays, functions, structures, and file handling, each question tests important concepts with clear explanations. It is perfect for students, beginners, and professionals preparing for exams or job interviews. This platform makes learning C programming easier, practical, and effective for academic and career success.
Q1. Which of the following is the correct syntax to declare a pointer in C?
A. int ptr;
B. int *ptr;
C. ptr int;
D. pointer int;
📘 View Explanation
Q2. Which of the following is the default return type of a C function if not specified?
A. int
B. float
C. void
D. double
📘 View Explanation
Q3. Which format specifier is used to print an integer in C?
A. %c
B. %s
C. %d
D. %f
📘 View Explanation
Q4. Which of the following is a valid storage class in C?
A. volatile
B. auto
C. static
D. register
📘 View Explanation
Q5. What will be the output of sizeof(char) in C?
A. 1
B. 2
C. 4
D. Compiler dependent
📘 View Explanation
Q6. Which operator is used to access the value stored at an address in C?
A. &
B. *
C. ->
D. %
📘 View Explanation
Q7. What is the correct way to declare a constant in C?
A. constant int a = 10;
B. int const a = 10;
C. int a = constant 10;
D. const int a = 10;
📘 View Explanation
Q8. Which header file is required for using printf and scanf functions?
A. conio.h
B. stdio.h
C. stdlib.h
D. math.h
📘 View Explanation
Q9. Which keyword is used to break out of a loop in C?
A. stop
B. exit
C. end
D. break
📘 View Explanation
Q10. What is the output of 5/2 in C?
A. 2.5
B. 2
C. 3
D. Compiler error
📘 View Explanation
Q11. Which function is used to allocate memory dynamically in C?
A. malloc()
B. calloc()
C. realloc()
D. alloc()
📘 View Explanation
Q12. Which operator is used for conditional evaluation in C?
A. if-else
B. switch
C. ?:
D. ||
📘 View Explanation
Q13. Which of the following functions is used to compare two strings in C?
A. strcat()
B. strcmp()
C. strlen()
D. strcpy()
📘 View Explanation
Q14. What is the index of the first element in a C array?
A. 0
B. 1
C. Depends on compiler
D. -1
📘 View Explanation
Q15. Which of the following is not a loop structure in C?
A. for
B. while
C. foreach
D. do-while
📘 View Explanation
Q16. Which keyword is used to define a macro in C?
A. macro
B. const
C. #define
D. typedef
📘 View Explanation
Q17. Which function is used to find the length of a string in C?
A. strcat()
B. strlen()
C. strcmp()
D. strrev()
📘 View Explanation
Q18. Which of the following data types has the largest size in C?
A. int
B. float
C. double
D. long double
📘 View Explanation
Q19. Which loop will execute at least once in C?
A. for
B. while
C. do-while
D. none
📘 View Explanation
Q20. What is the correct file extension for a C source file?
A. .exe
B. .cpp
C. .c
D. .cs
📘 View Explanation