System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q3351: The producer uses which synchronization primitive to guard the message block?
- A: Event
- B: Mutex
- C: Semaphore
- D: Critical Section
View Answer
B
Q3352: The producer-consumer problem solution described is implemented using which programming language?
- A: C++
- B: Java
- C: C#
- D: Python
View Answer
A
Q3353: fReady and fStop are examples of:
- A: Flags
- B: Mutexes
- C: Events
- D: Threads
View Answer
A
Q3354: In the context of the code, what does SetEvent() function do?
- A: Signals that a message is ready
- B: Locks the message buffer
- C: Starts the producer thread
- D: Stops the consumer thread
View Answer
A
Q3355: The consumer thread checks the command input. What are the valid commands?
- A: c and s
- B: a and b
- C: x and y
- D: p and q
View Answer
A
Q3356: When the consumer consumes a message, what happens to nCons?
- A: It increments
- B: It decrements
- C: It resets
- D: It remains unchanged
View Answer
A
Q3357: The condition 0 <= nLost + nCons <= mSequence ensures:
- A: Message count consistency
- B: Checksum validity
- C: Mutex locking
- D: Thread synchronization
View Answer
A
Q3358: What is the initial value of mBlock as defined in the program?
- A: All zeros
- B: All ones
- C: Random values
- D: Uninitialized
View Answer
A
Q3359: Which synchronization object type is created by CreateMutex?
- A: Event
- B: Mutex
- C: Semaphore
- D: Critical Section
View Answer
B
Q3360: MessageFill uses a for loop to:
- A: Fill mData with random values
- B: Lock mutex
- C: Validate checksum
- D: Wait for event
View Answer
A