Memory Management · Operating System
67 questions · asked in 27 of 27 years (2000–2026)
MCQ 43 · MSQ 4 · NAT 201-mark 36 · 2-mark 31
2000Questions per year2026
Questions 11–15 of 67
Consider the following two-dimensional array D in the C programming language, which is stored in row-major order:
int D[128][128];
Demand paging is used for allocating memory and each physical page frame holds 512 elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet:
The number of page faults generated during the execution of this code snippet is _____.
int D[128][128];
Demand paging is used for allocating memory and each physical page frame holds 512 elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet:
for (int i = 0; i < 128; i++)
for (int j = 0; j < 128; j++)
D[j][i] *= 10;
The number of page faults generated during the execution of this code snippet is _____.
Answer: 4096
One page holds 512 ints. Each row of D has 128 ints, so a page holds 4 rows. D has 128 rows, so it takes pages.
The code reads D[j][i] with j in the inner loop, so it goes down a column. For one value of i, j runs from 0 to 127 and touches all 32 pages in order, 4 consecutive accesses per page. The first access to a page faults and the next 3 hit.
There are only 30 frames and the policy is LRU. The pages are used in the cycle 0, 1, ..., 31, then 0 again. When a page is needed, it was used longer ago than the 30 pages that LRU has kept, so it has already been removed. So the first access to each page in every pass is a fault: 32 faults for each i.
Total faults =
Answer: 4096
The code reads D[j][i] with j in the inner loop, so it goes down a column. For one value of i, j runs from 0 to 127 and touches all 32 pages in order, 4 consecutive accesses per page. The first access to a page faults and the next 3 hit.
There are only 30 frames and the policy is LRU. The pages are used in the cycle 0, 1, ..., 31, then 0 again. When a page is needed, it was used longer ago than the 30 pages that LRU has kept, so it has already been removed. So the first access to each page in every pass is a fault: 32 faults for each i.
Total faults =
Answer: 4096
Consider a computer system with 57-bit virtual addressing using multi-level tree-structured page tables with L levels for virtual to physical address translation. The page size is 4 KB (1 KB = 1024 B) and a page table entry at any of the levels occupies 8 bytes.
The value of L is ______.
The value of L is ______.
Answer: 5
The page size is 4 KB so there are 12 offset bits. The VPN has bits.
One page-table page can store entries so every level handles 9 bits.
Number of levels:
Answer: 5
One page-table page can store entries so every level handles 9 bits.
Number of levels:
Answer: 5
Which one of the following statements is FALSE?
Answer: (C)
Go through each option. We need the FALSE statement.
- (A) The TLB is associative memory. It compares the page number with all its valid entries in parallel. The statement is TRUE.
- (B) A TLB hit means the page is in main memory. So even after a cache miss, the word is surely in main memory. The statement is TRUE.
- (C) In an inverted page table the frame is found by searching (or by hashing and then following a chain). So the access time depends on the address and is not always the same. The statement is FALSE.
- (D) In a hashed page table, addresses that collide lie on the same chain at different places. So their access times are different. The statement is TRUE.
Answer: (C)
- (A) The TLB is associative memory. It compares the page number with all its valid entries in parallel. The statement is TRUE.
- (B) A TLB hit means the page is in main memory. So even after a cache miss, the word is surely in main memory. The statement is TRUE.
- (C) In an inverted page table the frame is found by searching (or by hashing and then following a chain). So the access time depends on the address and is not always the same. The statement is FALSE.
- (D) In a hashed page table, addresses that collide lie on the same chain at different places. So their access times are different. The statement is TRUE.
Answer: (C)
Consider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference string
7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7,1, 5, 6,1
the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is
7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7,1, 5, 6,1
the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is
Answer: 0.6
Use LRU with 4 frames (F = fault):
7 F, 2 F, 7 hit, 3 F, 2 hit, 5 F [7, 2, 3, 5], 3 hit,
4 F (remove 7), 6 F (remove 2), 7 F (remove 5), 7 hit, 1 F (remove 3), 5 F (remove 4), 6 hit, 1 hit.
There are 9 faults in 15 references. So the fault rate
Answer: 0.6
7 F, 2 F, 7 hit, 3 F, 2 hit, 5 F [7, 2, 3, 5], 3 hit,
4 F (remove 7), 6 F (remove 2), 7 F (remove 5), 7 hit, 1 F (remove 3), 5 F (remove 4), 6 hit, 1 hit.
There are 9 faults in 15 references. So the fault rate
Answer: 0.6
In the context of operating systems, which of the following statements is/are correct with respect to paging?
One or more options are correct.
Answer: (A), (C)
Check every option:
- (A) Any free frame can hold any page, so paging gives no external fragmentation. TRUE.
- (B) With larger pages, more space is wasted in the last page of a process (internal fragmentation). So page size does have an impact. FALSE.
- (C) Page tables use memory (and paging also needs the TLB and extra memory accesses). TRUE.
- (D) Multi-level paging is used to make page tables smaller. It is not used to support different page sizes. FALSE.
Answer: (A), (C)
- (A) Any free frame can hold any page, so paging gives no external fragmentation. TRUE.
- (B) With larger pages, more space is wasted in the last page of a process (internal fragmentation). So page size does have an impact. FALSE.
- (C) Page tables use memory (and paging also needs the TLB and extra memory accesses). TRUE.
- (D) Multi-level paging is used to make page tables smaller. It is not used to support different page sizes. FALSE.
Answer: (A), (C)
Keep practising
Topics in Operating System
System CallProcessThreadProcess SynchronizationDeadlockCPU SchedulingDisk Scheduling
Memory ManagementYou are here
File Systems