ABHYAS PREP: COMPUTER SCIENCE MCQS · OPERATING SYSTEM CONCEPTS

Operating System Concepts

Processes, scheduling, deadlocks, memory and paging.

Loading practice…

Worked examples

Example 1 · level 1

Two threads belonging to the same process in a Linux-based system will share which of the following?

  1. Address space and open files
  2. Stack and program counter
  3. Register set and local variables
  4. Each thread has its own heap
Show solution
  1. Identify that threads are lightweight units of a process.
  2. Recall that shared resources include code, data, and OS resources.
  3. Recall that private resources include stack and registers.

Answer: Address space and open files

Example 2 · level 2

A system uses 32-bit logical addresses and a page size of 4 KB. How many entries are required in a single-level page table?

  1. 2^20
  2. 2^12
  3. 2^32
  4. 2^16
Show solution
  1. Calculate page offset bits: 4 KB = 2^12 bytes, so offset = 12 bits.
  2. Calculate page number bits: Total bits - offset bits = 32 - 12 = 20 bits.
  3. Number of entries = 2^(number of page bits) = 2^20.

Answer: 2^20

Example 3 · level 3

Which statement correctly differentiates a binary semaphore from a mutex?

  1. A mutex has ownership; only the thread that locked it can unlock it, while a binary semaphore has no ownership.
  2. A binary semaphore can be used for signaling between threads, but a mutex cannot.
  3. A mutex can have a count greater than 1, whereas a binary semaphore is limited to 0 or 1.
  4. Both provide the same semantics; the terms are interchangeable.
Show solution
  1. Remember mutex = mutual exclusion with owner thread.
  2. Binary semaphore = signaling primitive without owner.
  3. Select the option that mentions ownership.

Answer: A mutex has ownership; only the thread that locked it can unlock it, while a binary semaphore has no ownership.

Search by task, format or tool name.