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
- In terms of processor performance, which factor has the greatest impact on reducing instruction execution time for computationally heavy applications?
- Thrashing in an operating system is a condition that occurs when:
- Which of the following is the correct CIDR notation for a network with a subnet mask of 255.255.255.240?
- Which command would you use in Unix/Linux to terminate a running process?
- In the context of memory management, which of the following is a key characteristic of the paging technique?
- Size of MD5 message digest
- Which of the following is a primary advantage of IPv6 over IPv4?
- What is the primary purpose of cache memory in computer architecture?
- Which of the following statements best describes the key difference between virtual machines (VMs) and containers?
- The values appearing in given attributes of any tuple in the referencing relation must likewise occur in specified attributes of at least one tuple in the ...
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)