Virtual Memory MCQ Quiz - Objective Question with Answer for Virtual Memory - Download Free PDF

Last updated on Mar 25, 2025

Latest Virtual Memory MCQ Objective Questions

Virtual Memory Question 1:

Which of the following Page Replacement Algorithm suffers from the Belady’s anomaly ?

  1. LRU 
  2. Optimal page Replacement
  3. FIFO 
  4. Both LRU and FIFO

Answer (Detailed Solution Below)

Option 3 : FIFO 

Virtual Memory Question 1 Detailed Solution

- www.guacandrollcantina.com

The correct answer is FIFO.

Key Points

  • FIFO (First-In-First-Out) is a page replacement algorithm that suffers from Belady's anomaly.
  • Belady's anomaly refers to the counterintuitive situation where increasing the number of page frames results in an increase in the number of page faults.
  • In the FIFO algorithm, pages are replaced in the order they arrive, which can lead to suboptimal page replacement decisions.
  • Belady's anomaly is not observed in other algorithms like LRU (Least Recently Used) and Optimal Page Replacement.

Additional Information

  • LRU (Least Recently Used) algorithm replaces the page that has not been used for the longest period of time. It does not suffer from Belady's anomaly.
  • Optimal Page Replacement algorithm replaces the page that will not be used for the longest period of time in the future. It also does not suffer from Belady's anomaly.
  • Belady's anomaly occurs because the FIFO algorithm does not take into account the frequency or recency of page accesses.
  • Understanding and addressing Belady's anomaly is important for designing efficient memory management systems.

Virtual Memory Question 2:

Consider a system with three frames in memory and following memory references in the working set

2 1 2 3 5 4 1 3 4 2 1

How many page fault will be there if we use second chance page replacement algorithm ?

  1. 7
  2. 8
  3. 9
  4. 10

Answer (Detailed Solution Below)

Option 1 : 7

Virtual Memory Question 2 Detailed Solution

The correct answer is Option 1: 7.

Key Points

  • The Second Chance Page Replacement Algorithm is a modification of the FIFO (First In First Out) algorithm that reduces the number of page faults by giving pages a second chance to stay in memory if they have been referenced recently.
  • When a page needs to be replaced, the algorithm inspects the reference bit of the pages in the order they were loaded into memory (FIFO order).
  • If a page's reference bit is 0, it is replaced. If the reference bit is 1, the bit is cleared and the page is given a second chance, moving to the back of the queue.
  • Consider the memory references in the working set: 2, 1, 2, 3, 5, 4, 1, 3, 4, 2, 1 with three frames in memory.
  • The detailed steps are as follows:
    • Initially, all frames are empty.
    • Reference 2: Page 2 is loaded into the frame. (Page Fault)
    • Reference 1: Page 1 is loaded into the frame. (Page Fault)
    • Reference 2: Page 2 is already in the frame. (No Page Fault)
    • Reference 3: Page 3 is loaded into the frame. (Page Fault)
    • Reference 5: Page 2 is given a second chance (reference bit cleared), Page 1 is given a second chance (reference bit cleared), Page 3 is replaced by Page 5. (Page Fault)
    • Reference 4: Page 2 is given a second chance, Page 1 is given a second chance, Page 5 is replaced by Page 4. (Page Fault)
    • Reference 1: Page 1 is already in the frame. (No Page Fault)
    • Reference 3: Page 2 is given a second chance, Page 1 is given a second chance, Page 4 is replaced by Page 3. (Page Fault)
    • Reference 4: Page 2 is given a second chance, Page 1 is given a second chance, Page 3 is given a second chance (reference bit cleared), Page 4 is loaded into the frame. (Page Fault)
    • Reference 2: Page 2 is replaced by Page 2. (Page Fault)
    • Reference 1: Page 1 is already in the frame. (No Page Fault)
  • In total, there are 7 page faults.

Additional Information

  • The Second Chance Algorithm is also known as the Clock Algorithm because it can be visualized as a circular queue with a clock hand pointing to the next page to be considered for replacement.
  • This algorithm helps reduce page faults by considering whether a page has been used recently before deciding to replace it.

Virtual Memory Question 3:

Decreasing the RAM of a computer typically leads to which of the following outcomes?

  1. Virtual memory increases.
  2. Page faults increases. 
  3. Page faults decreases. 
  4. Segmentation faults occur.

Answer (Detailed Solution Below)

Option 2 : Page faults increases. 

Virtual Memory Question 3 Detailed Solution

 The correct option is: Option 2) Page faults increase.Key Points

  • Decreasing the RAM of a computer typically leads to an increase in page faults.
  • When there is less RAM available, the system is more likely to run out of physical memory, causing the operating system to rely on virtual memory.
  • This reliance on virtual memory leads to more frequent page swaps between the RAM and the disk, which increases page faults.

Therefore, the correct option is: Option 2) Page faults increase.
Important Points

  • A page fault occurs in an operating system when a program tries to access a section of memory that is not currently in physical RAM (Random Access Memory).
  • With less RAM, the system may experience slower performance due to increased reliance on disk swapping, leading to longer load times for applications.

Virtual Memory Question 4:

In a computer if the page fault service time is 10 ms and average memory access time is 30 ns. If one page fault is generated for every 106 memory accesses. What is the effective access time for the memory?

  1. 21 ns approximate 
  2. 25 ns approximate 
  3. 30 ns approximate 
  4. 40 ns approximate

Answer (Detailed Solution Below)

Option 4 : 40 ns approximate

Virtual Memory Question 4 Detailed Solution

Data:

page fault service time = S = 10 ms = 107 ns

page fault rate = p = \(\frac{1}{10^{6}}\)

memory access time = m = 30 ns

Formula:

Effective access time (EAT) = p × S + (1 - p) × m

Calculation:

EAT = \(\frac{1}{10^{6}}\)× 107 + (1 - \(\frac{1}{10^{6}}\)) × 30

EAT = 39.99 ns

The correct answer is 39.99ns which is approximately equal to 40ns.

Virtual Memory Question 5:

 In which one of the following page replacement algorithms, it is possible for the page fault rate to increase even when the number of allocated frames increases?

  1. LRU (Least Recently Used)
  2. OPT (Optimal Page Replacement)
  3. MRU (Most Recently Used)
  4. FIFO (First In First Out)

Answer (Detailed Solution Below)

Option 4 : FIFO (First In First Out)

Virtual Memory Question 5 Detailed Solution

The correct answer is FIFO (First In First Out)

Concept:

Belady’s anomaly is the phenomenon in which increasing the number of page frame results in  increase in the number of page faults.

Explanation:

FIFO replacement algorithm results in page faults by increasing the number of page frames.

Consider the example:

Frame = 3

String = 0 1 5 3 0 1 4 0 1 5 3 4

REQUEST

0

1

5

3

0

1

4

0

1

5

3

4

Frame 3

 

 

5

5

5

1

1

1

1

1

3

3

Frame 2

 

1

1

1

0

0

0

0

0

5

5

5

Frame 1

0

0

0

3

3

3

4

4

4

4

4

4

Miss/Hit

Miss

Miss

Miss

Miss

Miss

Miss

Miss

Hit

Hit

Miss

Miss

Hit

 

Number of page faults = 9

Take number of frames = 4

REQUEST

0

1

5

3

0

1

4

0

1

5

3

4

Frame 4

 

 

 

3

3

3

3

3

3

5

5

5

Frame 3

 

 

5

5

5

5

5

5

1

1

1

1

Frame 2

 

1

1

1

1

1

1

0

0

0

0

4

Frame 1

0

0

0

0

0

0

0

4

4

4

3

3

Miss/Hit

Miss

Miss

Miss

Miss

Hit

Hit

Miss

Miss

Miss

Miss

Miss

Miss


Number of page faults = 10

Top Virtual Memory MCQ Objective Questions

Virtual memory implements the translation of a program's address space to

  1. virtual addresses
  2. physical addresses
  3. mapping addresses
  4. page addresses

Answer (Detailed Solution Below)

Option 2 : physical addresses

Virtual Memory Question 6 Detailed Solution

Download Solution PDF

Virtual Memory in Operating System:

  • A computer can address more memory than the amount physically installed on the system. This extra memory is actually called virtual memory and it is a section of a hard disk that's set up to emulate the computer's RAM.
  • Virtual memory implements the translation of a program's address space to physical addresses.
  • Virtual memory serves two purposes. First, it allows us to extend the use of physical memory by using the disk.
  • Second, it allows us to have memory protection because each virtual address is translated into a physical address.

The working set model is used in memory management to implement the concept of:

  1. Thrashing
  2. Segmentation
  3. Principle of locality
  4. Paging

Answer (Detailed Solution Below)

Option 3 : Principle of locality

Virtual Memory Question 7 Detailed Solution

Download Solution PDF

Concept:

The working set model: The memory that is being accessed frequently by an application.

Same thing is done by principle of locality.

Explanation:

There are two types of principle of locality

  1. Spatial locality: whenever we are looking for an element the chances are that, the particular element will be present in a close proximity around the one which we have previously referred.
  2. Temporal locality: Least recently used element is going to be used again.


Principle of locality is the correct answer, hence option 3 is the correct answer.

Which of the following techniques allows execution of programs large than the size of physical memory?  

  1. DMA
  2. Demand paging 
  3. Buffering
  4. Thrashing

Answer (Detailed Solution Below)

Option 2 : Demand paging 

Virtual Memory Question 8 Detailed Solution

Download Solution PDF

Concept

Demand paging allows the execution of programs large than the size of physical memory. It is similar to a paging system with swapping. With this, a page is brought into main memory only when a reference is made to a location on that page. The lazy swapper concept is used in demand paging.

Points about demand paging:

  • It combines the features of simple paging and overlaying to implement virtual memory.
  • Each page of the program is stored contiguously in the paging swap space on secondary storage.
  • Once the page is in the memory, it is accessed as in simple paging.
  • Some form of hardware support is required to distinguish between those pages that are in memory and those are on the disk. Valid and invalid bits are used for this.

Let the page fault service time be 10 ms in a computer with average memory access time being 20 ns. If one page fault is generated for every 106 memory accesses, what is the effective access time for the memory?

  1. 21.4 ns
  2. 29.9 ns
  3. 23.5 ns
  4. 35.1 ns

Answer (Detailed Solution Below)

Option 2 : 29.9 ns

Virtual Memory Question 9 Detailed Solution

Download Solution PDF

Data:

page fault service time = S = 10 ms = 107 ns

page fault rate = p = \(\frac{1}{10^{6}}\)

memory access time = m = 20 ns

Formula:

Effective access time (EAT) = p × S + (1 - p) × m

Calculation:

EAT = \(\frac{1}{10^{6}}\)× 107 + (1 - \(\frac{1}{10^{6}}\)) × 20

EAT = 29.99 ns

How many page faults occur in a system with LRU page replacement policy having 3 (initially empty) page frames for the following string of page reference - 5, 1, 2, 3, 4, 3, 2, 3, 1, 2, 4, 3?

  1. 7
  2. 8
  3. 9
  4. 10

Answer (Detailed Solution Below)

Option 2 : 8

Virtual Memory Question 10 Detailed Solution

Download Solution PDF

LRU page replacement algorithm:

F1 R.S Deepak 1.11.2019 D2

Hit miss table:

5

1

2

3

4

3

2

3

1

2

4

3

M

M

M

M

M

H

H

H

M

H

M

M

 

∴number of miss = page faults = 8 

Important Points:

M is miss which corresponds to a page fault

H is hit which corresponds to page hit (no page fault)

How many page faults will occur if FIFO Page replacement algorithm is used for the following reference string with three-page frames?

7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

  1. 17
  2. 14
  3. 16
  4. 15

Answer (Detailed Solution Below)

Option 4 : 15

Virtual Memory Question 11 Detailed Solution

Download Solution PDF

The correct answer is option 4. 

Concept:

First In First Out (FIFO):

 This is the simplest page replacement algorithm. In this algorithm, the operating system keeps track of all pages in the memory in a queue, the oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal.

Page Fault:

A page fault happens when a running program accesses a memory page that is mapped into the virtual address space but not loaded in physical memory.

Explanation:

Page reference 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
Hit (H)/ Miss(M) M M M M H M M M M M M H H M M H H M M M
page frame size= 3 7 7 7 2 2 2 2 4 4 4 0 0 0 0 0 0 0 7 7 7
  0 0 0 0 3 3 3 2 2 2 2 2 1 1 1 1 1 0 0
    1 1 1 1 0 0 0 3 3 3 3 3 2 2 2 2 2 1


Hence the page faults= 15

Hence the correct answer is 15.

Increasing the RAM of a computer typically improves performance because : 

  1. Virtual memory increases 
  2. Larger RAM are faster 
  3. Fewer page faults occur
  4. None of these 

Answer (Detailed Solution Below)

Option 3 : Fewer page faults occur

Virtual Memory Question 12 Detailed Solution

Download Solution PDF

Correct answer: option 3

Explanation:

  • The RAM constitutes the physical memory of a computer. So, increasing the RAM does not increase the virtual memory.
  • The speed of RAM remains constant, irrespective of its size. The cache memory is faster than the RAM.
  • Increasing the RAM signifies that the memory will be able to hold more pages. As a result, when a process needs a particular page, chances are higher that the page will already be present in the memory. This will lead to lower page faults.

How many page faults will occur if Optimal Page replacement algorithm is used for the following reference string with three page frames?

7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

  1. 10
  2. 7
  3. 9
  4. 8

Answer (Detailed Solution Below)

Option 3 : 9

Virtual Memory Question 13 Detailed Solution

Download Solution PDF

Optimal Page replacement:
In this algorithm, pages are replaced which would not be used for the longest duration of time in the future.

7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

No. of hits = 11
No. of misses = 9

F1  Harshita 09-2-22 Madhuri D3

Recall that Belady’s anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:

S1: Random page replacement algorithm (where a page chosen at random is replaced)

Suffers from Belady’s anomaly

S2: LRU page replacement algorithm suffers from Belady’s anomaly

Which of the following is CORRECT?

  1. S1 is true, S2 is true
  2. S1 is true, S2 is false
  3. S1 is false, S2 is true
  4. S1 is false, S2 is false

Answer (Detailed Solution Below)

Option 2 : S1 is true, S2 is false

Virtual Memory Question 14 Detailed Solution

Download Solution PDF

Concepts:

Belady’s anomaly is that the page-fault rate may increase as the number of allocated frames increases.

Explanation:

S1: Random page replacement algorithm (where a page chosen at random is replaced)

Suffers from Belady’s anomaly.

Random page replacement algorithm can behave like any replacement algorithm. It may behave as FIFO, LRU, MRU etc.). When random page replacement algorithm behaves like a FIFO page replacement algorithm in that case there can be chances of belady’s anamoly.

For this let us consider an example of FIFO case, if we consider the reference string 3  2 1 0 3 2 4 3 2 1 0 4 and 3 frame slots, in this we get 9 page fault but if we increase slots to 4, then we get 10 page faults.

So, page faults are increasing by increasing the number of frame slots. It suffers from belady’s anamoly.

S2: LRU page replacement algorithm suffers from Belady’s anomaly

It doesn’t suffers from page replacement algorithm because in LRU, the page which is least recently used is replaced by the new page. Also, LRU Is a stack algorithm. (A stack algorithm is one that satisfies the inclusion property.) and stack algorithm doesn’t suffer from belady’s anamoly.

Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is M units if the corresponding memory page is available in memory, and D units if the memory access causes a page fault. It has been experimental measured that the average time taken for a memory access in the process is X units.

Which one of the following is the correct expression for the page fault rate experienced by the process?

  1. (D - M) / (X - M)

  2. (X - M) / (D - M)
  3. (D - X) / (D - M)
  4. (X - M) / (D - X)

Answer (Detailed Solution Below)

Option 2 : (X - M) / (D - M)

Virtual Memory Question 15 Detailed Solution

Download Solution PDF

5a961dcb2bb8d71065ef4f53 16480305693751

Let P be the page fault rate.

Average memory access time = ( 1 - page fault rate) × memory access time when no page fault  +  Page fault rate × Memory access time when page fault.

X = (1 - P) × M + P × D

∴X = M - PM + PD

X - M = P(D - M )

P = (X - M)/( D - M)

Get Free Access Now
Hot Links: teen patti gold apk teen patti bliss teen patti wink teen patti joy