181. What is the output of: printf("%d", (int(*)[2]){{1,2}}[0][1]);
- a) 1
- b) 2
- c) Compilation error
- d) Undefined behavior
Answer: B - This nested compound literal creates a pointer to array[2] and accesses element [0][1].
182. Which of these is NOT a valid C11 atomic_flag function?
- a) atomic_flag_clear_explicit()
- b) atomic_flag_test_and_set_explicit()
- c) atomic_flag_load_explicit()
- d) (No incorrect options - all are valid)
Answer: C - atomic_flag has no load operation (even with explicit memory order).
183. What is the purpose of the 'mtx_trylock()' function?
- a) Attempt to lock mutex without blocking
- b) Lock mutex recursively
- c) Initialize trylock mutex
- d) Destroy mutex
Answer: A - mtx_trylock() attempts to lock mutex without waiting.
184. What is the output of: printf("%d", 1 | 2 ^ 3 & 4);
Answer: B - & > ^ > |: 3&4=0, 2^0=2, 1|2=3.
185. Which function is used to copy wide character memory blocks?
- a) wmemcpy()
- b) wcpy()
- c) wmcopy()
- d) wstrcpy()
Answer: A - wmemcpy() copies wide character memory blocks.
186. What is the value of: (int(*)[2]){{1,2}} + 1
- a) 1
- b) 2
- c) Pointer to next array
- d) Compilation error
Answer: C - Pointer arithmetic advances by sizeof(int[2]) bytes.
187. Which of these is NOT a valid C11 thread return value?
- a) thrd_success
- b) thrd_error
- c) thrd_failed
- d) thrd_nomem
Answer: C - thrd_failed doesn't exist (correct are success/error/nomem).
188. What is the output of: printf("%d", 1 * 2 + 3 - 4 / 5);
Answer: C - / first: 4/5=0, then 1*2=2, 2+3=5, 5-0=5.
189. What is the purpose of the 'mtx_timed' constant?
- a) Timed mutex
- b) Non-recursive mutex
- c) Recursive mutex
- d) Shared mutex
Answer: A - mtx_timed creates mutex that supports timed operations.
190. What is the output of: printf("%d", 1 << 31 >> 30); (32-bit int)
- a) -2
- b) 0
- c) 2
- d) Implementation defined
Answer: A - 1<<31 is INT_MIN, >>30 sign-extends to -2.
191. Which function is used to set wide character memory blocks?
- a) wmemset()
- b) wset()
- c) wmset()
- d) wstrset()
Answer: A - wmemset() sets wide characters in memory block.
192. What is the value of: (int(*)[2]){{1,2}}[0][0] = 3
- a) 1
- b) 2
- c) 3
- d) Compilation error
Answer: C - Array elements from compound literals are modifiable.
193. Which of these is NOT a valid C11 mutex operation?
- a) mtx_lock()
- b) mtx_unlock()
- c) mtx_trylock()
- d) mtx_wait()
Answer: D - mtx_wait() doesn't exist (correct are lock/unlock/trylock/timedlock).
194. What is the output of: printf("%d", 1 ? 2 * 3 : 4 / 5);
- a) 2
- b) 6
- c) 0
- d) Compilation error
Answer: B - 1 is true → evaluates 2*3=6 (ternary has lower precedence than * and /).
195. What is the purpose of the 'cnd_broadcast()' function?
- a) Wake all threads waiting on condition
- b) Wake one thread waiting on condition
- c) Initialize broadcast condition
- d) Destroy condition variable
Answer: A - cnd_broadcast() wakes all threads waiting on the condition variable.
196. What is the output of: printf("%d", 1 << 4 << 2);
Answer: C - Left-associative: (1<<4)=16, then 16<<2=64.
197. Which function is used to move wide character memory blocks?
- a) wmemmove()
- b) wmove()
- c) wmmove()
- d) wstrmove()
Answer: A - wmemmove() safely moves wide character memory (handles overlap).
198. What is the value of: (int(*)[2]){{1,2}}[0][1] = 3
- a) 1
- b) 2
- c) 3
- d) Compilation error
Answer: C - Array elements from compound literals are modifiable.
199. Which of these is NOT a valid C11 condition variable operation?
- a) cnd_wait()
- b) cnd_signal()
- c) cnd_notify()
- d) cnd_broadcast()
Answer: C - cnd_notify() doesn't exist (correct are wait/signal/broadcast).
200. What is the output of: printf("%d", 0 ? 2 * 3 : 4 / 5);
- a) 0
- b) 6
- c) 1
- d) Compilation error
Answer: A - 0 is false → evaluates 4/5=0 (integer division).