1. Which phase of translation performs macro replacement?
A) Phase 2
B) Phase 3
C) Phase 4
D) Phase 7
C) Phase 4
2. Which of the following statements about object representation is correct?
A) All bit patterns represent valid values
B) Padding bits may exist in object representation
C) Objects never contain padding
D) Padding bits are undefined only for structs
B) Padding bits may exist in object representation
3. What does the term “trap representation” mean?
A) Compiler optimization
B) A bit pattern that causes undefined behavior when read
C) Runtime exception
D) Hardware interrupt
B) A bit pattern that causes undefined behavior when read
4. Which of the following is true about signed char?
A) Always -128 to 127
B) Always 0 to 255
C) Range is implementation-defined
D) Same as unsigned char
C) Range is implementation-defined
5. Which of the following conversions is guaranteed to be safe?
A) int* to char*
B) void* to object pointer
C) pointer to int
D) long to int
B) void* to object pointer
6. Which of the following is a constraint violation requiring diagnostic?
A) Signed integer overflow
B) Dereferencing NULL pointer
C) Calling undeclared function (C99+)
D) Accessing out-of-bounds array element
C) Calling undeclared function (C99+)
7. Which of the following best describes “linkage”?
A) Lifetime of object
B) Visibility across translation units
C) Scope of identifier
D) Storage duration
B) Visibility across translation units
8. Which keyword gives an object internal linkage at file scope?
A) extern
B) static
C) auto
D) register
B) static
9. Which of the following is true about const objects?
A) They are always stored in read-only memory
B) They cannot be modified by any means
C) Modifying them via cast can cause undefined behavior
D) They must be global
C) Modifying them via cast can cause undefined behavior
10. Which operator guarantees short-circuit evaluation?
A) &
B) |
C) &&
D) ^
C) &&
11. Which of the following is guaranteed about sizeof?
A) Evaluates its operand
B) Returns size in bits
C) Returns size_t
D) Requires runtime computation
C) Returns size_t
12. Which standard header defines uintptr_t?
A) stdlib.h
B) stddef.h
C) stdint.h
D) limits.h
C) stdint.h
13. Which of the following is true about pointer comparison?
A) Always valid for any pointers
B) Valid only within same array or one past it
C) Always implementation-defined
D) Only valid for NULL pointers
B) Valid only within same array or one past it
14. Which of the following is guaranteed by the C standard?
A) int is at least 32 bits
B) char is exactly 8 bits
C) CHAR_BIT >= 8
D) long is larger than int
C) CHAR_BIT >= 8
15. What does the keyword _Alignas specify?
A) Object size
B) Alignment requirement
C) Storage duration
D) Linkage
B) Alignment requirement
16. Which of the following is NOT allowed in a constant expression?
A) sizeof(int)
B) Enumeration constant
C) Function call
D) Integer literal
C) Function call
17. Which function is guaranteed to flush all open output streams?
A) fflush(NULL)
B) exit()
C) abort()
D) fcloseall()
B) exit()
18. Which of the following statements about VLAs is correct?
A) Mandatory in C11
B) Optional feature in C11
C) Stored only on heap
D) Cannot be function parameters
B) Optional feature in C11
19. Which of the following expressions has unspecified behavior?
A) i = i + 1;
B) i = ++i;
C) i++;
D) i += 1;
B) i = ++i;
20. Which of the following guarantees thread-safe initialization?
A) Global variables
B) Static local variables (C11)
C) malloc()
D) volatile variables
B) Static local variables (C11)
21. Which macro expands to the current line number?
A) __LINE__
B) __FILE__
C) __func__
D) __DATE__
A) __LINE__
22. Which of the following is guaranteed to be evaluated?
A) Second operand of &&
B) Second operand of ||
C) Operand of sizeof
D) All macro arguments
C) Operand of sizeof
23. Which of the following statements about memcpy is correct?
A) Safe for overlapping regions
B) Undefined for overlapping regions
C) Slower than memmove always
D) Works only for strings
B) Undefined for overlapping regions
24. Which function is guaranteed async-signal-safe?
A) printf()
B) malloc()
C) write()
D) free()
C) write()
25. Which statement best summarizes C language philosophy?
A) Safety over performance
B) Performance with programmer responsibility
C) Automatic memory safety
D) Strict runtime checks
B) Performance with programmer responsibility