uiz Space

September 2025 term · Operating Systems · BSCS4022

Operating Systems Quiz 2: 23 November 2025 (September 2025 term)

The IIT Madras BS Operating Systems (Operating Systems) Quiz 2 paper sat on 23 Nov 2025, in the September 2025 term: 17 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
17
Marks
50
Duration
120 min
MCQ
10
MSQ
3
Numerical
4

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 23 Nov 2025 NEW · No negative marking.

Question 1

+4 marksOne correct option

Consider the following scenario where two processes are sharing a common variable.

Global setup

c
int turn = 1;

Process 1

c
while(1) {
while(turn == 2); // lock
// critical section
turn = 2; // unlock
// remainder section
}

Process 2

c
while(1) {
while(turn == 1); // lock
// critical section
turn = 1; // unlock
// remainder section
}

Which of the following statements about the given processes is correct?

  1. A

    Process 1 and Process 2 will enter their critical sections simultaneously, leading to race conditions.

  2. B

    Process 1 will always enter its critical section before Process 2.

  3. C

    Process 2 will always enter its critical section before Process 1.

  4. D

    Deadlock can occur if both processes try to enter their critical sections simultaneously.

Show answer

Correct answer

  • B

    Process 1 will always enter its critical section before Process 2.

Question 2

+3 marksOne correct option
  1. A

    Mutual exclusion

  2. B

    Progress

  3. C

    Bounded waiting

  4. D

    None of these

Show answer

Correct answer

  • B

    Progress

Question 3

+3 marksOne correct option
  1. A

    7F 42 43 44 02 01 01 00

  2. B

    7F 45 4D 50 02 01 01 00

  3. C

    7F 45 4C 46 02 01 01 00

  4. D

    7F 50 51 52 02 01 01 00

Show answer

Correct answer

  • C

    7F 45 4C 46 02 01 01 00

Question 4

+3 marksOne correct option
  1. A

    0x800000000000000F

  2. B

    0x000000000000000D

  3. C

    0x000000000000000F

  4. D

    0x8000000000000005

Show answer

Correct answer

  • B

    0x000000000000000D

Question 5

+1 markOne correct option

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

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 6

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 7

+2 marksOne correct option

Identify the correct system call that should be used at LINE-1 to execute the grep command in the following code:

c
int pid;
pid = fork();
if (pid > 0) {
wait(NULL);
}
______("grep", "pattern", "file.txt", NULL); // LINE-1
exit(0);
  1. A

    execl

  2. B

    execvp

  3. C

    execlp

  4. D

    exec

Show answer

Correct answer

  • C

    execlp

Question 8

+2 marksOne correct option
  1. A

    a - 1, b - 2, c - 3

  2. B

    a - 2, b - 1, c - 3

  3. C

    a - 2, b - 3, c - 1

  4. D

    a - 1, b - 3, c - 2

Show answer

Correct answer

  • D

    a - 1, b - 3, c - 2

Question 9

+2 marksOne correct option

What is a disadvantage associated with the Shortest Job First (SJF) scheduling algorithm in operating systems?

  1. A

    Inefficiency for short jobs

  2. B

    Starvation

  3. C

    Lack of flexibility

  4. D

    None of these

Show answer

Correct answer

  • B

    Starvation

Question 10

+2 marksOne correct option

In the context of response time, which of the following statements is correct for the First-Come- First-Serve (FCFS) and Round Robin scheduling algorithms?

  1. A

    Round Robin provides the same or a lower response time compared to FCFS.

  2. B

    FCFS provides a lower response time compared to Round Robin.

  3. C

    Both FCFS and Round Robin give the same response time to each process.

  4. D

    None of these

Show answer

Correct answer

  • A

    Round Robin provides the same or a lower response time compared to FCFS.

Question 11

+3 marksOne or more correct options

Select all the correct statements

Select all that apply.

  1. A

    Mutexes use busy wait while trying to acquire the lock.

  2. B

    Mutexes can be also implemented with spinlocks

  3. C

    A blocking semaphore with S initialized to 1 is similar to a mutex.

  4. D

    The Thundering herd problem of the mutexes can be solved using a queue.

Show answer

Correct answers

  • C

    A blocking semaphore with S initialized to 1 is similar to a mutex.

  • D

    The Thundering herd problem of the mutexes can be solved using a queue.

Question 12

+3 marksOne or more correct options

Choose all the correct statements regarding compiling and linking multiple C source files using gcc.

Select all that apply.

  1. A

    The command gcc file1.c file2.c -o output produces an executable named output.

  2. B

    The command gcc -c file1.c file2.c -o output produces an executable named output.

  3. C

    The command gcc -c file1.c file2.c produces file1.o and file2.o.

  4. D

    The command gcc file1.o file2.o -c -o output produces an executable named output.

  5. E

    The command gcc file1.o file2.o -o output links the object files into an executable named output.

Show answer

Correct answers

  • A

    The command gcc file1.c file2.c -o output produces an executable named output.

  • C

    The command gcc -c file1.c file2.c produces file1.o and file2.o.

  • E

    The command gcc file1.o file2.o -o output links the object files into an executable named output.

Question 13

+4 marksOne or more correct options

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 =100=100

python
# Program A
R1 = counter
R1 = R1 + 10
counter = R1
# Program B
R2 = counter
R2 = R2 - 30
counter = R2

Select all that apply.

  1. A

    70

  2. B

    80

  3. C

    90

  4. D

    100

  5. E

    110

  6. F

    120

Show answer

Correct answers

  • A

    70

  • B

    80

  • E

    110

Question 14

+4 marksNumerical answer

Consider the following code snippet from Bakery Algorithm.

c
lock(i) {
num[i] = MAX(num[0], num[1], ..., num[N-1]) + 1;
for (p = 0; p < N; ++p) {
while (num[p] != 0 && num[p] < num[i]);
}
}

critical section

c
unlock(i) {
num[i] = 0;
}

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 4 (num[3]) starts executing its critical section and then unlocks, what will be the new value of num[3] after P4 finishes execution?

Show answer

Correct answer: 0

Question 15

+4 marksNumerical answer
Show answer

Correct answer: 8

Question 16

+4 marksNumerical answer
Show answer

Correct answer: 8 (accepted within ±1)

Question 17

+4 marksNumerical answer
Show answer

Correct answer: 1.5 (accepted within ±0.5)