System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q2811: Before a thread modifies a variable, it should check ________.
- A: If the CPU is idle
- B: If other variables exist
- C: The value of flag
- D: Memory usage
View Answer
C
Q2812: The critical section problem occurs because multiple threads try to access ________.
- A: Static variables
- B: Shared resources
- C: Their own memory
- D: Deadlocks
View Answer
B
Q2813: When is the flag turned to FALSE in the global variable solution?
- A: Before modifying
- B: After modifying
- C: During execution
- D: Never
View Answer
B
Q2814: In the flag solution, what does a TRUE value of flag indicate?
- A: Data is unused
- B: Variable is available
- C: Variable is in use
- D: Memory is free
View Answer
C
Q2815: A global variable used for synchronization is shared among ________.
- A: CPUs
- B: Threads
- C: Classes
- D: Files
View Answer
B
Q2816: Which two operations form the critical region in the flag solution?
- A: Check memory and set CPU
- B: Test flag and set flag TRUE
- C: Create flag and destroy flag
- D: Allocate and deallocate
View Answer
B
Q2817: Critical section problems arise when two or more threads access shared resources ________.
- A: Sequentially
- B: With locks
- C: Concurrently
- D: Silently
View Answer
C
Q2818: The global variable solution to synchronization uses a variable called ________.
- A: Status
- B: Count
- C: Lock
- D: Flag
View Answer
D
Q2819: A drawback of using a flag is that a thread can be preempted between ________.
- A: Waiting and writing
- B: Testing and setting flag
- C: Allocating and deallocating
- D: Compiling and debugging
View Answer
B
Q2820: A better solution to synchronization might be to give each thread ________.
- A: A shared lock
- B: Same memory
- C: Own copy of variable
- D: Random flag
View Answer
C