Question
What will be the output of the following code snippet implementing the Least Recently Used (LR
- U page replacement algorithm? def lru(pages, capacity): page_frame = [] page_faults = 0 for page in pages: if page not in page_frame: if len(page_frame) < capacity: page_frame.append(page) else: lru_page = min(page_frame, key=lambda p: pages.index(p)) page_frame.remove(lru_page) page_frame.append(page) page_faults += 1 return page_faults pages = [7, 0, 1, 2, 0, 3, 0, 4, 2, 3] capacity = 4 faults = lru(pages, capacity) print(faults)
More Basics of Computers Questions
- Which of the following statements correctly describes a major difference between public and private clouds?
- Which phase of the Software Development Lifecycle (SDLC) focuses on identifying the feasibility and goals of the project?
- Which of the following best describes the main advantage of a Management Information System (MIS)?
- Data Analytics uses ___ to get insights from data.
- Which of the following best describes the role of digital signatures in ensuring security in digital communications?
- What will be the output of the following JavaScript code when executed? let xhr = new XMLHttpRequest(); xhr.open("GET", "https://api.example.com/data", fal...
- In systems design, which of the following techniques is used to break down complex systems into smaller, more manageable components?
- What type of firewall inspects packets and determines whether they are allowed based on pre-established rules?
- What will be the output of the following Java code snippet, which implements a simple ArrayList and performs an insertion and a retrieval? import java.u...
- Which of the following is a primary advantage of using a private cloud?
Relevant for Exams:
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)