System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q2921: The example DWORD N=0; inside a for loop in a single-threaded program is ________.
- A: safe
- B: dangerous
- C: incorrect
- D: multithreaded
View Answer
A
Q2922: In the for loop, N += ThreadFunc(pArgs); aggregates return values ________.
- A: in multiple threads
- B: in parallel threads
- C: in serial fashion
- D: via external function
View Answer
C
Q2923: A global variable modified by multiple threads simultaneously requires ________.
- A: no changes
- B: user input
- C: synchronization
- D: recursion
View Answer
C
Q2924: Using the same variable in multiple threads without isolation leads to data ________.
- A: encapsulation
- B: protection
- C: duplication
- D: corruption
View Answer
D
Q2925: ThreadFunc should return a value rather than modifying a shared variable to ensure ________.
- A: clarity
- B: speed
- C: thread safety
- D: concurrency
View Answer
C
Q2926: Variables used to return thread-specific results should be declared ________ the thread.
- A: outside
- B: inside
- C: globally
- D: statically
View Answer
B
Q2927: If a function modifies a global variable for its local logic, it is a ________ design.
- A: secure
- B: standard
- C: flawed
- D: optimal
View Answer
C
Q2928: Global variables can safely be used in threads if the data is ________.
- A: user input
- B: OS-specific
- C: shared among all threads
- D: output only
View Answer
C
Q2929: The main problem with using global variables in threads is ________.
- A: long execution time
- B: high memory usage
- C: unpredictable results
- D: low CPU load
View Answer
C
Q2930: Thread-safe code ensures that multiple threads can execute code without ________.
- A: memory allocation
- B: blocking I/O
- C: synchronization issues
- D: variable declarations
View Answer
C