0% found this document useful (0 votes)
7 views

MCQ

Uploaded by

naheba6024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

MCQ

Uploaded by

naheba6024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Concurrency: Mutual Exclusion and Synchronization

01. What is a critical section in concurrency?


a. A section of code that must execute atomically without interruption.
b. A section of code with the highest priority
c. A section of code that can be interrupted by other processes.
d. A section of code responsible for initializing variables.

02. What is the purpose of a semaphore in concurrency?


a. To disable interruptions. b. To signal between processes.
c. To define critical sections. d. To allocate memory for processes.

03. What is the race condition in concurrent processing?


a. A competition between processes to finish first.
b. A situation where processes are unable to proceed.
c. A situation where the result depends on the timing of execution.
d. A condition where processes continuously change states.

04. What does the term "deadlock" refer to in concurrency?


a. A situation where processes continuously change states.
b. A condition where processes are unable to proceed.
c. A situation where multiple threads compete for shared resources.
d. A situation where two or more processes are waiting for each other.

05. What is the role of a mutex in concurrency?


a. To disable interruptions. b. To provide mutual exclusion.
c. To signal between processes. d. To define critical sections.

06. Which mechanism uses a queue to hold processes waiting on a semaphore?


a. Mutex b. Monitor c. Semaphore d. Event Flags

07. What is the purpose of a condition variable in a monitor?


a. To define critical sections. b. To block a process until a specific condition is true.
c. To signal between processes. d. To allocate memory for processes.

08. What is the primary purpose of message passing in concurrency?


a. To disable interrupts b. To synchronize processes
c. To define critical sections d. To allocate memory for processes
09. In the context of semaphores, what does "blocking" mean?
a. Processes continue immediately. b. Processes are delayed until a condition is met.
c. Processes are terminated. d. Processes are given higher priority.

10. What is a potential disadvantage of using interrupt disabling for mutual exclusion?
a. Increased efficiency of execution b. Compatibility with multiprocessor architectures
c. Noticeable degradation in execution efficiency d. Prevention of deadlock situations

11. Which programming language construct encapsulates variables, access procedures, and initialization
within an abstract data type?
a. Semaphore b. Monitor c. Mutex d. Condition Variable

12. In the context of semaphores, what is a "weak semaphore"?


a. A semaphore that allows any process to access critical sections
b. A semaphore that does not enforce mutual exclusion.
c. A semaphore with inefficient blocking mechanisms
d. A semaphore that allows processes to exit critical sections without proper synchronization.

13. What is the purpose of a binary semaphore?


a. To perform arithmetic operations. b. To signal between processes.
c. To restrict access to a single process at a time. d. To allocate memory for processes.

14. What does the term "livelock" refer to in concurrency?


a. A situation where processes are unable to proceed.
b. A situation where two or more processes continuously change states.
c. A situation where a process is denied access to a critical section.
d. A situation where processes compete for shared resources.

15. What is the primary purpose of a spin lock?


a. To disable interruptions. b. To provide mutual exclusion.
c. To execute an infinite loop waiting for a lock. d. To signal between processes.

16. How is a deadlock different from livelock?


a. In a deadlock, processes continuously change states.
b. In a deadlock, processes are unable to proceed.
c. Livelock involves a competition for shared resources.
d. Livelock is a situation where processes are waiting for each other.
17. What is a characteristic of a monitor in concurrent programming?
a. Access to local data is not restricted.
b. Multiple processes can actively access the monitor simultaneously.
c. Only one process may be actively accessing the monitor at any time.
d. Monitors do not use condition variables.

18. What is the purpose of a condition variable in a monitor?


a. To block a process until a particular condition is true.
b. To signal between processes.
c. To define critical sections.
d. To allocate memory for processes.

19. Which programming construct is often easier to control than semaphores and provides equivalent
functionality?
a. Semaphore b. Mutex c. Monitor d. Event Flags

20. In the context of message passing, what is the purpose of indirect addressing?
a. The send primitive includes a specific identifier of the destination process.
b. Messages are sent to a shared data structure consisting of queues.
c. Messages are exchanged directly between processes.
d. Queues are referred to as mailboxes for temporary message storage.
Concurrency: Deadlock and Starvation
01. What is the primary characteristic of a deadlock in a system?
a. High CPU utilization b. Low memory usage
c. Permanent blocking of processes d. Efficient resource allocation

02. Which of the following is a condition for deadlock?


a. Priority Inversion b. Mutual Exclusion c. Process Migration d. Round Robin Scheduling

03. Consumable resources, such as signals and messages, are prone to deadlock when:
a. They are shared among processes. b. They are created and destroyed during execution.
c. They are preemptively allocated. d. They are used in a round-robin fashion.

04. What does the Hold-and-Wait condition for deadlock involve?


a. A process holding allocated resources while waiting for others
b. Simultaneous access to a resource by multiple processes
c. Automatic resource preemption
d. A closed chain of processes with circular waits

05. What is a safe state in the context of deadlock avoidance?


a. A state with no processes running
b. A state leading to deadlock
c. A state where resource allocations can lead to deadlock
d. A state where a sequence of resource allocations avoids deadlock

06. The Banker's algorithm is used for:


a. Deadlock detection b. Deadlock prevention
c. Deadlock recovery d. Deadlock avoidance

07. What is the purpose of a semaphore in concurrency?


a. To prevent deadlock b. To implement mutual exclusion
c. To avoid starvation d. To recover from deadlock

08. In the context of deadlock, what is circular wait?


a. A process holding resources is denied further requests
b. A closed chain of processes where each holds a resource needed by the next
c. Only one process may use a resource at a time
d. Resources are allocated to a process while it is waiting
09. Which mechanism allows multiple threads to have simultaneous read-only access to an object?
a. Mutex Locks b. Semaphores c. Readers/Writer Locks d. Condition Variables

10. The Dining Philosophers Problem is used to illustrate issues related to:
a. Starvation b. Deadlock c. CPU scheduling d. Memory fragmentation

11. In the context of deadlock, what does the "No Preemption" condition imply?
a. Resources can be forcibly removed from a process
b. Resources must be released and requested again
c. Only one process may use a resource at a time
d. A process may hold allocated resources while waiting for others

12. What is the primary disadvantage of using spinlocks in Linux?


a. High resource utilization
b. Low efficiency in short wait times
c. Deadlock occurrence
d. Locked-out threads continue to execute in a busy-waiting mode

13. The resource allocation denial strategy, also known as the Banker's algorithm, is designed to:
a. Detect deadlock and take action to recover
b. Prevent deadlock by excluding one of the conditions
c. Make dynamic choices based on the current state of resource allocation
d. Eliminate circular wait in the system

14. What is the main purpose of condition variables in concurrency?


a. To enforce mutual exclusion b. To wait until a particular condition is true
c. To implement semaphore operations d. To prevent priority inversion

15. Which of the following is a disadvantage of frequent deadlock checks in a system?


a. Early detection of deadlock b. Simple algorithm implementation
c. Minimal processor time consumption d. High processor time consumption

16. The primary goal of deadlock recovery strategies is to:


a. Prevent deadlock b. Detect and eliminate deadlock
c. Avoid starvation d. Maximize CPU utilization
17. Shared Memory is considered the fastest form of interprocess communication because:
a. It uses circular buffers
b. It allows multiple processes to share the same memory space
c. It relies on signals for communication
d. It supports atomic operations

18. In the context of deadlock, what is the purpose of deadlock avoidance?


a. To dynamically make decisions on resource allocation
b. To recover from a deadlock once it occurs
c. To prevent the occurrence of one of the necessary conditions
d. To limit access to resources by imposing restrictions on processes

19. What does the term "starvation" refer to in the context of concurrency?
a. Permanent blocking of processes
b. High CPU utilization
c. Processes waiting indefinitely for a resource
d. Simultaneous access to a resource by multiple processes

20. The UNIX mechanism that allows two processes to communicate on the producer-consumer model
using a first-in-first-out queue is called:
a. Shared Memory b. Pipes c. Messages d. Semaphores
Multiprocessor, Multicore, and Real-Time Scheduling
01. What is the key characteristic of a tightly coupled multiprocessor system?
a. independent processors b. Shared main memory.
c. Loosely connected clusters d. Functionally specialized processors.

02. In independent parallelism, processes:


a. Are tightly synchronized b. Represent separate, independent applications.
c. Share a common memory space d. Cannot run concurrently.

03. What is the typical use of coarse and very coarse-grained parallelism?
a. Real-time applications b. Time-sharing systems
c. Parallel clusters d. Distributed networks

04. Medium-grained parallelism involves:


a. No synchronization among processes b. High coordination among threads
c. Gross-level synchronization d. Specialized and fragmented approaches.

05. What is a potential drawback of static assignment of processes to processors?


a. High coordination among threads b. Idle processors with empty queues
c. Dynamic load balancing d. Coarse-grained parallelism

06. In master/slave architecture, what is the role of the master processor?


a. Execute kernel functions b. Send service requests to slaves.
c. Run concurrently with other processors d. Ensure dynamic load balancing.

07. What is a disadvantage of master/slave architecture?


a. Simple and requires little enhancement b. Failure of the master brings down the whole system.
c. Efficient conflict resolution d. No risk of a performance bottleneck

08. In thread scheduling, what does gang scheduling involve?


a. No synchronization among threads b. Scheduling related threads to run concurrently.
c. Dedicated processor assignment d. Dynamic alteration of thread numbers

09. What is the primary concern of real-time systems?


a. Deterministic and responsive operation b. Maximum processor utilization
c. Coarse-grained parallelism d. independent parallelism
10. What is a characteristic of a hard real-time task?
a. It has a desirable but not mandatory deadline.
b. It must meet its deadline, or the consequences are unacceptable.
c. It has no associated deadline.
d. It requires synchronization with other tasks.

11. Periodic tasks have requirements stated as:


a. Desirable deadlines b. Mandatory deadlines
c. Either once per period or exactly T units apart d. Aperiodic completion

12. What is a potential drawback of load sharing in multiprocessor thread scheduling?


a. Efficient utilization of cache b. Even distribution of load
c. Centralized queue leading to bottlenecks d. Improved performance of thread switches.

13. What does gang scheduling emphasize?


a. Load distribution across processors b. Scheduling related threads to run concurrently.
c. Dedicated processor assignment d. Dynamic alteration of thread numbers

14. In deadline scheduling, what does "Starting deadline" represent?


a. Time task becomes ready for execution b. Time task must begin.
c. Time task must be completed d. Time required to execute the task to completion.

15. What is a potential issue with unbounded priority inversion?


a. It leads to efficient synchronization. b. It depends on unpredictable actions of unrelated tasks.
c. It always benefits system performance. d. It is a fixed and predictable duration.

16. What is the primary concern of real-time operating systems regarding user control?
a. Limited control over task priority b. Fine-grained control over task priority
c. No user control d. Random control over task priority

17. Why is reliability more important for real-time systems?


a. Real-time systems respond to events in real-time.
b. Real-time systems prioritize speed over reliability.
c. Loss of reliability may have catastrophic consequences.
d. Reliability is not a concern in real-time applications.
18. What do dynamic best-effort approaches involve in real-time scheduling?
a. Feasibility analysis performed at runtime.
b. Strict adherence to predetermined schedules.
c. No feasibility analysis; system aborts missed deadlines.
d. Dynamic planning-based scheduling.

19. In a real-time system, what does fail-soft operation refer to?


a. The ability to fail without any consequences. b. Maintaining system stability even in failure.
c. A system that is prone to frequent failures. d. Complete shutdown in case of any failure.

20. What is a characteristic of hard real-time tasks?


a. They have desirable but not mandatory deadlines.
b. They must meet their deadlines or cause unacceptable consequences.
c. They have no associated deadlines.
d. They require synchronization with other tasks.

You might also like