Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 135
Q2901:
To add 5 atomically, one should use ________.
A. InterlockedIncrement() five times
B. InterlockedExchangeAdd()
C. InterlockedDecrement()
D. malloc()
Correct Answer: B
Chapter: 135
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
Correct Answer: D
Chapter: 136
Q2903:
Global variables should not be used to store ________.
A. system-wide data
B. constants
C. thread-specific data
D. environment variables
Correct Answer: C
Chapter: 136
Q2904:
Using global storage for local thread data can lead to ________.
A. better performance
B. synchronized results
C. incorrect behavior
D. faster execution
Correct Answer: C
Chapter: 136
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
Correct Answer: C
Chapter: 136
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
Correct Answer: B
Chapter: 136
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
Correct Answer: C
Chapter: 136
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
Correct Answer: B
Chapter: 136
Q2909:
When many threads run simultaneously and access a global variable, the outcome is ________.
A. stable
B. undefined
C. expected
D. null
Correct Answer: B
Chapter: 136
Q2910:
In the given example, what does the function ThreadFunc(pArgs) return?
A. void
B. pointer
C. string
D. DWORD
Correct Answer: D
Chapter: 136
Q2911:
When converting single-threaded code to multithreaded, ________ can become more complex.
A. disk access
B. I/O handling
C. variable scoping
D. pointer arithmetic
Correct Answer: C
Chapter: 136
Q2912:
A correct approach to avoid data corruption in threads is to use ________.
A. global variables
B. local thread storage
C. environment variables
D. class members
Correct Answer: B
Chapter: 136
Q2913:
The code N += ThreadFunc(pArgs); works properly in ________ programs.
A. multi-core
B. multithreaded
C. single-threaded
D. GPU-based
Correct Answer: C
Chapter: 136
Q2914:
Returning values from thread functions is safer than modifying ________.
A. structures
B. global variables
C. memory segments
D. file descriptors
Correct Answer: B
Chapter: 136
Q2915:
Each thread should maintain its own copy of variables that contain ________.
A. file pointers
B. constant data
C. thread-specific values
D. loop indices
Correct Answer: C
Chapter: 136
Q2916:
Global variables used without synchronization in threads may lead to ________.
A. deadlocks
B. memory leaks
C. race conditions
D. infinite loops
Correct Answer: C
Chapter: 136
Q2917:
When thread-specific data is stored in global variables, final results become ________.
A. optimized
B. inconsistent
C. compressed
D. secure
Correct Answer: B
Chapter: 136
Q2918:
A variable can be global if its data is shared ________.
A. across processes
B. across OS
C. among threads
D. among users
Correct Answer: C
Chapter: 136
Q2919:
A local variable inside a thread function is not accessible by ________.
A. itself
B. other threads
C. the same function
D. static blocks
Correct Answer: B
Chapter: 136
Q2920:
Thread-specific data should be isolated to prevent ________.
A. high memory usage
B. low performance
C. data interference
D. compilation errors
Correct Answer: C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now