System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q2901: To add 5 atomically, one should use ________.
- A: InterlockedIncrement() five times
- B: InterlockedExchangeAdd()
- C: InterlockedDecrement()
- D: malloc()
View Answer
B
Q2902: InterlockedIncrement64() can only be used if Addend is stored at ________.
- A: any memory location
- B: 4-byte boundary
- C: 2-byte boundary
- D: 8-byte boundary
View Answer
D
Q2903: Global variables should not be used to store ________.
- A: system-wide data
- B: constants
- C: thread-specific data
- D: environment variables
View Answer
C
Q2904: Using global storage for local thread data can lead to ________.
- A: better performance
- B: synchronized results
- C: incorrect behavior
- D: faster execution
View Answer
C
Q2905: In multithreaded programs, using the same global variable in all threads can cause ________.
- A: accurate results
- B: data consistency
- C: race conditions
- D: thread termination
View Answer
C
Q2906: What is the correct way to store thread-specific data?
- A: use global variables
- B: use local variables
- C: use static variables
- D: use registers
View Answer
B
Q2907: In the example, the variable 'N' is incorrectly used as a ________.
- A: shared counter
- B: thread ID
- C: thread-local variable
- D: static variable
View Answer
C
Q2908: A thread function that modifies a global variable will affect ________.
- A: only its own thread
- B: all other threads
- C: none of the threads
- D: the OS kernel
View Answer
B
Q2909: When many threads run simultaneously and access a global variable, the outcome is ________.
- A: stable
- B: undefined
- C: expected
- D: null
View Answer
B
Q2910: In the given example, what does the function ThreadFunc(pArgs) return?
- A: void
- B: pointer
- C: string
- D: DWORD
View Answer
D