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 testing techniques requires no knowledge of the internal code structure of the software?
- How can we delete all records in SQL?
- In backup and recovery practices, what is RPO (Recovery Point Objective) primarily concerned with?
- What will be the output of the following code snippet implementing the Least Recently Used (LRU) page replacement algorithm? def lru(pages, capacity): ...
- Integrated Circuits (ICs) were the hallmark of which computer generation, leading to smaller, faster, and more reliable machines?
- Which type of cyber attack involves overwhelming a server with traffic to make it unavailable to users?
- Which type of virtualization allows multiple operating systems to run on a single physical machine using a hypervisor?
- What will be the output of the following code snippet? class Animal: def sound(self): return "Some sound" class Dog(Animal): def sound(sel...
- Which module in Python supports regular expressions?
- Which of the following operations is most efficient in a singly linked list compared to an array?
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)