System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 143
Q3101:
_____ is used to protect access to the shared message block.
A. MessageGuard
B. Critical Section
C. Deadlock prevention
D. Spinlock
Correct Answer:
B
Chapter: 143
Q3102:
The Producer stops producing messages when ____ is set.
A. fReady
B. fStop
C. mSequence
D. nCons
Correct Answer:
B
Chapter: 143
Q3103:
The Producer fills the message only after acquiring
A. Mutex
B. Semaphore
C. Spinlock
D. Critical section
Correct Answer:
D
Chapter: 143
Q3104:
The program uses how many threads besides the main thread?
A. 2
B. 1
C. 3
D. 4
Correct Answer:
A
Chapter: 143
Q3105:
Which of the following functions is not part of the sample program?
A. MessageDisplay()
B. MessageFill()
C. ThreadJoin()
D. Produce()
Correct Answer:
C
Chapter: 143
Q3106:
Checksum validation is performed in
A. Consume()
B. Produce()
C. MessageFill()
D. MessageDisplay()
Correct Answer:
D
Chapter: 143
Q3107:
The message buffer is initialized in the
A. Produce()
B. MessageFill()
C. main()
D. Consume()
Correct Answer:
B
Chapter: 143
Q3108:
What type is used for mData array elements?
A. int
B. long
C. DWORD
D. float
Correct Answer:
C
Chapter: 143
Q3109:
mBlock.nLost keeps track of
A. Messages consumed
B. Messages produced
C. Messages not consumed
D. Messages duplicated
Correct Answer:
C
Chapter: 143
Q3110:
The `mChecksum` variable stores
A. A hash of the thread ID
B. Validation result of the data buffer
C. Total message count
D. Error code
Correct Answer:
B
Chapter: 143
Q3111:
Which of the following is NOT a valid flag in MSG_BLOCK?
A. fReady
B. fStop
C. mData
D. mChecksum
Correct Answer:
C
Chapter: 143
Q3112:
To enter the critical section, the function used is
A. EnterCriticalSection()
B. LockMutex()
C. StartThread()
D. ThreadEnter()
Correct Answer:
A
Chapter: 143
Q3113:
_____ ensures that two threads don't access shared data at the same time.
A. Critical section
B. Interrupts
C. Compiler
D. Thread ID
Correct Answer:
A
Chapter: 143
Q3114:
Checksum validation in consumer thread is done by
A. Comparing with hash
B. Reading from mData[]
C. Recalculating XOR
D. Using MD5
Correct Answer:
C
Chapter: 143
Q3115:
_tscanf is used in the program to
A. Read from command line
B. Read file
C. Read from user
D. Read message
Correct Answer:
B
Chapter: 143
Q3116:
The Consumer thread starts when
A. hConsume handle is NULL
B. hConsume handle is created
C. main returns
D. thread sleeps
Correct Answer:
B
Chapter: 143
Q3117:
The last step in the main function is
A. Join the threads
B. Exit program
C. Print message
D. Free memory
Correct Answer:
C
Chapter: 143
Q3118:
The mSequence value represents
A. Number of messages produced
B. Number of consumers
C. Checksum count
D. Producer thread ID
Correct Answer:
A
Chapter: 143
Q3119:
_____ is responsible for displaying the message buffer.
A. Consumer
B. Producer
C. MessageFill
D. MessageDisplay
Correct Answer:
A
Chapter: 143
Q3120:
The Producer generates new messages at ____ intervals.
A. Fixed
B. Random
C. Interrupt-based
D. User-based
Correct Answer:
B