MauryaHub PYQ Practice

cs4022_2026T1_Q2_NA.pdf

Operating System · Quiz 2 · Jan 2026

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

Question 2 MSQ · 3.0 marks

Consider the following solution for the critical section problem using a shared variable [[IMAGE:8cecebef11039aac_2_2]] . [[IMAGE:8cecebef11039aac_2_3]] Which of the following statements are correct?
Source diagram or notationSource diagram or notation
  1. Mutual exclusion is guaranteed.
  2. The solution satisfies the progress condition.
  3. Bounded waiting is guaranteed.
  4. Deadlock can occur if one process is slow.

A published solution is not available for this question yet.

Question 3 MSQ · 3.0 marks

Select all the correct statements.
  1. Mutexes use busy wait while trying to acquire the lock.
  2. Mutexes can be also implemented with spinlocks
  3. A blocking semaphore with S initialized to 1 is similar to a mutex.
  4. The Thundering herd problem of the mutexes can be solved using a queue.

A published solution is not available for this question yet.

Question 4 MSQ · 3.0 marks

Choose all the correct statements regarding compiling and linking multiple C source files using gcc
  1. The command gcc file1.c file2.c -o output produces an executable named output.
  2. The command gcc -c file1.c file2.c -o output produces an executable named output.
  3. The command gcc -c file1.c file2.c produces file1.o and file2.o.
  4. The command gcc file1.o file2.o -c -o output produces an executable named output.
  5. The command gcc file1.o file2.o -o output links the object files into an executable named output.

A published solution is not available for this question yet.

Question 5 MCQ · 3.0 marks

Two processes P1 and P2 are competing for two shared R1 and R2. • P1 holds R1 and waits for R2. • P2 holds R2 and waits for R1. Both processes wait indefinitely and none of them can proceed. Which of the following problem(s) is/are illustrated in the above scenario?
  1. Starvation
  2. Deadlock
  3. Mutual exclusion
  4. Busy waiting

A published solution is not available for this question yet.

Question 6 MCQ · 3.0 marks

Given the hexadecimal representation of the first few bytes of different files, identify the executable file (ELF file) from the options below. (Hint: The ASCII value of ’E’ = 69, ’L’ = 76, and ’F’ = 70)(Hint: ELF → 45 4C 46)
  1. 7F 41 42 43 01 01 01 00
  2. 7F 45 58 45 02 01 01 00
  3. 7F 50 4C 54 02 01 01 00
  4. 7F 45 4C 46 01 01 01 00

A published solution is not available for this question yet.

Question 7 MCQ · 3.0 marks

Consider the below structure of the [[IMAGE:8cecebef11039aac_4_4]] register in a RISC-V system and the table showing the values of different exception and interrupt codes (only a subset of the table is given). [[IMAGE:8cecebef11039aac_4_5]] The [[IMAGE:8cecebef11039aac_4_6]] register is **SXLEN bits wide**. The **MSB (most significant bit)** indicates: • [[IMAGE:8cecebef11039aac_4_7]] → Interrupt • [[IMAGE:8cecebef11039aac_4_8]] → Exception • The remaining bits store the corresponding exception/interrupt code. If the trap was caused by a **Supervisor timer interrupt**, what is the value of the [[IMAGE:8cecebef11039aac_4_9]] register (assuming SXLEN = 64)?
Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  1. 0x0000000000000005
  2. 0x0000000000000009
  3. 0x8000000000000005
  4. 0x8000000000000009

A published solution is not available for this question yet.

Question 8 MCQ · 2.0 marks

State True or False: In inter-process communication (IPC) using shared memory, the commonly used system calls are send and receive.
  1. True
  2. False

A published solution is not available for this question yet.

Question 9 MCQ · 2.0 marks

If the exec system call is invoked as exec("/analyze", "data.txt", "config.json", "log.txt", "result.out");, then what are the values of the argc and argv[3] respectively?
  1. 4, "config.json"
  2. 5, "data.txt"
  3. 5, "log.txt"
  4. 4, "result.out"

A published solution is not available for this question yet.

Question 10 MCQ · 2.0 marks

In the following code snippet, a child process is created to execute the ls -l /home command. Identify the **correct system call** that should be used at LINE-1. [[IMAGE:8cecebef11039aac_6_10]]
Source diagram or notation
  1. execlp
  2. execl
  3. execv
  4. execvp

A published solution is not available for this question yet.

Question 11 MCQ · 2.0 marks

Match the following [[IMAGE:8cecebef11039aac_6_11]]
Source diagram or notation
  1. a - 1, b - 2, c - 3
  2. a - 2, b - 1, c - 3
  3. a - 2, b - 3, c - 1
  4. a - 1, b - 3, c - 2

A published solution is not available for this question yet.

Question 12 MCQ · 2.0 marks

What is a major disadvantage of the First Come First Serve (FCFS) scheduling algorithm in operating systems?
  1. Starvation of process
  2. Convoy effect caused by long processes
  3. Requires knowledge of burst time in advance
  4. Frequent context switching

A published solution is not available for this question yet.

Question 13 MCQ · 2.0 marks

Which of the following statements correctly describes a key difference between the First-Come- First-Serve (FCFS) and Round Robin (RR) CPU scheduling algorithms?
  1. FCFS uses a fixed time quantum, while Round Robin does not.
  2. FCFS is non-preemptive, while Round Robin is preemptive.
  3. Round Robin always selects the process with the shortest burst time.
  4. Both FCFS and Round Robin are non-preemptive scheduling algorithms.

A published solution is not available for this question yet.

Question 14 MSQ · 4.0 marks

Assume that context switches can occur at any time during the execution of the following code snippet. The variable counter is shared between two programs. Which of the following can be the possible final values of counter? Initial value of counter = 200 [[IMAGE:8cecebef11039aac_7_12]]
Source diagram or notation
  1. 185
  2. 160
  3. 225
  4. 200
  5. 240
  6. 175

A published solution is not available for this question yet.

Question 15 NAT · 4.0 marks

Consider the following code snippet from Bakery Algorithm. [[IMAGE:8cecebef11039aac_8_13]] Considering that there are 5 processes, and initially num[0]=3, num[1]=0, num[2]=5,num[3]=2, num[4]=4, If Process 3 (num[2]) starts executing its critical section and then unlocks, what will be the new value of num[2] after P3 finishes execution? Note: Enter your answer in decimal.
Source diagram or notation

    A published solution is not available for this question yet.

    Question 16 NAT · 4.0 marks

    Consider a set of 5 processes with the following arrival and burst times. [[IMAGE:8cecebef11039aac_9_14]] If the CPU scheduling policy used is **Round Robin** with a time quantum of **3 units**, what will be the **average response time**? Note: Enter your answer in decimal.
    Source diagram or notation

      A published solution is not available for this question yet.

      Question 17 NAT · 4.0 marks

      Consider a system with four processes, P1, P2, P3, and P4, arriving at different times and requiring the following CPU burst times to complete. [[IMAGE:8cecebef11039aac_9_15]] Assuming that the system employs the **First-Come-First-Served (FCFS)** scheduling algorithm, what will be the **average waiting time**? Note: Enter your answer in decimal.
      Source diagram or notation

        A published solution is not available for this question yet.

        Question 18 NAT · 4.0 marks

        Consider a system with four processes, P1, P2, P3, and P4, arriving at different times and requiring the following CPU burst times: [[IMAGE:8cecebef11039aac_10_16]] Assuming that the system employs the **Shortest Job First (SJF)** scheduling algorithm, calculate the **average response time**. Note: Enter your answer in decimal.
        Source diagram or notation

          A published solution is not available for this question yet.