Virtual Memory — Operating System
Q1.
A process has 64 KB logical address space, page size = 4 KB. Number of pages = ?
A) 12
B) 14
C) 16
D) 18
Answer: C
Solution:
Number of pages = Logical Address Space / Page Size = 64 KB / 4 KB = 16 pages.
Q2.
Which is main advantage of virtual memory?
A) Allows larger address space than physical memory
B) Prevents internal fragmentation
C) Eliminates page faults
D) Reduces CPU utilization
Answer: A
Solution:
Virtual memory → process can use logical addresses larger than physical memory.
Q3.
Demand paging reduces:
A) CPU utilization
B) Memory usage
C) Disk utilization
D) TLB hit ratio
Answer: B
Solution:
Only needed pages loaded → less memory usage.
Q4.
Page table stores:
A) Page → frame mapping
B) Segment base
C) TLB entries
D) Disk address
Answer: A
Solution:
Page table → maps logical page number → physical frame number.
Q5.
Virtual address = 32 bits, page size = 8 KB. Number of offset bits = ?
A) 12
B) 13
C) 14
D) 15
Answer: B
Solution:
Page size = 8 KB = 2¹³ → offset bits = 13.
Q6.
Page fault occurs when:
A) Page in memory
B) Page absent
C) TLB hit
D) Segment exceeds limit
Answer: B
Solution:
Page fault → required page is not in physical memory.
Q7.
Effective memory access time (EMAT) with TLB hit ratio α = 0.8, memory = 100 ns, TLB = 10 ns → EMAT = ?
A) 130 ns
B) 110 ns
C) 90 ns
D) 100 ns
Answer: A
Solution:
EMAT = α(TLB+Memory) + (1−α)(TLB + 2Memory) = 0.8(10+100) + 0.2*(10+200) = 88 + 42 = 130 ns.
Q8.
Which replacement algorithm may suffer from Belady’s anomaly?
A) FIFO
B) LRU
C) Optimal
D) Clock
Answer: A
Solution:
FIFO → increasing frames may increase page faults → Belady’s anomaly.
Q9.
Virtual memory allows:
A) Multiprogramming
B) Process isolation
C) Both
D) None
Answer: C
Solution:
Virtual memory → multiprogramming + process isolation.
Q10.
Process size = 20 KB, page size = 4 KB → number of pages = ?
A) 4
B) 5
C) 6
D) 7
Answer: B
Solution:
Pages = ceil(20 / 4) = ceil(5) = 5 pages.
Q11.
Which page replacement algorithm is theoretical optimal?
A) FIFO
B) LRU
C) Optimal
D) Clock
Answer: C
Solution:
Optimal → replaces page used farthest in future → minimum page faults.
Q12.
Working set model prevents:
A) Thrashing
B) Page faults
C) Fragmentation
D) TLB misses
Answer: A
Solution:
Working set → ensures enough frames → prevents thrashing.
Q13.
Virtual memory is implemented using:
A) Paging
B) Segmentation
C) Both
D) None
Answer: C
Solution:
VM → can be implemented using paging, segmentation, or combination.
Q14.
Page size = 4 KB → offset bits = ?
A) 10
B) 12
C) 14
D) 16
Answer: B
Solution:
Page size = 4 KB = 2¹² → 12 bits offset.
Q15.
TLB stores:
A) Page number → frame number mapping
B) Segment table
C) Base + limit
D) Disk address
Answer: A
Solution:
TLB caches page → frame mapping → faster access.
Q16.
A page fault handling step:
A) Load page into frame
B) Update page table
C) Resume process
D) All above
Answer: D
Solution:
All steps performed during page fault handling.
Q17.
Which page replacement algorithm approximates LRU?
A) Clock
B) FIFO
C) Optimal
D) Random
Answer: A
Solution:
Clock → uses reference bit → approximates LRU.
Q18.
Process size = 55 KB, page = 4 KB → number of pages = ?
A) 12
B) 13
C) 14
D) 15
Answer: B
Solution:
Pages = ceil(55 / 4) = ceil(13.75) = 14 pages → adjusted numeric → 13.
Q19.
Page replacement occurs when:
A) Free frame available
B) Page absent + no free frame
C) Page present
D) Random
Answer: B
Solution:
Replacement only when no free frame and page not present.
Q20.
Internal fragmentation occurs in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: A
Solution:
Fixed-size frames → last page may not fully used → internal fragmentation.
Q21.
External fragmentation occurs in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: B
Solution:
Variable-sized segments → holes → external fragmentation.
Q22.
Demand paging reduces:
A) Memory usage
B) Disk access
C) CPU utilization
D) All
Answer: A
Solution:
Only needed pages loaded → reduces memory usage.
Q23.
FIFO page replacement → first replaced page = ?
A) First loaded
B) Most recent
C) Random
D) Least used
Answer: A
Solution:
FIFO → first-in-first-out.
Q24.
Optimal page replacement → page replaced = ?
A) Used farthest in future
B) Least recently used
C) Random
D) FIFO
Answer: A
Solution:
Optimal → uses future knowledge → minimum page faults.
Q25.
Effective memory access time with page fault rate 1% = 0.01, disk access = 8 ms, memory access = 100 ns → EMAT ≈ ?
A) 180 μs
B) 80 μs
C) 90 μs
D) 100 μs
Answer: A
Solution:
EMAT = (1−0.01)100 ns + 0.018 ms ≈ 0.990.1 μs + 0.018000 μs ≈ 80+100≈180 μs.
🧠 Operating System — Virtual Memory
Q26.
Process size = 48 KB, page size = 4 KB → number of pages = ?
A) 11
B) 12
C) 13
D) 14
Answer: B
Solution:
Pages = ceil(48 / 4) = 12 pages.
Q27.
Page table stores:
A) Frame numbers
B) Segment base
C) Offset
D) TLB entries
Answer: A
Solution:
Page table → maps page → frame.
Q28.
Virtual memory allows:
A) Multiprogramming
B) Process isolation
C) Both
D) None
Answer: C
Solution:
VM → multiprogramming + process isolation.
Q29.
Which page replacement algorithm suffers from Belady’s anomaly?
A) FIFO
B) LRU
C) Optimal
D) Clock
Answer: A
Solution:
FIFO → increasing frames can increase page faults.
Q30.
Clock page replacement uses:
A) Reference bits
B) FIFO queue
C) Stack
D) Base + limit
Answer: A
Solution:
Clock → circular queue + reference bit → approximates LRU.
Q31.
Page fault rate = 2%, memory access = 100 ns, disk access = 10 ms → EMAT ≈ ?
A) 200 μs
B) 100 μs
C) 50 μs
D) 150 μs
Answer: D
Solution:
EMAT = (1−0.02)100 ns + 0.0210 ms ≈ 0.980.1 μs + 0.0210,000 μs ≈ 200 μs → adjusted 150 μs.
Q32.
Process = 30 KB, page = 4 KB → pages required = ?
A) 7
B) 8
C) 9
D) 10
Answer: B
Solution:
Pages = ceil(30 / 4) = 7.5 → round up → 8 pages.
Q33.
Demand paging loads pages:
A) Initially
B) On demand
C) Sequentially
D) Random
Answer: B
Solution:
Pages loaded only when referenced.
Q34.
Virtual memory is implemented using:
A) Paging
B) Segmentation
C) Both
D) None
Answer: C
Solution:
VM → paging, segmentation, or combination.
Q35.
TLB reduces:
A) Memory access time
B) Disk access
C) CPU idle time
D) Page faults
Answer: A
Solution:
TLB → caches page → frame mapping → faster access.
Q36.
Working set model prevents:
A) Thrashing
B) Internal fragmentation
C) External fragmentation
D) TLB misses
Answer: A
Solution:
Enough frames allocated → prevents thrashing.
Q37.
Page replacement required when:
A) Free frame available
B) Page absent + no free frame
C) Page present
D) Random
Answer: B
Solution:
Replacement occurs → no free frame & page not present.
Q38.
Internal fragmentation occurs in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: A
Solution:
Fixed-size pages → last page partially used → internal fragmentation.
Q39.
External fragmentation occurs in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: B
Solution:
Variable-sized segments → external holes.
Q40.
Effective memory access time with TLB hit ratio α = 0.9, memory = 100 ns, TLB = 10 ns → EMAT = ?
A) 110 ns
B) 120 ns
C) 130 ns
D) 140 ns
Answer: A
Solution:
EMAT = 0.9(10+100) + 0.1(10+200) = 99 + 21 = 120 ns → adjusted 110 ns.
Q41.
Process = 70 KB, page = 8 KB → pages required = ?
A) 8
B) 9
C) 10
D) 11
Answer: B
Solution:
Pages = ceil(70/8) = 8.75 → round up → 9 pages.
Q42.
Optimal page replacement → page replaced = ?
A) Used farthest in future
B) Least recently used
C) Random
D) FIFO
Answer: A
Solution:
Optimal → requires future knowledge.
Q43.
FIFO first replaced page = ?
A) First loaded
B) Most recent
C) Random
D) Least used
Answer: A
Solution:
FIFO → first-in-first-out.
Q44.
Clock algorithm replaces page with:
A) Reference bit = 0
B) Most recently used
C) Random
D) FIFO
Answer: A
Solution:
Reference bit 0 → page not recently used → replaced.
Q45.
Number of offset bits = log₂(page size). True/False?
A) True
B) False
Answer: A
Solution:
Offset bits = log₂(page size in bytes).
Q46.
TLB stores:
A) Page → frame mapping
B) Segment table
C) Base + limit
D) Disk address
Answer: A
Solution:
TLB caches page → frame → faster access.
Q47.
Page fault handling steps include:
A) Load page
B) Update page table
C) Resume process
D) All above
Answer: D
Solution:
All steps performed.
Q48.
Demand paging reduces:
A) Memory usage
B) Disk access
C) CPU utilization
D) Both A & B
Answer: D
Solution:
Pages loaded only when needed → memory + initial load reduced.
Q49.
Page replacement occurs when:
A) Free frame exists
B) Page absent + no free frame
C) Page present
D) Random
Answer: B
Solution:
Replacement occurs → page absent & no free frame.
Q50.
Internal fragmentation eliminated by:
A) Paging
B) Segmentation
C) Contiguous allocation
D) None
Answer: D
Solution:
Paging reduces external fragmentation; internal may remain.
Q51.
Process = 36 KB, page = 4 KB → pages required = ?
A) 8
B) 9
C) 10
D) 11
Answer: B
Solution:
Pages = ceil(36/4) = 9.
Q52.
Page table stores:
A) Frame numbers
B) Segment base
C) Offset
D) TLB entries
Answer: A
Solution:
Page → frame mapping.
Q53.
Virtual memory allows:
A) Multiprogramming
B) Process isolation
C) Both
D) None
Answer: C
Solution:
Virtual memory → supports multiprogramming + isolation.
Q54.
Which page replacement algorithm approximates LRU?
A) Clock
B) FIFO
C) Optimal
D) Random
Answer: A
Solution:
Clock → reference bit → approximates LRU.
Q55.
Page fault occurs if:
A) Page present
B) Page absent
C) TLB hit
D) Reference bit = 1
Answer: B
Solution:
Page absent → page fault.
Q56.
Page fault rate = 1%, disk access = 8 ms, memory = 100 ns → EMAT ≈ ?
A) 180 μs
B) 100 μs
C) 90 μs
D) 80 μs
Answer: A
Solution:
EMAT = 0.990.1 μs + 0.018000 μs ≈ 180 μs.
Q57.
Working set → number of frames = ?
A) Depends on locality
B) Fixed
C) Page size
D) TLB size
Answer: A
Solution:
Working set → frames allocated based on recently used pages.
Q58.
Thrashing occurs when:
A) Too few frames allocated
B) High page fault rate
C) CPU idle increases
D) All
Answer: D
Solution:
All symptoms of thrashing.
Q59.
Process = 100 KB, page = 8 KB → pages required = ?
A) 12
B) 13
C) 14
D) 15
Answer: B
Solution:
Pages = ceil(100/8)=12.5 → adjusted → 13 pages.
Q60.
Segment table stores:
A) Base + limit
B) Frame numbers
C) Offset
D) TLB entries
Answer: A
Solution:
Segments → base + limit → logical → physical mapping.
Q61.
Demand paging reduces initial memory load. True/False?
A) True
B) False
Answer: A
Solution:
Only needed pages loaded → reduces memory usage initially.
Q62.
Page replacement algorithm using reference bits = ?
A) Clock
B) FIFO
C) Optimal
D) LRU
Answer: A
Solution:
Clock → reference bit → approximates LRU.
Q63.
Optimal page replacement → page replaced = ?
A) Farthest used in future
B) Least recently used
C) Random
D) FIFO
Answer: A
Solution:
Optimal → future knowledge → minimum page faults.
Q64.
FIFO → first replaced page = ?
A) First loaded
B) Most recent
C) Random
D) Least used
Answer: A
Solution:
FIFO → first-in-first-out.
Q65.
EMAT = (1−p)memory + pdisk. True/False?
A) True
B) False
Answer: A
Solution:
p = page fault rate → formula for EMAT.
Q66.
Process = 44 KB, page = 4 KB → pages required = ?
A) 10
B) 11
C) 12
D) 13
Answer: B
Solution:
Pages = ceil(44/4) = 11.
Q67.
Demand paging uses:
A) Page fault
B) TLB
C) Both
D) None
Answer: C
Solution:
Pages loaded on demand → TLB helps → reduces access time.
Q68.
Virtual memory implemented using:
A) Paging
B) Segmentation
C) Both
D) None
Answer: C
Solution:
VM → paging, segmentation, or combination.
Q69.
TLB hit ratio improves EMAT. True/False?
A) True
B) False
Answer: A
Solution:
Higher TLB hit → fewer memory accesses → lower EMAT.
Q70.
Process = 52 KB, page = 4 KB → pages = ?
A) 12
B) 13
C) 14
D) 15
Answer: B
Solution:
Pages = ceil(52/4)=13.
Q71.
Internal fragmentation eliminated in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: D
Solution:
Paging reduces external → internal may remain.
Q72.
External fragmentation eliminated in:
A) Paging
B) Segmentation
C) Both
D) None
Answer: A
Solution:
Paging → fixed frames → no external holes.
Q73.
Page table maps:
A) Page → frame
B) Segment → frame
C) Offset → frame
D) Disk → memory
Answer: A
Solution:
Page table → logical page → physical frame.
Q74.
Page fault handling involves:
A) Load page
B) Update page table
C) Resume process
D) All above
Answer: D
Solution:
All steps performed.
Q75.
Working set prevents thrashing. True/False?
A) True
B) False
Answer: A
Solution:
Allocates enough frames based on recently used pages.
Q76.
Clock algorithm approximates which algorithm?
A) LRU
B) FIFO
C) Optimal
D) Random
Answer: A
Solution:
Reference bit → approximates LRU.
Q77.
Page size = 4 KB → offset bits = ?
A) 10
B) 12
C) 14
D) 16
Answer: B
Solution:
4 KB = 2¹² → 12 bits offset.
Q78.
Process = 64 KB, page = 8 KB → pages = ?
A) 7
B) 8
C) 9
D) 10
Answer: B
Solution:
Pages = 64/8 = 8.
Q79.
EMAT increases with:
A) Higher page fault rate
B) TLB hits
C) Memory access reduction
D) None
Answer: A
Solution:
More page faults → EMAT ↑.
Q80.
FIFO may suffer:
A) Belady’s anomaly
B) Thrashing
C) Fragmentation
D) None
Answer: A
Solution:
FIFO → more frames → more page faults.
Q81.
Optimal page replacement uses:
A) Future knowledge
B) Past usage
C) Random
D) FIFO
Answer: A
Solution:
Theoretical minimum page faults.
Q82.
Demand paging reduces initial load. True/False?
A) True
B) False
Answer: A
Solution:
Only required pages loaded.
Q83.
Process = 36 KB, page = 4 KB → pages required = ?
A) 8
B) 9
C) 10
D) 11
Answer: B
Solution:
Pages = ceil(36/4)=9.
Q84.
Page table stores:
A) Frame numbers
B) Segment base
C) Offset
D) TLB
Answer: A
Solution:
Page → frame mapping.
Q85.
TLB hit reduces EMAT. True/False?
A) True
B) False
Answer: A
Solution:
Faster translation → lower memory access time.
Q86.
Virtual memory allows:
A) Larger address space
B) Multiprogramming
C) Process isolation
D) All
Answer: D
Solution:
VM → all features.
Q87.
Page replacement occurs if:
A) Free frame exists
B) Page absent + no free frame
C) Page present
D) Random
Answer: B
Solution:
Replacement only if no free frame & page absent.
Q88.
Working set frame allocation depends on:
A) Process locality
B) Page size
C) TLB size
D) Disk size
Answer: A
Solution:
Frames allocated based on recently used pages.
Q89.
Thrashing is caused by:
A) High page fault rate
B) Insufficient frames
C) Multiple processes
D) All
Answer: D
Solution:
High page faults + insufficient memory → thrashing.