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
- Definition of brute force attack
- In the context of memory management, which of the following is a key characteristic of the paging technique?
- Which of the following algorithms is the most efficient for finding the smallest element in an unsorted array?
- State True/False With a data mart, teams can access data and gain insights faster, because they don’t have to spend time searching within a more complex d...
- Port number for data and control of FTP protocol
- What is the primary difference between full virtualization and para-virtualization?
- Which is/are correct w.r.t Passive attacks
- Which cloud service model provides an environment for developers to build applications without managing the underlying infrastructure?
- Which type of cyber attack involves overwhelming a server with traffic to make it unavailable to users?
- Which of the following is an essential feature of the ACID properties of a transaction in a database system?
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)