System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 142
Q3081:
Accessing shared memory without synchronization may lead to ________.
A. accurate results
B. data consistency
C. invalid table
D. better speed
Correct Answer:
C
Chapter: 142
Q3082:
The producer thread runs ________ to generate messages.
A. continuously
B. on demand
C. periodically
D. after user input
Correct Answer:
C
Chapter: 142
Q3083:
Consumer displays message only when requested by the ________.
A. producer
B. table
C. checksum
D. user
Correct Answer:
D
Chapter: 142
Q3084:
________ helps avoid message display during update.
A. Table locking
B. Synchronization
C. Timestamping
D. Logging
Correct Answer:
B
Chapter: 142
Q3085:
Consumer validates messages using ________.
A. table index
B. CS lock
C. message ID
D. checksum
Correct Answer:
D
Chapter: 142
Q3086:
CS is used to enforce ________ in data access.
A. latency
B. serialization
C. integrity
D. duplication
Correct Answer:
C
Chapter: 143
Q3087:
What is the Producer-Consumer problem mainly used to demonstrate?
A. Thread communication
B. Mutual exclusion
C. Memory allocation
D. Interrupt handling
Correct Answer:
B
Chapter: 143
Q3088:
Which header file is used in the sample program?
A. <process.h>
B. <stdio.h>
C. Everything.h
D. <stdlib.h>
Correct Answer:
C
Chapter: 143
Q3089:
What does the `CRITICAL_SECTION` in the MSG_BLOCK structure ensure?
A. Data initialization
B. Data race
C. Mutex synchronization
D. Thread delay
Correct Answer:
C
Chapter: 143
Q3090:
Which flag indicates the readiness of a message in the sample program?
A. mChecksum
B. fStop
C. fReady
D. nCons
Correct Answer:
C
Chapter: 143
Q3091:
The producer generates a new message block only if _____.
A. fStop is set
B. fReady is 1
C. fReady is 0
D. mChecksum is valid
Correct Answer:
C
Chapter: 143
Q3092:
Which function is used to seed the random number generator in the Producer thread?
A. randomize()
B. srand()
C. rand()
D. time()
Correct Answer:
B
Chapter: 143
Q3093:
The data array size in MSG_BLOCK is
A. 128
B. 64
C. 512
D. 256
Correct Answer:
D
Chapter: 143
Q3094:
The message is filled with random values in the function
A. Produce()
B. Consume()
C. MessageDisplay()
D. MessageFill()
Correct Answer:
D
Chapter: 143
Q3095:
Which Windows API function is used to wait for thread termination?
A. WaitForProcess()
B. WaitForThread()
C. WaitForSingleObject()
D. Sleep()
Correct Answer:
C
Chapter: 143
Q3096:
What happens if the checksum does not match in MessageDisplay()?
A. Error message is printed
B. Program exits
C. Message is ignored
D. It is reprocessed
Correct Answer:
A
Chapter: 143
Q3097:
The Producer and Consumer threads share the same
A. Mutex only
B. Data only
C. Message block
D. MessageDisplay function
Correct Answer:
C
Chapter: 143
Q3098:
Each message block contains a timestamp to indicate
A. When it was validated
B. When it was received
C. When it was produced
D. When it was stopped
Correct Answer:
C
Chapter: 143
Q3099:
The correct function to increment `mSequence` atomically is
A. Increment()
B. AtomicAdd()
C. InterlockedIncrement()
D. ThreadSafeInc()
Correct Answer:
C
Chapter: 143
Q3100:
The Consumer prompts the user for action using which command?
A. s and r
B. c and s
C. p and c
D. q and t
Correct Answer:
B