121. What is the output of: printf("%d", (struct {int x;}){1}.x);
- a) 0
- b) 1
- c) Compilation error
- d) Undefined behavior
Answer: B - This compound literal creates a struct with x=1 and accesses it.
122. Which of these is NOT a valid C11 atomic operation?
- a) atomic_load()
- b) atomic_store()
- c) atomic_modify()
- d) atomic_exchange()
Answer: C - atomic_modify() doesn't exist (correct are load/store/exchange/etc).
123. What is the purpose of the 'cnd_init()' function?
- a) Initialize condition variable
- b) Create thread
- c) Allocate memory
- d) Signal condition
Answer: A - cnd_init() initializes a condition variable for thread synchronization.
124. What is the output of: printf("%d", 1 | 2 ^ 3);
Answer: D - ^ has higher precedence: 2^3=1, then 1|1=3.
125. Which function is used to query subnormal numbers in C99?
- a) issubnormal()
- b) fpclassify()
- c) isnormal()
- d) isfinite()
Answer: A - issubnormal() macro from math.h tests for subnormal numbers.
126. What is the value of: (struct {int x;}){1} = (struct {int x;}){2}
- a) 1
- b) 2
- c) Lvalue required error
- d) Compilation error
Answer: C - Compound literals are not modifiable lvalues.
127. Which of these is NOT a valid C11 thread cancellation function?
- a) thrd_cancel()
- b) thrd_detach()
- c) thrd_exit()
- d) thrd_join()
Answer: A - thrd_cancel() doesn't exist (C11 threads don't support cancellation).
128. What is the output of: printf("%d", 1 + 2 % 3 * 4);
Answer: C - % and * same precedence: 2%3=2, 2*4=8, then 1+8=9.
129. What is the purpose of the 'tss_create()' function?
- a) Create thread-specific storage key
- b) Create thread
- c) Allocate memory
- d) Initialize mutex
Answer: A - tss_create() creates a thread-specific storage key.
130. What is the output of: printf("%d", 1 << 32 >> 32); (32-bit int)
- a) 0
- b) 1
- c) Undefined behavior
- d) Implementation defined
Answer: C - Shifting by >= width of type is undefined behavior.
131. Which function is used to get length of wide character string?
- a) wcslen()
- b) wslen()
- c) wlen()
- d) wstrlen()
Answer: A - wcslen() returns length of wide character string.
132. What is the value of: (struct {int x;}*)0 + 1
- a) 0
- b) 1
- c) sizeof(struct) bytes
- d) Compilation error
Answer: C - Pointer arithmetic advances by sizeof(struct) bytes.
133. Which of these is NOT a valid C11 once_flag function?
- a) call_once()
- b) once_flag_init()
- c) ONCE_FLAG_INIT
- d) (No incorrect options - all are valid)
Answer: B - once_flag_init() doesn't exist (use ONCE_FLAG_INIT macro).
134. What is the output of: printf("%d", 1 ? 2 : 3 + 4);
- a) 2
- b) 3
- c) 7
- d) Compilation error
Answer: A - Ternary has higher precedence than +: 1?2:(3+4) → 1 is true → 2.
135. What is the purpose of the 'tss_set()' function?
- a) Set thread-specific value
- b) Set thread priority
- c) Set mutex attribute
- d) Set condition variable
Answer: A - tss_set() associates value with thread-specific key.
136. What is the output of: printf("%d", 1 << 1 << 1 << 1 << 1);
Answer: D - Left-associative: ((((1<<1)<<1)<<1)<<1 → 1→2→4→8→16.
137. Which function is used to compare wide character strings case-insensitively?
- a) wcscmp()
- b) wcsicmp()
- c) wcscasecmp()
- d) wcsncmp()
Answer: C - wcscasecmp() is POSIX standard (wcsicmp() is common but non-standard).
138. What is the value of: (struct {int x;}){1}.x = 2
- a) 1
- b) 2
- c) Lvalue required error
- d) Compilation error
Answer: B - Struct members from compound literals are modifiable (value becomes 2).
139. Which of these is NOT a valid C11 thread timing function?
- a) thrd_sleep_for()
- b) thrd_sleep_until()
- c) thrd_delay()
- d) thrd_yield()
Answer: C - thrd_delay() doesn't exist (correct are sleep_for/sleep_until/yield).
140. What is the output of: printf("%d", 0 ? 1 : 0 ? 2 : 3);
Answer: C - Right-associative: 0?1:(0?2:3) → 0 is false → 3.