Home » 60+ C Programming MCQ for Competitive and College Exams

60+ C Programming MCQ for Competitive and College Exams

c programming mcq

Learning C language becomes easier when you practice through questions. One of the best ways to test your understanding is by solving C programming MCQ questions. These questions cover important topics like loops, functions, arrays, pointers, and memory handling. C is a basic programming language that helps build a strong foundation for learning other languages too. This article includes many C programming MCQ questions with correct answers to help students and beginners improve their skills. Whether you are preparing for exams or just revising, these questions will guide you and make learning more effective and fun.

C Programming MCQ

c programming mcq

Q1. Who is the father of C language?


A) Steve Jobs
B) James Gosling
C) Dennis Ritchie
D) Rasmus Lerdorf

Answer: C

 

Q2. Which symbol is used to declare a pointer in C?


A) &
B) *
C) #
D) %


Answer: B

 

Q3. Which header file is required for printf() function?


A) stdio.h
B) conio.h
C) math.h
D) string.h


Answer: A

 

Q4. What is the size of an int on a 32-bit system?

 

A) 2 bytes
B) 4 bytes
C) 8 bytes
D) Depends on compiler


Answer: B

 

Q5. Which operator accesses the value stored at a pointer address?


A) &
B) *
C) ->
D) #


Answer: B

 

Q6. What is the default return type of a C function if not specified?


A) int
B) void
C) float
D) double


Answer: A

 

Q7. What will be the output of printf(“%d”, 5 == 5);?


A) 0
B) 1
C) 5
D) Error


Answer: B

 

Q8. Which of the following is a valid keyword in C?


A) class
B) try
C) volatile
D) interface


Answer: C

 

Q9. Which function reads a string from the user?

 

A) gets()
B) scanf()
C) getchar()
D) fgets()


Answer: A

 

Q10. What is the output of sizeof(char) in C?


A) 0
B) 1
C) 2
D) 4

 

Answer: B

 

Q11. Which format specifier is used for integers?


A) %c
B) %f
C) %d
D) %s


Answer: C

 

Q12. Which data type is used to store a character?


A) int
B) char
C) string
D) float


Answer: B

 

Q13. Which symbol gives the address of a variable?


A) *
B) #
C) &
D) @


Answer: C

 

Q14. Which function is used to compare strings?


A) strcmp()
B) strcomp()
C) strcompare()
D) compstr()


Answer: A

 

Q15. Which of the following is a loop in C?


A) switch
B) do-while
C) case
D) typedef


Answer: B

 

Q16. Which of these is not a valid operator in C?

See also  Active and Passive Voice MCQ Questions with Answers for Practice


A) +
B) =
C) ===
D) !=


Answer: C

 

Q17. Which one is used to allocate memory dynamically?


A) alloc()
B) malloc()
C) memalloc()
D) createmem()


Answer: B

 

Q18. Which function is used to find the length of a string?


A) length()
B) strlen()
C) strlength()
D) strcount()


Answer: B

 

Q19. Which function is used to copy a string?


A) copy()
B) strcpy()
C) strcopy()
D) movestr()


Answer: B

 

Q20. Which is used to terminate a C statement?


A) ,
B) .
C) ;
D) :


Answer: C

Q21. Which keyword is used to define a constant in C?

A) const
B) define
C) static
D) final


Answer: A


Q22. Which function is used to open a file in C?

A) fopen()
B) open()
C) fileopen()
D) start()

Answer: A

 

Q23. What will be the output of: printf(“%d”, sizeof(3.14));?

A) 4
B) 8
C) 2
D) 1


Answer: A

 

Q24. Which keyword is used for decision-making in C?

A) loop
B) if
C) switch
D) case


Answer: B

 

Q25. Which of these is a preprocessor directive?

A) #include
B) %define
C) @define
D) $header

 Answer: A

 

Q26. Which function is used to write to a file?

A) fprintf()
B) fputs()
C) fwrite()
D) All of the above

 Answer: D

 

Q27. Which keyword is used to stop a loop?

A) break
B) exit
C) stop
D) end

Answer: A

Q28. What is the maximum length of an identifier in C?

A) 31 characters
B) 63 characters
C) 255 characters
D) No limit

 Answer: A

 

Q29. Which one is used to skip the current iteration in loops?

A) skip
B) jump
C) continue
D) exit

 Answer: C


Q30. What does NULL represent in C?

A) Zero
B) Invalid number
C) Empty pointer
D) No value

 Answer: C

Q31. Which of these is used to define macros?

A) #macro
B) #define
C) #const
D) #include

 Answer: B


Q32. Which function is used to close a file?

A) fclose()
B) closefile()
C) endfile()
D) fexit()


Answer: A

 

Q33. Which keyword is used to define a structure?

A) struct
B) structure
C) class
D) object

 Answer: A

 

Q34. Which format specifier is used for characters?


A) %d
B) %c
C) %s
D) %f

 Answer: B

 

Q35. What is the output of: printf(“%d”, 10 % 3);?


A) 3
B) 1
C) 0
D) 10

Answer: B

 

Q36. Which keyword is used to return a value from a function?

See also  Missing Number Reasoning Questions with Solutions

A) send
B) return
C) output
D) yield

 Answer: B

 

Q37. Which symbol is used for comments in C?

A) //
B) —
C) **
D) ;;


Answer: A

 

Q38. Which of these is not a loop statement?


A) for
B) while
C) repeat
D) do-while


Answer: C

 

Q39. Which function allocates memory dynamically in C?


A) malloc()
B) dynamic()
C) create()
D) assign()


Answer: A

 

Q40. Which format specifier is used for float values?

A) %f
B) %lf
C) %d
D) %fl


Answer: A

Q41.  What is the extension of a C source file?


A) .java
B) .c
C) .cpp
D) .py


Answer: B

 

Q 42. Which of the following is a relational operator in C?


A) &&
B) ++
C) >=
D) |=


Answer: C

 

Q43. Which function is used to allocate zero-initialized memory?


A) malloc()
B) alloc()
C) calloc()
D) zalloc()


Answer: C

 

Q44. Which keyword defines a new data type name?


A) struct
B) typedef
C) class
D) define


Answer: B

 

Q45. Which of the following is not a storage class in C?


A) auto
B) static
C) extern
D) constant


Answer: D

 

Q46. Which of the following is not a valid data type in C?


A) short
B) real
C) long
D) float


Answer: B

 

Q47. Which operator is used for bitwise OR in C?

A) &&
B) ||
C) |
D) ^

 Answer: C

 

Q48. Which function is used to write a character to the screen?

A) write()
B) putchar()
C) puts()
D) fprint()

 Answer: B


Q49. What does ++a do in C?

A) Increments a after use
B) Decrements a before use
C) Increments a before use
D) Increments a twice

 Answer: C

 

Q50. Which of the following is not a valid loop in C?

A) for
B) until
C) while
D) do-while


Answer: B

 

Q51. Which header file is required for malloc()?

A) stdlib.h
B) stdio.h
C) string.h
D) malloc.h

 Answer: A

 

Q52. What is the ASCII value of character ‘A’?

A) 64
B) 65
C) 66
D) 67

Answer: B

 

Q53. Which function is used to read formatted input?

A) printf()
B) gets()
C) scanf()
D) read()

 Answer: C

 

Q54. Which function is used to print strings?

A) printf()
B) puts()
C) display()
D) echo()

 Answer: B

 

Q55. Which of the following is a pointer to FILE in C?


A) FILE*
B) File
C) file()
D) FILEVAR

 Answer: A

See also  Elementary School Classroom in a Slum MCQ for Exam Prep

 

Q56. Which of the following ends string literals in C?

A) /n
B) NULL
C) \0
D) \n

 Answer: C

 

Q57. Which of the following correctly declares a pointer to integer?

A) int ptr;
B) int *ptr;
C) int &ptr;
D) pointer ptr;

 Answer: B

 

Q58. What will a = a + 1; do?

A) Multiply a by 1
B) Add 1 to a
C) Subtract 1 from a
D) Reset a to 1

Answer: B

 

Q59. Which operator is used for bitwise AND?

A) &
B) &&
C) |
D) ^

 Answer: A

 

Q60. Which header is required for string functions?

A) conio.h
B) string.h
C) stdio.h
D) memory.h

 Answer: B

 

Q 61. Which keyword is used to include libraries in C?

A) include
B) #import
C) #include
D) using

 Answer: C

 

Q 62. Which of the following represents true in C?

A) 1
B) 0
C) -1
D) Any non-zero

 Answer: D

 

Q 63. What is the output of printf(“%d”, 3/2);?

A) 1.5
B) 2
C) 1
D) 0

 Answer: C

 

Q 64. Which operator is used to compare two values?

 

A) =
B) ==
C) :=
D) !=

Answer: B

 

Q 65. Which is the correct way to declare a function returning int?

A) function int();
B) int function();
C) func int();
D) return function();

Answer: B

 

Q 66. Which of the following is used to define multiple conditions in if?

A) ||
B) &&
C) both
D) none

 Answer: C

 

Q 67. Which function is used to convert string to integer?

A) itoa()
B) stoi()
C) atoi()
D) strint()

 Answer: C

Q 68. Which of these is used to insert new line in output?

A) /n
B) \n
C) newline
D) enter

 Answer: B

 

Q 69. What is used to end a program in C?

A) exit()
B) return 0;
C) break
D) stop()

 Answer: B

 

Q70. Which of the following is used to initialize arrays?

A) []
B) {}
C) ()
D) <>

 Answer: B

Wrapping Up

Practicing C programming MCQ questions is a smart way to strengthen your basic concepts and prepare for exams or interviews. These questions help you recall important facts, understand how C programs work, and improve your problem-solving skills. Whether you are a beginner or just brushing up your knowledge, going through these multiple-choice questions can make learning easier and faster. Make sure to revise regularly and try to understand the reason behind each correct answer. With time and practice, your confidence in C programming will grow, and you’ll be able to write better code with fewer mistakes.