1. Which of the following is NOT a valid C data type?
A) int
B) float
C) real
D) char
C) real
2. What is the correct format specifier for printing an unsigned integer?
A) %d
B) %u
C) %c
D) %lu
B) %u
3. Which function is used to allocate and initialize memory to zero?
A) malloc()
B) calloc()
C) realloc()
D) free()
B) calloc()
4. Which of the following correctly declares a constant pointer to int?
A) const int *p
B) int * const p
C) const int const *p
D) int const * const p
B) int * const p
5. Which of these operators is used for bitwise complement?
A) !
B) ~
C) ^
D) &
B) ~
6. Which function is used to read a line from a file safely?
A) gets()
B) fgets()
C) scanf()
D) fputs()
B) fgets()
7. What is the output of: printf("%c", 65);
A) 65
B) A
C) a
D) Compilation error
B) A
8. Which of the following statements about arrays in C is true?
A) Array index starts from 1
B) Array elements are stored in contiguous memory locations
C) Arrays can grow dynamically automatically
D) Arrays store different data types by default
B) Array elements are stored in contiguous memory locations
9. Which function is used to write formatted output to a file?
A) fprintf()
B) printf()
C) fputs()
D) fwrite()
A) fprintf()
10. What will be the output of: printf("%d", (int)3.9);
A) 3.9
B) 4
C) 3
D) Compilation error
C) 3
11. Which operator is used to check equality in C?
A) =
B) ==
C) !=
D) <=
B) ==
12. Which of these is a correct way to declare a 2D array of 3 rows and 4 columns?
A) int a[3,4];
B) int a(3)(4);
C) int a[3][4];
D) int a{3}{4};
C) int a[3][4];
13. Which function is used to get the last error number in C?
A) errno
B) perror()
C) strerror()
D) error()
A) errno
14. What does the function rewind() do?
A) Closes a file
B) Moves file pointer to the beginning
C) Deletes the file
D) Flushes the buffer
B) Moves file pointer to the beginning
15. Which keyword is used to define an enumeration?
A) enum
B) struct
C) typedef
D) union
A) enum
16. Which of the following correctly declares a function pointer?
A) int *fp();
B) int (*fp)();
C) int (fp*)();
D) int *(fp)();
B) int (*fp)();
17. Which header file is required for isdigit()?
A) stdio.h
B) ctype.h
C) string.h
D) stdlib.h
B) ctype.h
18. What is the purpose of the typedef keyword?
A) Define macro
B) Create a type alias
C) Allocate memory
D) Declare global variable
B) Create a type alias
19. What is the output of: printf("%d", 10<<1);
A) 5
B) 10
C) 20
D) 40
C) 20
20. Which operator is used to access a structure member (not via pointer)?
A) ->
B) .
C) *
D) &
B) .
21. Which standard function is used to sort an array generically?
A) sort()
B) qsort()
C) bsort()
D) asort()
B) qsort()
22. What does the function feof() check?
A) File error
B) End-of-file indicator
C) File is open or not
D) File size
B) End-of-file indicator
23. Which of the following is true about string literals in C?
A) They are mutable by default
B) They are stored as null-terminated character arrays
C) They never include '\0'
D) They are stored in the stack always
B) They are stored as null-terminated character arrays
24. Which operator is used to perform bitwise AND?
A) &&
B) &
C) |
D) ^
B) &
25. What is the output of: printf("%d", 7 & 3);
A) 0
B) 1
C) 2
D) 3
D) 3