Quiz Space

Operating Systems · End Term · 10 May 2026 · January 2026 term · Set 1-2

Question 13: Consider the following code snippet. Which of the follow…

Question 13

+2 marksOne correct option

Consider the following code snippet.

Which of the following statements is correct?

  1. A

    The program creates two threads, each printing OS Lab 40 times, and Complete is printed only after both threads finish.

  2. B

    The program creates two threads, but Complete may appear before some thread outputs.

  3. C

    The program prints OS Lab exactly 40 times in total and then prints Complete.

  4. D

    The program executes the two threads sequentially because pthread_create() blocks.

Show answer

Correct answer

  • A

    The program creates two threads, each printing OS Lab 40 times, and Complete is printed only after both threads finish.

Question 13 of 20 in the IIT Madras BS Operating Systems (Operating Systems) End Term paper sat on 10 May 2026, in the January 2026 term (OS 10 May 26). It carries 2 marks.

More questions from this paper

  1. Q1Consider that the following commands are executed in a shell with root (/) as the current directory. What is the absolu…
  2. Q2Consider the following resource-allocation situation.\ Process P1 holds resource R1 and waits for R2. • Process P2 hold…
  3. Q3If the memory map for a device starts at address 0x50002000 and has a size of 4096 bytes, what is the last valid addres…
  4. Q4Consider the following program. Assume execlp succeeds. Which output order is guaranteed?
  5. Q5Consider the following processes in an xv6-like operating system.\ Process P1 is waiting in the ready queue. • Process …
  6. Q6Consider the following solution for the critical section problem using a shared variable turn. Initial value: turn = 1 …
  7. Q7Assume that context switches can occur at any time during execution. The variable counter is shared between two concurr…
  8. Q8Choose all correct statements regarding compiling and linking multiple C source files using gcc.
  9. Q9A system has 128 MiB of physical memory and uses a page size of 4 KiB. How many page frames are present in RAM? Assume …
  10. Q10Consider the following processes, all arriving at time 0 and entering the ready queue in the order shown below. If the …
  11. Q11Consider the code segment (for xv6) given below. What are the base address and the end address of data_reg?
  12. Q12When a shell executes a command and then waits for it to finish before printing the next prompt, which sequence of syst…
  13. Q14In xv6 on RISC-V, which register contains the system call number when the user process traps into the kernel?
  14. Q15Given the hexadecimal representation of the first few bytes of different files, identify the executable ELF file.
  15. Q16In a 64-bit RISC-V system, the scause register stores trap information. What will be the value of scause for an Environ…
  16. Q17Consider the following processes scheduled using FCFS. What is the average waiting time?
  17. Q18A system uses a 32-bit virtual address space with a page size of 8 KiB and a single-level page table. How many entries …
  18. Q19Consider the following processes scheduled using non-preemptive SJF. What is the average response time?
  19. Q20Consider the below plots representing the order in which the requests are serviced by different disk scheduling algorit…