uiz Space

September 2025 term · Operating Systems · BSCS4022

Operating Systems Quiz 1: 26 October 2025 (September 2025 term)

The IIT Madras BS Operating Systems (Operating Systems) Quiz 1 paper sat on 26 Oct 2025, in the September 2025 term: 18 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
18
Marks
50
Duration
120 min
MCQ
16
MSQ
2

Updated

Official paper: IIT M IMPROVEMENT AN EXAM QIB2 26 Oct 2025 · No negative marking.

Question 1

+1 markOne correct option
  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 2

+2 marksOne correct option

In RISC-V, during system calls, which register stores the current mode of operation of the processor?

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

Correct answer

  • C

Question 3

+2 marksOne correct option
  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 4

+2 marksOne correct option

In the xv6 operating system, suppose a process is running and a timer interrupt occurs. What will be the transition for the process state?

  1. A

    Running → Sleeping

  2. B

    Running → Runnable

  3. C

    Running → Unused

  4. D

    State remain unchanged

Show answer

Correct answer

  • B

    Running → Runnable

Question 5

+2 marksOne correct option

In the xv6 operating system, when a process calls exit(), what will be the state transition of the process?

  1. A

    Running → Sleeping

  2. B

    Runnable → Unused

  3. C

    Running → Zombie

  4. D

    Sleeping → Runnable

Show answer

Correct answer

  • C

    Running → Zombie

Question 6

+2 marksOne correct option

Which of the following sequences of functions determines the steps for the execution of the first process initcode in the xv6 operating system?

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

Correct answer

  • D

Question 7

+3 marksOne correct option

If the memory map for a device starts from the offset 0x20001000 and has a size of 2048 bytes in a 32-bit addressing scheme, what will be the last address in the memory map?

  1. A

    0x200017FF

  2. B

    0x20001800

  3. C

    0x200016FF

  4. D

    0x20000FFF

Show answer

Correct answer

  • A

    0x200017FF

Question 8

+3 marksOne correct option

Consider the following code snippet:

c
#define GPIO_PORTA_BASE 0x50000000
void write_gpio(){
uint16_t *data_reg = (uint16_t*)(GPIO_PORTA_BASE + 0x10);
uint32_t *dir_reg = (uint32_t*)(GPIO_PORTA_BASE + 0x14);
*dir_reg = 0xFF; // Configure lower 8 pins as output
*data_reg = 0xAA55; // Write pattern to port
}

What are the access sizes of the data_reg and dir_reg registers, respectively?

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

Correct answer

  • C

Question 9

+3 marksOne correct option

What will be the output behavior of the following xv6 code snippet?

c
int pid;
pid = fork();
if (pid == 0) {
printf(1, "Child process\n");
exit(0);
} else if (pid > 0) {
printf(1, "Parent process\n");
wait(0);
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 10

+3 marksOne correct option
  1. A

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

  2. B

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

  3. C

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

  4. D

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

Show answer

Correct answer

  • A

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

Question 11

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

Correct answer

  • C

Question 12

+3 marksOne correct option

Consider the following code snippet for the syscall function in kernel/syscall.c (RISC-V xv6):

c
void
syscall(void)
{
int syscall_num;
struct proc *p = myproc();
syscall_num = p->trapframe->a7; // system call number
if(syscall_num > 0 && syscall_num < MAX_SYSCALLS && syscalls[syscall_num]) {
p->trapframe->a0 = syscalls[syscall_num]();
} else {
printf("PID %d (%s): Invalid syscall %d\n",
p->pid, p->name, syscall_num);
p->trapframe->a0 = -1;
}
}

What does the a7 register in the trapframe represent in this code?

  1. A

    The base address of the process stack.

  2. B

    The return value of the system call.

  3. C

    The number of arguments passed to the system call.

  4. D

    The number identifying the requested system call.

Show answer

Correct answer

  • D

    The number identifying the requested system call.

Question 13

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

Correct answer

  • C

Question 14

+4 marksOne correct option
  1. A

    2 KB

  2. B

    4 KB

  3. C

    8 KB

  4. D

    16 KB

Show answer

Correct answer

  • B

    4 KB

Question 15

+4 marksOne correct option

Consider a system with 64 MB of physical memory and a 32-bit virtual address space. Given a page size of 16 KB, what will be the maximum number of page frames that can be present in RAM?

  1. A

    2¹⁰ frames

  2. B

    2¹¹ frames

  3. C

    2¹³ frames

  4. D

    2¹² frames

Show answer

Correct answer

  • D

    2¹² frames

Question 16

+4 marksOne correct option

What could be the possible output of the following program?

c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
int x = 5, pid;
pid = fork();
if (pid == 0) {
x += 3;
printf("Child 1: %d\n", x);
} else {
x += 7;
printf("Parent 1: %d\n", x);
pid = fork();
if (pid == 0) {
x += 10;
printf("Child 2: %d\n", x);
} else {
x += 15;
printf("Parent 2: %d\n", x);
}
}
return 0;
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 17

+3 marksOne or more correct options

Which of the following actions are performed by userinit in xv6?

The source code of userinit is given below for reference.

c
void userinit(void)
{
struct proc *p;
p = allocproc();
initproc = p;
// allocate one user page and copy initcode's instructions
// and data into it.
uvmfirst(p->pagetable, initcode, sizeof(initcode));
p->sz = PGSIZE;
// prepare for the very first "return" from kernel to user.
p->trapframe->epc = 0; // user program counter
p->trapframe->sp = PGSIZE; // user stack pointer
safestrcpy(p->name, "initcode", sizeof(p->name));
p->cwd = namei("/");
p->state = RUNNABLE;
release(&p->lock);
}

Select all that apply.

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

Correct answers

  • B
  • E

Question 18

+3 marksOne or more correct options

Consider the following processes in an xv6-like operating system:

  • Process Q1 has been created but has not yet been scheduled to run.
  • Process Q2 is currently executing instructions on the CPU.
  • Process Q3 is waiting for a child process to finish execution.
  • Process Q4 has terminated, but its parent process has already collected its exit status.

Select all the correct statements about the states of the processes.

Select all that apply.

  1. A

    Process Q1 is in the RUNNABLE state.

  2. B

    Process Q2 is in the RUNNING state.

  3. C

    Process Q3 is in the RUNNABLE state.

  4. D

    Process Q3 is in the SLEEPING state.

  5. E

    Process Q4 is in the ZOMBIE state.

  6. F

    Process Q4 is in the SLEEPING state.

Show answer

Correct answers

  • A

    Process Q1 is in the RUNNABLE state.

  • B

    Process Q2 is in the RUNNING state.

  • D

    Process Q3 is in the SLEEPING state.