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 correctly describes the second normal form (2NF) in database normalization?
- Which protocol is responsible for resolving IP addresses to MAC addresses in a local network?
- Which type of virtualization allows for multiple virtual machines to run on a single physical machine by using a software layer that separates the hardware...
- 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...
- In object-oriented programming, what type of polymorphism is achieved at runtime?
- 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...
- Which type of software is designed to help users perform specific tasks, such as creating documents, spreadsheets, or presentations?
- What is the primary purpose of design patterns in software engineering?
- Which of the following is a key benefit of IPv6 over IPv4?
- Which of the following protocols is responsible for sending and receiving emails across the internet?
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)