System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q2931: Variables that are local to a thread should be placed in ________.
- A: global memory
- B: registers
- C: stack or TLS
- D: file system
View Answer
C
Q2932: What should be avoided when writing thread-safe code?
- A: using TLS
- B: race conditions
- C: stack memory
- D: synchronization
View Answer
B
Q2933: Which storage is suitable for thread-specific data?
- A: file system
- B: global memory
- C: static storage
- D: thread-local storage
View Answer
D
Q2934: Race conditions can be prevented by using ________.
- A: mutexes and synchronization objects
- B: recursion
- C: pointers
- D: global variables
View Answer
A
Q2935: What happens if one thread modifies the process environment?
- A: No effect
- B: Only that thread is affected
- C: All threads are affected
- D: OS halts
View Answer
C
Q2936: Changing standard input or output in a thread can affect ________.
- A: only that thread
- B: the file system
- C: other threads
- D: process priority
View Answer
C
Q2937: Variables that need to be shared among threads should be protected using ________.
- A: static functions
- B: recursion
- C: memory barriers
- D: file locks
View Answer
C
Q2938: One of the key goals of thread-safe code is to avoid ________.
- A: stack overflow
- B: deadlocks
- C: synchronization
- D: data corruption
View Answer
D
Q2939: A function being used by several threads must store thread-specific variables in ________.
- A: shared registers
- B: TLS or dedicated DS
- C: environment variables
- D: disk cache
View Answer
B
Q2940: Threads should avoid changing ________ devices.
- A: local
- B: virtual
- C: standard input/output
- D: USB
View Answer
C