Sample questions
Question 1Easy
A process has a 32-bit virtual address space and the page size is 4 KB. How many virtual pages can it have?
- 2^32
- 2^22
- 2^20
- 2^12
Answer: C. 2^20
Explanation
2^32 bytes / 2^12 bytes per page
= 2^20 pages (about one million).
Step-by-step solution
- A 32-bit address space has 2^32 bytes.
- A 4 KB page is 2^12 bytes.
- Pages = 2^32 ÷ 2^12 = 2^(32 − 12) = 2^20. Marked answer: 2^20.
Why the other options are wrong
- A. 2^32 counts bytes, not pages.
- B. 2^22 would need 1 KB pages, not 4 KB pages.
- D. 2^12 is the page size in bytes, not the number of pages.
Tip: Number of pages = address space ÷ page size; when the bases match, subtract the exponents.
Question 2Easy
- Disks to work faster than RAM by caching every page access in the TLB
- A process to run even if it is larger than physical memory
- Programs to be stored on disk without using a file system
- Memory to be accessed without addresses
Answer: B. A process to run even if it is larger than physical memory
Explanation
Only the parts of a program in use need to be in RAM; the rest stays on backing store.
Step-by-step solution
- Virtual memory gives a process a large logical address space.
- Only the pages in use need to be in RAM at any time.
- So a process can run even when it is bigger than physical memory. Marked answer: option B.
Why the other options are wrong
- A. Virtual memory does not make disks faster than RAM; the TLB caches address translations, not pages.
- C. Files on disk still need a file system.
- D. Programs still use addresses; virtual memory adds a mapping, it does not remove addresses.
Tip: Virtual memory lets a program run with more address space than the RAM it has.
Question 3Easy
What determines the maximum size of a process's virtual address space?
- The amount of installed RAM
- The number of running processes
- The number of bits in a virtual address
- The size of the TLB
Answer: C. The number of bits in a virtual address
Explanation
- An n-bit virtual address can name 2^n bytes,
- regardless of how much physical memory is installed.
Step-by-step solution
- An n-bit virtual address can name 2^n unique addresses.
- Each address represents a byte in the virtual address space.
- The total size is therefore 2^n bytes.
- This depends only on the number of bits in the virtual address.
- The maximum size is determined by the number of bits in a virtual address.
Why the other options are wrong
- A. Installed RAM limits physical memory, not the size of the virtual address space.
- B. The number of processes does not set the virtual address space size of one process.
- D. The TLB is a cache for address translations; its size does not set the address space limit.
Question 4Easy
A memory-mapped file lets a process:
- Run a file as a separate process with its own address space
- Access file contents through ordinary memory reads and writes
- Store files in the CPU cache
- Avoid using virtual memory
Answer: B. Access file contents through ordinary memory reads and writes
Explanation
The file is mapped into the virtual address space; pages are brought in by demand paging when accessed.
Step-by-step solution
- Memory-mapped files treat a file as if it were in memory.
- The process can read and write to the file like regular memory.
- This allows accessing file contents through ordinary memory reads and writes.
- Other options are incorrect based on how memory-mapping works.
Why the other options are wrong
- A. A memory-mapped file is not run as a separate process; it is file data mapped into the address space.
- C. Files are not stored in the CPU cache; the mapping gives memory access to file pages on disk.
- D. Memory-mapped files rely on virtual memory, so they do not avoid it.
Tip: Think of a file as part of your program's memory when using memory mapping.
Question 5Medium
Put these page-fault handling steps in the right order:
1. restart the instruction,
2. find a free frame,
3. trap to the OS,
4. read the page from disk and update the page table.
- 3, 4, 2, 1
- 3, 2, 4, 1
- 1, 3, 2, 4
- 2, 3, 4, 1
Answer: B. 3, 2, 4, 1
Explanation
The trap comes first, then a frame is found (possibly by replacement), the page is read in and the table updated, and finally the faulting instruction is restarted.
Step-by-step solution
- The instruction touches a missing page, so the CPU traps to the OS (step 3).
- The OS finds a free frame (step 2).
- It reads the page from disk and updates the page table (step 4).
- The faulting instruction is restarted (step 1). Marked order: 3, 2, 4, 1.
Why the other options are wrong
- A. Finding a free frame (2) must come before reading the page (4), and restart (1) comes last.
- C. The trap to the OS must come first, and restart must come last, not first.
- D. The trap must come before finding a frame; step 2 cannot be first.
Tip: Page fault order: trap, get a frame, load the page and update the table, then restart the instruction.
Question 6Medium
Pure demand paging means:
- Every page is loaded before the process starts
- Pages are never written back
- A process starts with no pages in memory
- The OS uses only segmentation
Answer: C. A process starts with no pages in memory
Explanation
With pure demand paging even the first instruction causes a fault; nothing is loaded until it is referenced.
Step-by-step solution
- Pure demand paging loads a page only when it is referenced.
- So the process starts with zero pages in memory.
Why the other options are wrong
- A. That is loading everything up front.
- B. Write-back is a separate policy.
- D. Segmentation is a different scheme.
Question 7Medium
Prepaging tries to reduce:
- The large number of page faults when a process starts or resumes
- The number of frames in memory
- The amount of internal fragmentation in the last page of a process
- Internal fragmentation
Answer: A. The large number of page faults when a process starts or resumes
Explanation
Prepaging brings in pages expected to be needed (e.g. the saved working set) at once instead of faulting them in one by one.
Step-by-step solution
- Demand paging causes many faults at start or resume.
- Prepaging loads the expected pages in advance.
- This cuts those initial faults.
Why the other options are wrong
- B. It does not reduce frame count.
- C. Internal fragmentation depends on page size, not prepaging.
- D. Internal fragmentation is unrelated.
Question 8Medium
For the reference string 1, 2, 1, 3, 4, 4, 3, 2, 5, 5, 6, 1, 6, what is the working-set size after the last reference with window size 4?
- 3
- 2
- 4
- 6
Answer: A. 3
Explanation
The last 4 references are 5, 6, 1, 6, which contain the distinct pages {1, 5, 6}, so the size is 3.
Step-by-step solution
- Window size 4 means the working set is the distinct pages in the last 4 references.
- The last 4 references, positions 10 to 13, are 5, 6, 1, 6.
- Distinct pages in that window: 5, 6, 1, so the size is 3, which is option A.
Why the other options are wrong
- B. 2 is too few; 5, 6 and 1 are all different pages in the window.
- C. 4 counts the repeated 6 as a separate page; the window has only 3 distinct pages.
- D. 6 is not the window's count; a window of 4 references holds at most 4 distinct pages.
Tip: Working-set size = number of distinct pages in the last w references, not the number of references.
Question 9Hard
If the total working-set size of all processes D exceeds the number of available frames m, what does the working-set strategy do?
- Suspends a process and frees its frames
- Increases the window size
- Switches every process to FIFO replacement
- Admits another process
Answer: A. Suspends a process and frees its frames
Explanation
D > m means thrashing will occur, so the OS swaps out (suspends) a process; if D is well below m it can start another.
Step-by-step solution
- Total working-set size D exceeds frames m, causing thrashing.
- OS suspends a process to free up frames.
- Suspended process is swapped out of memory.
- Frames are freed for other processes.
- This prevents excessive page faults and improves performance.
Why the other options are wrong
- B. Increasing the window size does not free frames; the strategy suspends a process when demand exceeds the frames.
- C. FIFO does not fix the overload; the working-set strategy responds by suspending a process.
- D. Admitting another process adds more demand and makes the overload worse, so the strategy does not do this.
Tip: If D > m, suspend a process to free frames and avoid thrashing.
Question 10Hard
Memory access time is 100 ns and servicing a page fault takes 5 ms. If the page-fault rate is 0.0002, what is the effective access time?
- 1099.98 ns
- 100.98 ns
- 1000 ns
- 2100 ns
Answer: A. 1099.98 ns
Explanation
EAT = (1 - p) x 100 + p x 5 ms
= (1 - 0.0002) x 100 + 0.0002 x 5000000 ns
= 1099.98 ns.
Step-by-step solution
- EAT = (1 − p) × 100 + p × 5,000,000 ns, where p = 0.0002 and 5 ms = 5,000,000 ns.
- Normal part: 0.9998 × 100 = 99.98 ns.
- Fault part: 0.0002 × 5,000,000 = 1000 ns.
- Total = 99.98 + 1000 = 1099.98 ns, which is option A.
Why the other options are wrong
- B. 100.98 ns adds the wrong fault part; the fault part is 1000 ns.
- C. 1000 ns is only the fault part; the 99.98 ns normal access must be added.
- D. 2100 ns uses the wrong fault part; 0.0002 × 5,000,000 is 1000 ns.
Tip: Multiply the fault rate by the fault time in ns; the normal part is almost the full access time.
Practise all 28 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →