Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 140
Q3021:
One example of a shared variable in a server could be ________.
A. IP address
B. number of responses
C. thread ID
D. buffer length
Correct Answer: B
Chapter: 140
Q3022:
The CRITICAL_SECTION construct is used in ________ programming.
A. single-threaded
B. multithreaded
C. batch file
D. sequential
Correct Answer: B
Chapter: 140
Q3023:
Shared variables should be modified inside a ________.
A. log file
B. critical section
C. mutex queue
D. return call
Correct Answer: B
Chapter: 140
Q3024:
When using CRITICAL_SECTION, an intermediate variable is used to ________.
A. confuse the compiler
B. improve memory use
C. demonstrate the concept
D. divide access
Correct Answer: C
Chapter: 140
Q3025:
The number of requests currently under process is a type of ________.
A. dynamic function
B. static input
C. shared variable
D. hardware trigger
Correct Answer: C
Chapter: 140
Q3026:
Which of the following would NOT need protection via CRITICAL_SECTION?
A. count of processed responses
B. current thread ID
C. shared resource access log
D. database connection count
Correct Answer: B
Chapter: 140
Q3027:
________ is used to manage synchronization for shared data in threads.
A. CRITICAL_SECTION
B. HTTP_REQUEST
C. API_ROUTE
D. TCP_BLOCK
Correct Answer: A
Chapter: 140
Q3028:
The critical section ensures that threads modify shared data in a ________ manner.
A. competitive
B. race-condition-prone
C. orderly
D. undefined
Correct Answer: C
Chapter: 140
Q3029:
Before modifying a shared variable, a thread must first ________ the critical section.
A. leave
B. ignore
C. enter
D. bypass
Correct Answer: C
Chapter: 140
Q3030:
After updating a shared variable, a thread must ________ the critical section.
A. reinitialize
B. destroy
C. leave
D. renew
Correct Answer: C
Chapter: 140
Q3031:
Shared variables like request counters are prone to ________ if not protected.
A. memory leaks
B. race conditions
C. segmentation faults
D. deadlocks
Correct Answer: B
Chapter: 140
Q3032:
The use of intermediate variables helps to ________ the critical section logic.
A. reduce clarity
B. complicate code
C. emphasize
D. delay execution
Correct Answer: C
Chapter: 140
Q3033:
The purpose of protecting shared variables is to maintain ________.
A. data consistency
B. thread duplication
C. CPU cycle optimization
D. cache invalidation
Correct Answer: A
Chapter: 140
Q3034:
In the given example, CRITICAL_SECTION was used to protect ________.
A. log messages
B. string literals
C. status counters
D. binary files
Correct Answer: C
Chapter: 140
Q3035:
The term “shared variable” refers to variables that are ________ by multiple threads.
A. stored
B. accessed
C. ignored
D. owned
Correct Answer: B
Chapter: 140
Q3036:
If a thread enters a CRITICAL_SECTION, other threads attempting to enter are ________.
A. terminated
B. blocked
C. skipped
D. reversed
Correct Answer: B
Chapter: 140
Q3037:
The CRITICAL_SECTION construct avoids the occurrence of ________ while accessing shared data.
A. signal overflow
B. data fragmentation
C. race conditions
D. memory exhaustion
Correct Answer: C
Chapter: 140
Q3038:
Only ________ thread can modify a shared variable at a time when using CRITICAL_SECTION.
A. one
B. two
C. all
D. background
Correct Answer: A
Chapter: 140
Q3039:
The shared variable modification in CRITICAL_SECTION is done in a ________ manner.
A. random
B. nested
C. mutually exclusive
D. repeated
Correct Answer: C
Chapter: 141
Q3040:
Shared variables must be protected by ________ synchronization object across all threads.
A. multiple
B. any random
C. a single
D. a dynamic
Correct Answer: C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now