System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 131
Q2801:
In the given example, initial value of N is ________.
A. 5
B. 4
C. 6
D. 3
Correct Answer:
B
Chapter: 131
Q2802:
After thread 1 executes alone, what are the values of M and N?
A. M=5, N=5
B. M=4, N=4
C. M=6, N=6
D. M=5, N=4
Correct Answer:
A
Chapter: 131
Q2803:
After thread 2 executes after thread 1 (normal), what are the final values?
A. M=4, N=4
B. M=5, N=5
C. M=6, N=6
D. M=5, N=6
Correct Answer:
C
Chapter: 131
Q2804:
Worker threads should not access each other’s data before all workers are ________.
A. Terminated
B. Created
C. Blocked
D. Optimized
Correct Answer:
B
Chapter: 131
Q2805:
Synchronization ensures that a thread completes ________ before another uses its data.
A. Debugging
B. Execution
C. Termination
D. Switching
Correct Answer:
B
Chapter: 131
Q2806:
Which data structure is mentioned in relation to thread conflict?
A. Stack
B. Queue
C. Heap
D. Array
Correct Answer:
B
Chapter: 131
Q2807:
In the code example, which operation is performed by both threads?
A. M = N + 2
B. M = N
C. M = M * 2
D. N = M + 1
Correct Answer:
B
Chapter: 131
Q2808:
What must be prevented when multiple threads remove from a queue?
A. Empty queue
B. Multiple deletions
C. Delays
D. Memory overflow
Correct Answer:
B
Chapter: 132
Q2809:
What kind of error arises due to improper handling of shared resources in parallel processing?
A. Syntax error
B. Compilation error
C. Critical section problem
D. Runtime warning
Correct Answer:
C
Chapter: 132
Q2810:
The solution using a global variable uses a flag to indicate if a variable is being ________.
A. Printed
B. Skipped
C. Modified
D. Copied
Correct Answer:
C
Chapter: 132
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
Correct Answer:
C
Chapter: 132
Q2812:
The critical section problem occurs because multiple threads try to access ________.
A. Static variables
B. Shared resources
C. Their own memory
D. Deadlocks
Correct Answer:
B
Chapter: 132
Q2813:
When is the flag turned to FALSE in the global variable solution?
A. Before modifying
B. After modifying
C. During execution
D. Never
Correct Answer:
B
Chapter: 132
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
Correct Answer:
C
Chapter: 132
Q2815:
A global variable used for synchronization is shared among ________.
A. CPUs
B. Threads
C. Classes
D. Files
Correct Answer:
B
Chapter: 132
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
Correct Answer:
B
Chapter: 132
Q2817:
Critical section problems arise when two or more threads access shared resources ________.
A. Sequentially
B. With locks
C. Concurrently
D. Silently
Correct Answer:
C
Chapter: 132
Q2818:
The global variable solution to synchronization uses a variable called ________.
A. Status
B. Count
C. Lock
D. Flag
Correct Answer:
D
Chapter: 132
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
Correct Answer:
B
Chapter: 132
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
Correct Answer:
C