Question
What will be the output of the following code when implementing the SCAN I/O scheduling algorithm? def scan(requests, head, direction): seek_sequence = [] distance = 0 cur_track = 0 if direction == "left": requests.sort(reverse=True) else: requests.sort() for track in requests: if cur_track < track: seek_sequence.append(cur_track) distance += abs(track - cur_track) cur_track = track return seek_sequence, distance requests = [98, 180, 37, 122, 14, 124, 65, 67] head = 50 direction = "right" seek_sequence, total_distance = scan(requests, head, direction) print(seek_sequence) print(total_distance)
More Basics of Computers Questions
- Java. Lang package
- Which HTTP method is used to send data to the server and process it without affecting the state of the resource?
- What is the purpose of Inheritance in Object-Oriented Programming?
- What is the primary purpose of design patterns in software engineering?
- In a mission-critical network requiring fault tolerance and multiple redundant paths, which of the following topologies provides the highest level of redun...
- In Object-Oriented Programming, which of the following Java code snippets correctly demonstrates inheritance ? class Animal { ...
- Which of the following best describes the purpose of Continuous Integration (CI) in the CI/CD pipeline?
- Dynamic programming is used by
- Which one of the following given statements possibly contains the error?
- What is 'two-factor authentication' (2FA)?
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)