Critical Section MCQ Quiz in తెలుగు - Objective Question with Answer for Critical Section - ముఫ్త్ [PDF] డౌన్‌లోడ్ కరెన్

Last updated on Mar 16, 2025

పొందండి Critical Section సమాధానాలు మరియు వివరణాత్మక పరిష్కారాలతో బహుళ ఎంపిక ప్రశ్నలు (MCQ క్విజ్). వీటిని ఉచితంగా డౌన్‌లోడ్ చేసుకోండి Critical Section MCQ క్విజ్ Pdf మరియు బ్యాంకింగ్, SSC, రైల్వే, UPSC, స్టేట్ PSC వంటి మీ రాబోయే పరీక్షల కోసం సిద్ధం చేయండి.

Latest Critical Section MCQ Objective Questions

Top Critical Section MCQ Objective Questions

Critical Section Question 1:

Mutual exclusion problem occurs

  1. Between two disjoint processes that do not interact
  2. Among processes that share resources
  3. Among processes that do not use the same resource
  4. Between two processes that uses different resources of different machine
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : Among processes that share resources

Critical Section Question 1 Detailed Solution

Concept:

Mutual exclusion happens when two or more processes share the same resources but can not access the same resource at the same time. 

Explanation:

Mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions.

It is the requirement that one thread of execution never enters its critical section at the same time that another concurrent thread of execution enters its own critical section. This problem is resolved using different tools, e.g. semaphores.

Critical Section Question 2:

Which of the following is free from race condition?

  1. Preemptive kernels
  2. Non-preemptive kernels
  3. Monolithic kernels
  4. None of the above
  5. More than one of the above

Answer (Detailed Solution Below)

Option 2 : Non-preemptive kernels

Critical Section Question 2 Detailed Solution

A preemptive kernel allows a process to be preempted while it is running in kernel mode.

A non-preemptive kernel does not allow a process running in kernel mode to be preempted; a kernel-mode process will run until it exits kernel mode, blocks, or voluntarily yields control of the CPU. A non-preemptive kernel is essentially free from race conditions on kernel data structures, as only one process is active in the kernel at a time.

Critical Section Question 3:

To avoid the race condition, the number of processes that may be simultaneously inside their critical section is

  1. 6
  2. 8
  3. 1
  4. More than one of the above
  5. None of the above

Answer (Detailed Solution Below)

Option 3 : 1

Critical Section Question 3 Detailed Solution

The correct answer is option 3.

Concept:

Critical section:

The critical section is a code segment that allows access to the shared variables. In a critical section, an atomic action is needed, which means that only one process can execute in its critical part at a time. All of the other processes must wait for their essential parts to run.

Race condition:

A race condition is an unpleasant scenario that arises when a device or system attempts to conduct two or more operations at the same time, yet the activities must be performed in the right sequence due to the nature of the device or system.

Explanation:

To avoid a race scenario, only one process can run inside the Critical area at a time.
A race condition happens when a device or system attempts to complete two or more tasks at the same time.

Hence the correct answer is 1.

Critical Section Question 4:

Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100 : P1::D=D+20 P2::D=D+50 P3::D=D+10 The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y–X is 

  1. 110
  2. 20
  3. 80
  4. 10

Answer (Detailed Solution Below)

Option 3 : 80

Critical Section Question 4 Detailed Solution

The correct answer is 80

Explanation:

To determine the minimum and maximum values of D after the three concurrent processes P1, P2, and P3 have executed, let’s analyze step-by-step.

Given:

  • D is initialized to 100.
  • The processes are:
    • P1: D = D + 20
    • P2: D = D + 50
    • P3: D = D + 10
  • The processes are executed concurrently on a uniprocessor system with a time-shared operating system. This means the processes are interleaved (i.e., preempted) in arbitrary order.


Understanding the Problem:

The shared variable D is accessed by all three processes. Since the system is uniprocessor, it will perform operations in an interleaved manner.
Each process's operation D = D + X involves the following steps:
     1. Read the value of D .
     2. Add X to the value.
     3. Write the new value back to D .

If these operations are interleaved, race conditions can occur. Specifically:

  • The processes may overwrite each other's changes depending on the interleaving order.


We need to find:

  • X : The minimum value of D .
  • Y : The maximum value of D .


Then, compute Y - X .

Step 1: Ideal (Sequential Execution) Case

  • If the processes execute sequentially without any interference, the order of execution does not matter, and the result will be:


                                   D = 100 + 20 + 50 + 10 = 180.

        Thus, D = 180 in an ideal case.

Step 2: Worst-case (Interleaved Execution) Scenarios

  • In the worst case, race conditions will lead to overwriting of values. Here’s an example:
  • Example of Race Condition:

            1. P1 reads D = 100 .
            2. P2 reads D = 100 .
            3. P3 reads D = 100 .
            4. P1 writes D = 120 .
            5. P2 writes D = 150 .
            6. P3 writes D = 110 .

Here:

  • The final value of D is 110 (smallest possible).


Best-case Scenario:

  • If the processes execute without interference or complete sequentially, the maximum value of D is:


                                D = 180 (as calculated earlier).

Step 3: Compute Y - X

  • Minimum Value ( X ): 110 (due to race conditions).
  • Maximum Value ( Y ): 180 (ideal sequential execution).
  • The difference Y - X is:


                       Y - X = 180 - 110 = 70.

Correct Answer: 3) 80

Critical Section Question 5:

Which of the following statements are TRUE about mutual exclusion in concurrent programming?

(A) Mutual exclusion ensures that only one process can be in a critical section at any given time.

(B) Mutual exclusion are designed to prevent conflicts and ensure that only one process can access shared resources at a time.

(C) Mutual exclusion can use various algorithms to ensure that processes do not enter the critical section simultaneously.

(D) Mutual exclusion allows multiple processes to access the critical section simultaneously to improve performance.

Choose the correct answer from the options given below:

  1. (A), (B), (C) Only
  2. (B), (C), (D) Only
  3. (B), (D), (A) Only
  4. (A), (C), (D) Only

Answer (Detailed Solution Below)

Option 1 : (A), (B), (C) Only

Critical Section Question 5 Detailed Solution

The correct answer is (A), (B), (C) Only

EXPLANATION:

  • (A) Mutual exclusion ensures that only one process can be in a critical section at any given time. -
    • This statement is CORRECT. Mutual exclusion is a fundamental concept in concurrent programming aimed at preventing multiple processes from accessing a critical section simultaneously.
  • (B) Mutual exclusion are designed to prevent conflicts and ensure that only one process can access shared resources at a time. -
    • This statement is CORRECT. The primary goal of mutual exclusion is to avoid conflicts by ensuring exclusive access to shared resources.
  • (C) Mutual exclusion can use various algorithms to ensure that processes do not enter the critical section simultaneously. -
    • This statement is CORRECT. Algorithms such as Peterson's algorithm, the Bakery algorithm, and various lock mechanisms are used to implement mutual exclusion.
  • (D) Mutual exclusion allows multiple processes to access the critical section simultaneously to improve performance. -
    • This statement is NOT CORRECT. The purpose of mutual exclusion is to prevent multiple processes from accessing the critical section simultaneously, which is contrary to what this statement suggests.

Critical Section Question 6:

If three threads are trying to share a single object at the same time which condition will arise in the scenario?

  1. Race condition
  2. Recursion
  3. Time-lapse
  4. More than one of the above
  5. None of the above

Answer (Detailed Solution Below)

Option 1 : Race condition

Critical Section Question 6 Detailed Solution

The correct answer is option 1.

Concept:

If two or more threads attempt to access the same resource at the same time. This is referred to as a race condition. It usually happens while a multi-threaded application is running.

  • A race situation is a possible issue in multithreaded software. Assume a thread performs a series of activities, each of which is dependent on the outcome of a preceding action.
  • A race problem happens when another thread has the ability to alter or invalidate the outcome of the prior action before the first thread completes the sequence.
  • It may also refer to a programming error or issue that happens when the thread scheduler transfers threads at any point throughout the procedure.

Hence the correct answer is a Race condition.

Critical Section Question 7:

Which of the following statements are CORRECT?

(A) A process always check state of currently executing process to enter critical schema.

(B) Spin locks uses busy waiting.

(C) Periodically testing a variable until some value appear is known as busy waiting.

(D) Critical region is a part of program, where shared memory is kept.

(E) Printer daemon, continuously checks to see if there are any file to be printed.

Choose the correct answer from the options given below:

  1. (A) and (B) Only
  2. (B) and (C) Only 
  3. (B) and (D) Only 
  4. (B) and (E) Only

Answer (Detailed Solution Below)

Option 3 : (B) and (D) Only 

Critical Section Question 7 Detailed Solution

The correct answer is (B) and (D) Only

EXPLANATION:

  • (A) A process always check state of currently executing process to enter critical schema:
    • This is not necessarily correct. A process does not always need to check the state of the currently executing process to enter the critical section. It just needs to ensure mutual exclusion i.e. if another process is executing in its critical section, then no other process can enter the critical section.
  • (B) Spin locks use busy waiting:
    • This is correct. A spin lock is a type of lock where a thread repeatedly checks if the lock is free. If the lock is not free the thread continues to 'spin' in a loop (hence the name 'spin lock'), checking until the lock becomes free.
  • (D) Critical region is a part of program, where shared memory is kept:
    • This is correct, a critical region or a critical section in a program is a place where shared resources, such as shared memory, are accessed. These critical sections need to be protected to prevent race conditions or data inconsistency when the resources are accessed by multiple threads or processes concurrently.
  • (E) Printer daemon, continuously checks to see if there are any file to be printed:
    • This is partially correct. While a printer daemon can periodically check for new jobs, saying it "continuously checks" may not be fully representative of how it functions - it often responds to interrupts or other signals generated when a new print job arrives. This depends on the implementation of the software.

So the correct answer is 3) (B) and (D) Only.

Critical Section Question 8:

In operating system, No two processes should be allowed to be inside their critical region at the same time, this condition is known as _____.

  1. Circular waiting
  2. Spooling
  3. Paging
  4. Mutual exclusion

Answer (Detailed Solution Below)

Option 4 : Mutual exclusion

Critical Section Question 8 Detailed Solution

The correct answer is Mutual exclusion.

Key Points

  • Mutual exclusion is a property of concurrency control, which is used to prevent race conditions in a system.
  • It ensures that no two processes can access the critical section at the same time, thus preventing conflicts and ensuring data consistency.
  • Critical sections are parts of the code where shared resources are accessed, and mutual exclusion ensures that only one process can execute its critical section at a time.

Additional Information

  • Circular waiting: This is one of the conditions necessary for a deadlock to occur, where each process is waiting for a resource that is held by another process in a circular chain.
  • Spooling: This refers to putting data temporarily in a storage area to be used and processed by another program or device. It is often used in printing tasks.
  • Paging: This is a memory management scheme that eliminates the need for contiguous allocation of physical memory. It allows the physical address space of a process to be non-contiguous.

Critical Section Question 9:

If three threads are trying to share a single object at the same time which condition will arise in the scenario?

  1. Race condition
  2. Recursion
  3. Time-lapse
  4. Critical situation

Answer (Detailed Solution Below)

Option 1 : Race condition

Critical Section Question 9 Detailed Solution

The correct answer is option 1.

Concept:

If two or more threads attempt to access the same resource at the same time. This is referred to as a race condition. It usually happens while a multi-threaded application is running.

  • A race situation is a possible issue in multithreaded software. Assume a thread performs a series of activities, each of which is dependent on the outcome of a preceding action.
  • A race problem happens when another thread has the ability to alter or invalidate the outcome of the prior action before the first thread completes the sequence.
  • It may also refer to a programming error or issue that happens when the thread scheduler transfers threads at any point throughout the procedure.

Hence the correct answer is a Race condition.

Critical Section Question 10:

To avoid the race condition, the number of processes that may be simultaneously inside their critical section is

  1. 6
  2. 8
  3. 1
  4. 0

Answer (Detailed Solution Below)

Option 3 : 1

Critical Section Question 10 Detailed Solution

The correct answer is option 3.

Concept:

Critical section:

The critical section is a code segment that allows access to the shared variables. In a critical section, an atomic action is needed, which means that only one process can execute in its critical part at a time. All of the other processes must wait for their essential parts to run.

Race condition:

A race condition is an unpleasant scenario that arises when a device or system attempts to conduct two or more operations at the same time, yet the activities must be performed in the right sequence due to the nature of the device or system.

Explanation:

To avoid a race scenario, only one process can run inside the Critical area at a time.
A race condition happens when a device or system attempts to complete two or more tasks at the same time.

Hence the correct answer is 1.

Get Free Access Now
Hot Links: teen patti gold apk teen patti master teen patti mastar teen patti master downloadable content teen patti dhani