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
- The important aspect of data warehouse environment is that data found within the data warehouse is
- Which of the following virtualization types allows multiple operating systems to run concurrently on a single physical machine, but does not require a hype...
- Predict the program output void main () { int x = 128; printf ("n%d", 1 + x++); }
- Which SOLID principle emphasizes that a class should have only one reason to change, promoting single responsibility?
- Which of the following query will return the third-highest salary from an Employee table in SQL?
- 1. Predict the output of the code public class Animal { public static void main(String args[]) { public int loca...
- The technique of using hard disk space to extend the apparent size of RAM is called:
- Which phase of systems analysis and design focuses on specifying the functional requirements of a system?
- Which type of virtualization allows multiple operating systems to run on a single physical machine using a hypervisor?
- In relational databases, which of the following best describes the role of a "foreign key"?
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)