System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 147
Q3241:
When a thread waits on a semaphore, the count is _______ once the thread is released.
A. incremented
B. decremented
C. maintained
D. reset
Correct Answer:
B
Chapter: 147
Q3242:
The semaphore count must always satisfy the condition _______.
A. 0 <= count <= maximum
B. count >= 0
C. count < 0
D. count > maximum
Correct Answer:
A
Chapter: 147
Q3243:
A semaphore's signaled state means it can _______.
A. allow a waiting thread to proceed
B. block other threads
C. wait for signal
D. stop execution
Correct Answer:
A
Chapter: 147
Q3244:
The ReleaseSemaphore function increases the count by the value of _______.
A. cReleaseCount
B. lpPreviousCount
C. 1
Correct Answer:
A
Chapter: 147
Q3245:
Which parameter in CreateSemaphore() sets the maximum allowed count?
A. lSemMax
B. lSemInitial
C. lpSemName
D. lpsa
Correct Answer:
A
Chapter: 147
Q3246:
If ReleaseSemaphore() fails, the semaphore count will _______.
A. change
B. remain unchanged
C. double
D. zero out
Correct Answer:
B
Chapter: 147
Q3247:
The initial semaphore count represents the number of _______.
A. allowed waiting threads
B. available resources
C. maximum locks
D. maximum threads
Correct Answer:
B
Chapter: 148
Q3248:
A semaphore count represents the number of _______.
A. available threads
B. available resources
C. maximum threads
D. locked resources
Correct Answer:
B
Chapter: 148
Q3249:
In a producer-consumer scenario, the producer calls _______ after placing an element in the queue.
A. WaitSemaphore()
B. ReleaseSemaphore()
C. CreateSemaphore()
D. OpenSemaphore()
Correct Answer:
B
Chapter: 148
Q3250:
The consumer in a producer-consumer scenario _______ on the semaphore before consuming an item.
A. releases
B. waits
C. creates
D. opens
Correct Answer:
B
Chapter: 148
Q3251:
Semaphore maximum represents the _______.
A. number of threads
B. number of resources
C. maximum wait time
D. maximum queue size
Correct Answer:
B
Chapter: 148
Q3252:
When a thread is created in a suspended state, it will not _______ until activated.
A. start
B. wait
C. release
D. signal
Correct Answer:
A
Chapter: 148
Q3253:
Using semaphores can help avoid _______ threads in suspended state.
A. multiple
B. creating
C. waiting
D. executing
Correct Answer:
B
Chapter: 148
Q3254:
The function used to increase the semaphore count after producing an item is _______.
A. ReleaseSemaphore()
B. WaitSemaphore()
C. CreateSemaphore()
D. OpenSemaphore()
Correct Answer:
A
Chapter: 148
Q3255:
A semaphore initialized to 0 causes threads to _______ until the semaphore is released.
A. run
B. wait
C. stop
D. continue
Correct Answer:
B
Chapter: 148
Q3256:
In a semaphore-based producer-consumer model, the consumer _______ the semaphore count when it consumes an item.
A. increments
B. decrements
C. resets
D. ignores
Correct Answer:
B
Chapter: 148
Q3257:
Semaphores help enforce _______ exclusion in concurrent programming.
A. mutual
B. thread
C. shared
D. resource
Correct Answer:
A
Chapter: 148
Q3258:
Threads waiting on a semaphore are blocked until the semaphore count is _______.
A. negative
B. zero
C. greater than 0
D. less than 0
Correct Answer:
C
Chapter: 148
Q3259:
The producer-consumer problem can be efficiently handled using _______.
A. semaphores
B. mutexes
C. critical sections
D. locks
Correct Answer:
A
Chapter: 148
Q3260:
When the semaphore count is zero, the semaphore is considered _______.
A. signaled
B. unsignaled
C. invalid
D. waiting
Correct Answer:
B