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 an enterprise environment, which of the following backup strategies provides the best balance between minimizing storage usage and ensuring data recover...
- 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 of the following is the most effective method for ensuring that an organization complies with security and privacy regulations such as GDPR or HIPAA ...
- Which of the following best describes the role of digital signatures in ensuring security in digital communications?
- Which of the following best describes supervised learning in machine learning?
- Which of the following is the main risk associated with Cross-Site Request Forgery (CSRF) attacks?
- In JavaScript, which method is used to parse a string into a JSON object?
- Which of the following HTTP methods is idempotent and used to completely replace a resource on the server?
- Which of the following is a critical component of a data protection policy that supports regulatory compliance?
- Which is/are Keyword in C++
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)