1. Who developed the C programming language?
A) Dennis Ritchie
B) James Gosling
C) Bjarne Stroustrup
D) Ken Thompson
A) Dennis Ritchie
2. Which symbol is used to end a statement in C?
A) ;
B) :
C) .
D) ,
A) ;
3. Which of the following is a valid C variable name?
A) int
B) float
C) total_sum
D) 3value
C) total_sum
4. What is the size of int data type (typically) in a 32-bit compiler?
A) 2 bytes
B) 4 bytes
C) 8 bytes
D) 1 byte
B) 4 bytes
5. Which header file is required for printf()?
A) stdlib.h
B) stdio.h
C) math.h
D) string.h
B) stdio.h
6. Which operator is used to access the value at an address?
A) &
B) *
C) #
D) %
B) *
7. What will sizeof(char) return in C?
A) 0
B) 1
C) 2
D) Depends on compiler
B) 1
8. Which loop is guaranteed to execute at least once?
A) for
B) while
C) do-while
D) if
C) do-while
9. Which keyword is used to define a constant?
A) constant
B) const
C) define
D) static
B) const
10. Which of the following is NOT a storage class in C?
A) auto
B) register
C) volatile
D) static
C) volatile
11. Which function is used to allocate memory dynamically?
A) malloc()
B) alloc()
C) memory()
D) new()
A) malloc()
12. What does the break statement do?
A) Skips iteration
B) Ends program
C) Exits loop or switch
D) Pauses execution
C) Exits loop or switch
13. Which operator has the highest precedence?
A) +
B) *
C) =
D) &&
B) *
14. What is the default return type of a function in C (old standard)?
A) int
B) void
C) float
D) char
A) int
15. Which of the following is a correct comment in C?
A) // comment
B) /* comment */
C) # comment
D)
B) /* comment */
16. Which library function compares two strings?
A) strcpy()
B) strcmp()
C) strlen()
D) strcat()
B) strcmp()
17. What is a pointer?
A) Variable storing data
B) Variable storing address
C) Function
D) Array
B) Variable storing address
18. Which format specifier is used for float?
A) %d
B) %f
C) %c
D) %s
B) %f
19. Which keyword is used to return a value from a function?
A) break
B) continue
C) return
D) exit
C) return
20. Which of the following is NOT a loop construct?
A) for
B) while
C) do-while
D) switch
D) switch
21. What happens if an array index goes out of bounds?
A) Compilation error
B) Runtime error
C) Undefined behavior
D) Program stops
C) Undefined behavior
22. Which function is used to read a string with spaces?
A) scanf()
B) gets()
C) fgets()
D) puts()
C) fgets()
23. Which operator is used for logical AND?
A) &
B) &&
C) |
D) ||
B) &&
24. What does EOF stand for?
A) End of File
B) Error on File
C) Exit of Function
D) End of Function
A) End of File
25. Which function converts a string to integer?
A) atoi()
B) itoa()
C) strint()
D) intstr()
A) atoi()