System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 144
Q3181:
The lpMutexName can be NULL for _______ mutexes.
A. private
B. process global
C. thread local
D. unnamed
Correct Answer:
D
Chapter: 144
Q3182:
Ownership is automatically given to the calling thread when bInitialOwner is _______.
A. NULL
B. 1
Correct Answer:
B
Chapter: 144
Q3183:
Mutexes are helpful in _______ operations where resources are shared.
A. local
B. sequential
C. concurrent
D. independent
Correct Answer:
C
Chapter: 144
Q3184:
ReleaseMutex() will _______ if the thread does not own the mutex.
A. return TRUE
B. throw exception
C. fail silently
D. fail
Correct Answer:
A
Chapter: 144
Q3185:
Windows mutexes support timeout values for _______ functions.
A. ReleaseMutex()
B. OpenMutex()
C. CreateMutex()
D. WaitForSingleObject()
Correct Answer:
D
Chapter: 145
Q3186:
Deadlocks may arise when _______ are used.
A. threads
B. memory buffers
C. Mutexes or CRITICAL SECTIONS
D. queues
Correct Answer:
C
Chapter: 145
Q3187:
Deadlock is a byproduct of _______.
A. concurrency control
B. error handling
C. memory management
D. process scheduling
Correct Answer:
A
Chapter: 145
Q3188:
What happens in a deadlock situation?
A. Threads execute in parallel
B. Memory is automatically freed
C. Two or more objects try to lock the same resource at the same time
D. CPU runs in idle state
Correct Answer:
C
Chapter: 145
Q3189:
Using concurrency objects improperly can lead to _______.
A. high performance
B. deadlocks
C. lost data
D. thread priority issues
Correct Answer:
B
Chapter: 145
Q3190:
If an element is allowed only when present in both lists or none, what must be synchronized?
A. Only one list
B. No list
C. Only insert operations
D. Both lists
Correct Answer:
D
Chapter: 145
Q3191:
Using a single mutex for two lists in concurrent updates will
A. enhance performance
B. degrade performance
C. remove deadlock risk
D. improve memory usage
Correct Answer:
B
Chapter: 145
Q3192:
A method to avoid deadlock is to maintain a _______.
A. thread log
B. resource pool
C. mutex map
D. hierarchy
Correct Answer:
D
Chapter: 145
Q3193:
In multithreading, all threads should acquire and release mutexes in the same _______.
A. process
B. thread order
C. hierarchy
D. order
Correct Answer:
D
Chapter: 145
Q3194:
The function WaitForMultipleObjects() allows
A. one mutex to be acquired at a time
B. both or none of the mutexes to be acquired
C. all threads to pause
D. thread creation
Correct Answer:
B
Chapter: 145
Q3195:
WaitForMultipleObjects() with fWaitAll flag helps in
A. avoiding memory leaks
B. avoiding deadlocks
C. managing priority
D. increasing execution time
Correct Answer:
B
Chapter: 145
Q3196:
This technique cannot be used with CRITICAL_SECTION.
A. Single mutex locking
B. Recursive locking
C. WaitForMultipleObjects with fWaitAll
D. Nested locking
Correct Answer:
C
Chapter: 145
Q3197:
Two lists maintained by different threads must be synchronized when they
A. share memory
B. contain duplicate values
C. affect one another's operation
D. are static
Correct Answer:
C
Chapter: 145
Q3198:
Concurrency objects help in
A. managing memory
B. increasing CPU usage
C. controlling access to resources
D. building GUIs
Correct Answer:
C
Chapter: 145
Q3199:
All threads should acquire mutexes in _______ to avoid deadlocks.
A. random order
B. reverse order
C. same order
D. none of the above
Correct Answer:
C
Chapter: 145
Q3200:
If a thread uses multiple mutexes, using _______ can help avoid deadlocks.
A. single-threaded model
B. mutex nesting
C. same acquisition order
D. different thread pools
Correct Answer:
C