uiz Space

May 2024 term · Operating Systems · BSCS4022

Operating Systems End Term: 1 September 2024 (May 2024 term)

The IIT Madras BS Operating Systems (Operating Systems) End Term paper sat on 1 Sept 2024, in the May 2024 term: 20 questions for 50 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
20
Marks
50
Duration
180 min
MCQ
13
MSQ
2
Numerical
5

Updated

Official paper: IIT M DEGREE FN EXAM QDB1 01 Sep 2024 · No negative marking.

Question 1

+2 marksOne correct option

Consider the code segment (for xv6) given below.

c
1 #define UART_BASE 0xB0005000
2 void init_uart(){
3 u16 *baud_reg = (u16*)UART_BASE;
4 *baud_reg = 0x7D;
5 }
6 u32 read_uart(){
7 u32 *rx_reg = (u32*)(UART_BASE + 8);
8 u8 *status_reg = (u8*)(UART_BASE + 12);
9 while((*status_reg & 0x4) == 0);
10 return *rx_reg;
11 }

What are the base address and the end address of the RX register?

  1. A

    The base address is 0xB0005008, and end address is 0xB000500C.

  2. B

    The base address is 0xB0005008, and end address is 0xB000500B.

  3. C

    The base address is 0xB0005008, and end address is 0xB0005012.

  4. D

    The base address is 0xB0005000, and end address is 0xB0005004.

Show answer

Correct answer

  • B

    The base address is 0xB0005008, and end address is 0xB000500B.

Question 2

+2 marksOne correct option

If the memory map of the DMA controller starts from the offset 0x30001000 and has an address range of 256 bytes in a 32-bit addressing scheme, what will be the final address in the memory map?

  1. A

    0x30001100

  2. B

    0x300012FF

  3. C

    0x300010FF

  4. D

    0x30001300

Show answer

Correct answer

  • C

    0x300010FF

Question 3

+2 marksOne correct option

Consider the following program snippet:

c
1 void exampleFunction(int x, int y)
2 {
3 char smallBuffer[4];
4 char largeBuffer[8];
5 }
6 void main
7 {
8 exampleFunction(1, 2);
9 }

When largeBuffer[8] = smallBuffer[0] occurs, the situation is known as ___.

  1. A

    Heap overflow

  2. B

    Buffer overflow

  3. C

    Frame overflow

  4. D

    Stack overflow

Show answer

Correct answer

  • B

    Buffer overflow

Question 4

+2 marksOne correct option

In a cryptographic implementation where memory access patterns depend on the value of a secret key, which type of attack is likely to exploit this vulnerability?

  1. A

    Differential Power Analysis (DPA)

  2. B

    Cache Timing Attack

  3. C

    Frequency Analysis

  4. D

    Brute Force Attack

Show answer

Correct answer

  • B

    Cache Timing Attack

Question 5

+1 markOne correct option
  1. A

    True

  2. B

    False

Show answer

Correct answer

  • A

    True

Question 6

+1 markOne correct option

When a process invokes the exec system call, the Process Identifier (PID) remains unchanged.

  1. A

    True

  2. B

    False

Show answer

Correct answer

  • A

    True

Question 7

+1 markOne correct option

State True/false

Bob can execute the Program 1.

  1. A

    True

  2. B

    False

Show answer

Correct answer

  • B

    False

Question 8

+3 marksOne correct option

Consider a system with 128 MB of physical memory and a 32-bit virtual address space. Given a page size of 8 KB, what will be the number of frames?

  1. A

    2¹⁷ frames

  2. B

    2¹⁵ frames

  3. C

    2¹⁴ frames

  4. D

    2¹³ frames

Show answer

Correct answer

  • C

    2¹⁴ frames

Question 9

+3 marksOne correct option

In the Xv6 OS, What is the correct sequence of tasks as listed below that takes place as part of timer interrupt?
(i) Supervisor mode executes
(ii) CPU goes to machine mode
(iii) Timer interrupt occurs
(iv) The function in machine mode triggers the supervisor mode software interrupt
(v) Context switch occurs

  1. A

    (i) → (ii) → (iii) → (iv) → (v)

  2. B

    (iii) → (ii) → (iv) → (i) → (v)

  3. C

    (iii) → (i) → (ii) → (iv) → (v)

  4. D

    (iii) → (i) → (iv) → (ii) → (v)

Show answer

Correct answer

  • B

    (iii) → (ii) → (iv) → (i) → (v)

Question 10

+3 marksOne correct option

Consider a system with three processes (P1, P2, and P3) and three resources (R1, R2 and R3). The following Resource Allocation Graph (RAG) represents the current state of resource allocation:

Based on the given Resource Allocation Graph (RAG), is there a deadlock situation present in the system?

  1. A

    Yes, involving P1, P2 and P3.

  2. B

    No, there is no deadlock situation.

  3. C

    Yes, involving P1 and P3.

  4. D

    Yes, involving P1 and P2.

Show answer

Correct answer

  • C

    Yes, involving P1 and P3.

Question 11

+3 marksOne correct option

Consider that the below commands are executed in a shell with root ("/") as the current directory.

bash
mkdir app
cd app
mkdir bin lib config
cd bin
echo hello > app.sh
cd ..
cd lib
echo hello > lib.so
cd ..
cd config
echo hello > settings.conf

What is the absolute path of the file lib.so?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 12

+4 marksOne correct option

Consider the following functions that are used in the implementation of the Bakery algorithm:

c
1 lock(i) {
2 num[i] = MAX(num[0], num[1], ..., num[N-1]) + 1;
3 for (p = 0; p < N; ++p) {
4 while (num[p] != 0 && num[p] < num[i]);
5 }
6 }
7
8 unlock(i) {
9 num[i] = 0;
10 }

The function lock is called before entering the critical section and the unlock is called when the process comes out of the critical section. The value i will be the process number for each process.

Considering there are 4 processes, and initially num[0]=0, num[1]=2, num[2]=4, num[3]=1, select the order in which the above processes enter into the critical section

  1. A

    P0, P3, P1, P2

  2. B

    P0, P2, P1, P3

  3. C

    P2, P3, P1, P0

  4. D

    P0, P1, P3, P2

Show answer

Correct answer

  • A

    P0, P3, P1, P2

Question 13

+4 marksOne correct option

Consider the below plots representing the order in which the requests are serviced by different disk scheduling algorithms.

Match the plots with the corresponding disk scheduling algorithm.

  1. A

    (1) - SCAN, (2) - C-SCAN, (3) - C-LOOK, (4) - FCFS

  2. B

    (1) - SCAN, (2) - FCFS, (3) - C-SCAN, (4) - C-LOOK

  3. C

    (1) - FCFS, (2) - C-SCAN, (3) - SCAN, (4) - C-LOOK

  4. D

    (1) - SCAN, (2) - FCFS, (3) - C-LOOK, (4) - C-SCAN

Show answer

Correct answer

  • D

    (1) - SCAN, (2) - FCFS, (3) - C-LOOK, (4) - C-SCAN

Question 14

+2 marksOne or more correct options

Select all the true statements about hard links.

Select all that apply.

  1. A

    Hard links cannot link directories.

  2. B

    Hard links are destroyed if the source file is moved or removed.

  3. C

    Hard links cannot span across different file systems.

  4. D

    Hard links are symbolic links to the path of the file.

Show answer

Correct answers

  • A

    Hard links cannot link directories.

  • C

    Hard links cannot span across different file systems.

Question 15

+3 marksOne or more correct options

Assume Process A is currently running, Process B and Process D are waiting for an I/O operation, and Process C was running before Process A and is now waiting for its turn. Select all the correct statements about the states of the processes.

Select all that apply.

  1. A

    Process A is in the WAITING state.

  2. B

    Process B is in the SLEEPING state.

  3. C

    Process C is in the RUNNABLE state.

  4. D

    Process A is in the RUNNING state.

  5. E

    Process D is in the RUNNING state.

Show answer

Correct answers

  • B

    Process B is in the SLEEPING state.

  • C

    Process C is in the RUNNABLE state.

  • D

    Process A is in the RUNNING state.

Question 16

+3 marksNumerical answer

Consider the set of 5 processes whose arrival time and burst time are given below.

If the CPU scheduling policy used is Round Robin with a time quantum of 3 units, what will be the average response time?

Show answer

Correct answer: 4

Question 17

+3 marksNumerical answer

Consider a system with four processes, P1, P2, P3, and P4, arriving at different times and needing the following CPU bursts to complete:

Assuming that the system employs the First-Come-First-Served (FCFS) scheduling algorithm, what is the average waiting time?
Note: Write up to two decimal place

Show answer

Correct answer: 5.25

Question 18

+3 marksNumerical answer

Consider a system with four processes, P1, P2, P3, and P4, arriving at different times and needing the following CPU bursts to complete:

Assuming that the system employs the Shortest Job First (SJF) scheduling algorithm, what will be the average response time?
Note: Write up to two decimal place

Show answer

Correct answer: 5.50

Question 19

+3 marksNumerical answer
Show answer

Correct answer: 45

Question 20

+2 marksNumerical answer

For a scenario with 7 philosophers in the dining philosopher’s problem, what is the minimum number of forks necessary to ensure deadlock prevention?

Show answer

Correct answer: 8