C Home
C Introduction
C Variables
C Data Types
C Operators
C Decision Making
C Loops
C Functions
C Arrays
C Strings
C Pointers
C Structures
C Unions
C File Handling
C Dynamic Memory Allocation
C Storage Classes
C Header Files
C Preprocessor Directives
C Typedef
C Enumeration (enum)
C Recursion
C Bitwise Operators
C Command Line Arguments
C Interview Questions
C Programming MCQs
C Programs
C Programming MCQs
Introduction
C Programming MCQs help students test their understanding of C programming concepts through multiple-choice questions.
These questions cover variables, data types, operators, loops, arrays, functions, pointers, structures, file handling, and other important topics.
Practicing MCQs regularly improves problem-solving skills and helps prepare for examinations, technical interviews, and competitive programming.
Basic C Programming MCQs
1. Who developed the C programming language?
A. James Gosling
B. Dennis Ritchie
C. Bjarne Stroustrup
D. Guido van Rossum
✅ Answer: B. Dennis Ritchie
2. Which function is the starting point of every C program?
A. start()
B. begin()
C. main()
D. run()
✅ Answer: C. main()
3. Which header file is required for printf()?
A. string.h
B. stdio.h
C. math.h
D. stdlib.h
✅ Answer: B. stdio.h
4. Which symbol is used to end a C statement?
A. :
B. ;
C. ,
D. .
✅ Answer: B. ;
5. Which data type is used to store a single character in C?
A. int
B. float
C. char
D. string
✅ Answer: C. char
6. Which operator is used to get the address of a variable?
A. *
B. %
C. &
D. #
✅ Answer: C. &
7. Which loop executes at least once?
A. for
B. while
C. do-while
D. None of these
✅ Answer: C. do-while
8. Which keyword is used to define a constant in C?
A. const
B. constant
C. fixed
D. final
✅ Answer: A. const
9. Which function is used to read formatted input from the keyboard?
A. printf()
B. scanf()
C. gets()
D. puts()
✅ Answer: B. scanf()
10. Which operator is used for multiplication?
A. %
B. *
C. /
D. +
✅ Answer: B. *
11. Which header file is required for memory allocation functions?
A. stdio.h
B. string.h
C. stdlib.h
D. math.h
✅ Answer: C. stdlib.h
12. Which keyword is used to create a user-defined data type alias?
A. define
B. typedef
C. struct
D. enum
✅ Answer: B. typedef
13. Which symbol is used to access structure members?
A. :
B. ->
C. .
D. #
✅ Answer: C. .
14. Which function is used to open a file in C?
A. open()
B. fopen()
C. fileopen()
D. create()
✅ Answer: B. fopen()
15. Which function is used to close a file?
A. fclose()
B. close()
C. endfile()
D. fileclose()
✅ Answer: A. fclose()
16. Which operator is used for the modulus operation in C?
A. /
B. %
C. *
D. +
✅ Answer: B. %
17. Which loop is best when the number of iterations is known?
A. while
B. do-while
C. for
D. switch
✅ Answer: C. for
18. Which keyword is used to exit a loop immediately?
A. continue
B. stop
C. break
D. exit
✅ Answer: C. break
19. Which function is used to calculate the length of a string?
A. strlen()
B. sizeof()
C. strcat()
D. strcpy()
✅ Answer: A. strlen()
20. Which header file contains string handling functions?
A. stdio.h
B. string.h
C. stdlib.h
D. math.h
✅ Answer: B. string.h
21. Which function is used to copy one string to another?
A. strcat()
B. strcpy()
C. strcmp()
D. strlen()
✅ Answer: B. strcpy()
22. Which function compares two strings?
A. strcmp()
B. strcpy()
C. strcat()
D. strlen()
✅ Answer: A. strcmp()
23. Which function is used to concatenate two strings?
A. strcpy()
B. strcmp()
C. strcat()
D. strlen()
✅ Answer: C. strcat()
24. Which keyword is used to define a structure?
A. union
B. typedef
C. struct
D. class
✅ Answer: C. struct
25. Which keyword is used to define an enumeration?
A. typedef
B. struct
C. enum
D. union
✅ Answer: C. enum
Intermediate C Programming MCQs
26. Which operator is used to access the value stored at a pointer?
A. &
B. *
C. %
D. #
✅ Answer: B. *
27. What is an infinite loop?
A. malloc()
B. printf()
C. scanf()
D. fopen()
✅ Answer: A. malloc()
28. Which function allocates memory and initializes it to zero?
A. malloc()
B. realloc()
C. calloc()
D. free()
✅ Answer: C. calloc()
29. Which function changes the size of allocated memory?
A. malloc()
B. realloc()
C. calloc()
D. free()
✅ Answer: B. realloc()
30. Which function is used to release dynamically allocated memory?
A. delete()
B. free()
C. remove()
D. release()
✅ Answer: B. free()
31. Which operator is used to determine the size of a data type?
A. length
B. size
C. sizeof
D. count
✅ Answer: C. sizeof
32. Which file mode is used to open a file for reading?
A. w
B. a
C. r
D. rw
✅ Answer: C. r
33. Which file mode is used to append data to a file?
A. r
B. w
C. a
D. x
✅ Answer: C. a
34. Which storage class preserves a variable's value between function calls?
A. auto
B. register
C. static
D. extern
✅ Answer: C. static
35. Which storage class is used to declare a global variable defined in another file?
A. auto
B. register
C. static
D. extern
✅ Answer: D. extern
36. Which operator is used to access a structure member through a pointer?
A. .
B. ::
C. ->
D. &
✅ Answer: C. ->
37. Which function is used to write formatted data to a file?
A. printf()
B. fprintf()
C. scanf()
D. fwrite()
✅ Answer: B. fprintf()
38. Which function is used to read formatted data from a file?
A. fscanf()
B. fread()
C. gets()
D. scanf()
✅ Answer: A. fscanf()
39. Which operator returns the memory address of a variable?
A. *
B. &
C. %
D. #
✅ Answer: B. &
40. Which keyword creates a symbolic constant?
A. const
B. define
C. #define
D. fixed
✅ Answer: C. #define
41. Which bitwise operator performs the AND operation?
A. |
B. ^
C. &
D. ~
✅ Answer: C. &
42. Which bitwise operator performs the OR operation?
A. |
B. &
C. ^
D. >>
✅ Answer: A. |
43. Which bitwise operator performs the XOR operation?
A. &
B. |
C. ^
D. ~
✅ Answer: C. ^
44. Which operator shifts bits to the left?
A. >>
B. <<
C. &
D. ^
✅ Answer: B. <<
45. Which operator shifts bits to the right?
A. <<
B. >>
C. |
D. %
✅ Answer: B. >>
46. Which keyword is used to define an enumeration?
A. struct
B. typedef
C. enum
D. union
✅ Answer: C. enum
47. Which function calls itself?
A. Inline Function
B. Recursive Function
C. Library Function
D. Main Function
✅ Answer: B. Recursive Function
48. Which storage class is the default for local variables?
A. extern
B. static
C. auto
D. register
✅ Answer: C. auto
49. Which header file contains the malloc() function?
A. string.h
B. math.h
C. stdlib.h
D. stdio.h
✅ Answer: C. stdlib.h
50. Which library function is used to compare two strings?
A. strcpy()
B. strcmp()
C. strcat()
D. strlen()
✅ Answer: B. strcmp()
Advanced C Programming MCQs
51. Which function is used to move the file pointer to a specific location?
A. rewind()
B. fseek()
C. ftell()
D. fclose()
✅ Answer: B. fseek()
52. Which function returns the current position of the file pointer?
A. ftell()
B. fseek()
C. rewind()
D. fgets()
✅ Answer: A. ftell()
53. Which function moves the file pointer to the beginning of a file?
A. fseek()
B. rewind()
C. ftell()
D. remove()
✅ Answer: B. rewind()
54. Which function is used to delete a file?
A. delete()
B. erase()
C. remove()
D. unlink()
✅ Answer: C. remove()
55. Which function is used to rename a file?
A. rename()
B. change()
C. move()
D. update()
✅ Answer: A. rename()
56. Which operator has the highest precedence in C?
A. +
B. *
C. ()
D. =
✅ Answer: C. ()
57. Which operator is used for pointer dereferencing?
A. &
B. *
C. %
D. #
✅ Answer: B. *
58. Which keyword prevents modification of a variable?
A. static
B. register
C. const
D. extern
✅ Answer: C. const
59. Which operator is known as the conditional operator?
A. ::
B. ? :
C. &&
D. ||
✅ Answer: B. ? :
60. Which keyword is used to skip the current iteration of a loop?
A. break
B. exit
C. continue
D. goto
✅ Answer: C. continue
61. Which function reads a single character from a file?
A. fgetc()
B. fgets()
C. fscanf()
D. fread()
✅ Answer: A. fgetc()
62. Which function writes a single character to a file?
A. fputc()
B. fputs()
C. fprintf()
D. fwrite()
✅ Answer: A. fputc()
63. Which function reads a string from a file?
A. fgets()
B. gets()
C. fread()
D. scanf()
✅ Answer: A. fgets()
64. Which function writes a string to a file?
A. fputs()
B. puts()
C. fwrite()
D. fprintf()
✅ Answer: A. fputs()
65. Which function is used to read binary data from a file?
A. fread()
B. fscanf()
C. fgets()
D. fgetc()
✅ Answer: A. fread()
66. Which function is used to write binary data to a file?
A. fwrite()
B. fprintf()
C. fputs()
D. putchar()
✅ Answer: A. fwrite()
67. Which keyword is used to transfer control to another part of the program?
A. continue
B. goto
C. break
D. return
✅ Answer: B. goto
68. Which keyword terminates a function and returns control to the caller?
A. break
B. exit
C. return
D. continue
✅ Answer: C. return
69. Which operator is used to access structure members through an object?
A. .
B. ->
C. ::
D. #
✅ Answer: A. .
70. Which keyword is used to define a union?
A. struct
B. typedef
C. enum
D. union
✅ Answer: D. union
71. Which operator is used for logical AND?
A. &
B. &&
C. ||
D. ^
✅ Answer: B. &&
72. Which operator is used for logical OR?
A. |
B. ||
C. &&
D. ^
✅ Answer: B. ||
73. Which operator is used for logical NOT?
A. ~
B. !
C. #
D. %
✅ Answer: B. !
74. Which keyword is used to define a macro?
A. macro
B. const
C. #define
D. typedef
✅ Answer: C. #define
75. Which header file contains mathematical functions such as sqrt() and pow()?
A. stdio.h
B. string.h
C. stdlib.h
D. math.h
✅ Answer: D. math.h
Interview & Placement MCQs
76. What is the default return type of the main() function in C?
A. void
B. char
C. int
D. float
✅ Answer: C. int
77. Which keyword is used to define a constant variable?
A. static
B. const
C. define
D. final
✅ Answer: B. const
78. Which operator is used to compare two values for equality?
A. =
B. ==
C. !=
D. <=
✅ Answer: B. ==
79. Which loop is guaranteed to execute at least once?
A. for
B. while
C. do-while
D. None of these
✅ Answer: C. do-while
80. Which statement is used to select one option from multiple choices?
A. if
B. switch
C. for
D. while
✅ Answer: B. switch
81. Which function displays output on the screen?
A. scanf()
B. printf()
C. gets()
D. fopen()
✅ Answer: B. printf()
82. Which function reads input from the keyboard?
A. scanf()
B. printf()
C. puts()
D. fopen()
✅ Answer: A. scanf()
83. Which operator is used to access the address of a variable?
A. *
B. &
C. %
D. #
✅ Answer: B. &
84. Which symbol is used to end a C statement?
A. :
B. ;
C. ,
D. .
✅ Answer: B. ;
85. Which header file contains printf() and scanf()?
A. stdlib.h
B. math.h
C. stdio.h
D. string.h
✅ Answer: C. stdio.h
86. Which data type stores decimal values?
A. int
B. char
C. float
D. short
✅ Answer: C. float
87. Which keyword is used to define a function that returns no value?
A. null
B. void
C. empty
D. return
✅ Answer: B. void
88. Which loop is generally preferred for counting iterations?
A. while
B. do-while
C. for
D. switch
✅ Answer: C. for
89. Which function is used to compare two strings?
A. strcpy()
B. strcmp()
C. strcat()
D. strlen()
✅ Answer: B. strcmp()
90. Which function is used to find the length of a string?
A. strcpy()
B. strlen()
C. strcmp()
D. strcat()
✅ Answer: B. strlen()
91. Which keyword is used to define a structure?
A. class
B. struct
C. enum
D. union
✅ Answer: B. struct
92. Which keyword is used to define a union?
A. typedef
B. struct
C. union
D. enum
✅ Answer: C. union
93. Which keyword is used to define an enumeration?
A. enum
B. typedef
C. struct
D. class
✅ Answer: A. enum
94. Which keyword is used to create an alias for a data type?
A. define
B. typedef
C. struct
D. enum
✅ Answer: B. typedef
95. Which operator is used for logical NOT?
A. !
B. ~
C. &&
D. ||
✅ Answer: A. !
96. Which function is used to allocate memory dynamically?
A. malloc()
B. printf()
C. fopen()
D. scanf()
✅ Answer: A. malloc()
97. Which function is used to free dynamically allocated memory?
A. delete()
B. free()
C. release()
D. remove()
✅ Answer: B. free()
98. Which keyword is used to exit a function?
A. break
B. continue
C. return
D. exit
✅ Answer: C. return
99. Which operator is used to access a structure member through a pointer?
A. .
B. ->
C. ::
D. #
✅ Answer: B. ->
100. Which language is known as the mother of many modern programming languages?
A. Java
B. Python
C. C
D. C#
✅ Answer: C. C
Practice Tips
• Read each question carefully before selecting an answer.
• Practice C programs along with MCQs to strengthen your concepts.
• Revise important topics such as pointers, arrays, functions, structures, and file handling.
• Analyze incorrect answers to improve your understanding.
• Regular practice will improve your confidence in examinations and technical interviews.
Key Points
• C Programming MCQs help improve conceptual understanding.
• Regular practice increases problem-solving ability.
• MCQs are useful for university exams, interviews, and placement tests.
• Focus on understanding concepts instead of memorizing answers.
• Combine theory, programming practice, and MCQs for better learning.
