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
- Which method is used to compute the inverse of a matrix in numerical computing efficiently?
- Which numerical method is commonly used to find the roots of nonlinear equations in statistical computing?
- Which of the following is NOT a cloud deployment model?
- In Big Data Analytics, what is the main function of the MapReduce programming model?
- Which of the following algorithm design techniques is characterized by breaking a problem into smaller sub-problems and solving each recursively?
- Which of the following scenarios violates the Isolation property in the ACID properties of a transaction?
- Which command in Windows is used to display the IP configuration of a computer?
- Given the following code snippet, what will be the output when the function findMax is called with the array arr = [1, 5, 3, 9, 2]? def findMax(arr): ...
- Which of the following is NOT a valid relational algebra operation?
- Which component of a Management Information System (MIS) focuses on long-term strategic planning?
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)