Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Given references to the following pages by a ... Start Learning for Free
Given references to the following pages by a program
0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3 How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?
  • a)
    7
  • b)
    8
  • c)
    9
  • d)
    None of these
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Given references to the following pages by a program0, 9, 0, 1,8, 1,8,...
Page sequence 0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 3, 2, 7, 8, 2, 3, 8, 3 
Given 3 page frames are available and optimal replacement policy.
View all questions of this test
Most Upvoted Answer
Given references to the following pages by a program0, 9, 0, 1,8, 1,8,...
Given:
References to the following pages: 0, 9, 0, 1, 8, 1, 8, 7, 8, 7, 1, 2, 8, 2, 7, 8, 2, 3, 8, 3
Number of page frames available: 3

To solve this problem, we can use the Optimal Page Replacement algorithm. Here's how it works:

1. Initialize: Set the number of page faults to 0.

2. Create an empty set: This set will be used to store the pages currently in memory.

3. Iterate through the page references:

a. If the current page is already present in the set, continue to the next page reference.

b. If the set is not full (i.e., the number of pages in the set is less than the number of page frames available), add the current page to the set and continue to the next page reference.

c. If the set is full, remove the page from the set that will not be referenced for the longest time in the future (according to the remaining page references). Replace it with the current page and increment the number of page faults.

4. Repeat step 3 until all page references have been processed.

Applying the Optimal Page Replacement algorithm to the given problem:

1. The first three page references (0, 9, 0) are added to the set, resulting in page faults.

2. The fourth page reference (1) is not present in the set, so we replace one of the pages in the set with the current page (1). This results in a page fault.

3. The next two page references (8, 1) are already present in the set, so we continue to the next page reference.

4. The next three page references (8, 7, 8) are already present in the set, so we continue to the next page reference.

5. The next three page references (7, 1, 2) are already present in the set, so we continue to the next page reference.

6. The next two page references (8, 2) are already present in the set, so we continue to the next page reference.

7. The next three page references (7, 8, 2) are already present in the set, so we continue to the next page reference.

8. The next two page references (3, 8) are not present in the set. We replace one of the pages in the set with the current page (3). This results in a page fault.

9. The last page reference (3) is already present in the set, so we continue to the next page reference.

Counting the page faults:

Based on the above steps, we can see that there are 7 page faults in total.

Therefore, the correct answer is option 'A' - 7.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer?
Question Description
Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer?.
Solutions for Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Given references to the following pages by a program0, 9, 0, 1,8, 1,8, 7, 8, 7, 1,2, 8, 2, 7, 8, 2, 3, 8,3How many page faults will occur if the program has been three page frames available to it and uses an optimal replacement?a)7b)8c)9d)None of theseCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev