System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q3261: In producer-consumer synchronization, the consumer thread calls _______ to decrease the semaphore count.
- A: WaitSemaphore()
- B: ReleaseSemaphore()
- C: CreateSemaphore()
- D: OpenSemaphore()
View Answer
A
Q3262: Semaphore count can never exceed _______.
- A: the initial value
- B: the number of threads
- C: the maximum value
- D: set during creation
View Answer
D
Q3263: Using semaphores removes the need to _______ threads manually after creation.
- A: suspend
- B: start
- C: terminate
- D: restart
View Answer
A
Q3264: Threads waiting on a semaphore are in a _______ state.
- A: running
- B: blocked
- C: suspended
- D: terminated
View Answer
B
Q3265: A thread requesting to decrease the semaphore count by 2 must call wait _______ times.
- A: once
- B: twice
- C: three
- D: twice but atomically
View Answer
B
Q3266: The problem with calling wait twice on a semaphore is that the calls are not _______.
- A: atomic
- B: synchronous
- C: asynchronous
- D: deterministic
View Answer
A
Q3267: If wait functions are not atomic, the execution may switch between threads causing _______.
- A: deadlock
- B: deadlock-like situation
- C: successful synchronization
- D: resource leak
View Answer
B
Q3268: To avoid switching between two wait functions, use _______ to make them atomic.
- A: Mutex
- B: CriticalSection
- C: Lock
- D: Semaphore
View Answer
B
Q3269: WaitForMultipleObjects() fails when it detects _______ objects in the array.
- A: duplicate
- B: unique
- C: uninitialized
- D: null
View Answer
A
Q3270: Using WaitForMultipleObjects() with duplicate semaphore references may cause all handles to get _______ even if count is 1.
- A: signals
- B: blocked
- C: released
- D: waiting
View Answer
A