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 of the following best describes containerization in cloud computing?
- In terms of processor performance, which factor has the greatest impact on reducing instruction execution time for computationally heavy applications?
- Appending value to list in python
- The primary role of an operating system (OS) is to:
- Which concept in virtual machines allows multiple operating systems to share the same hardware resources while remaining isolated from each other?
- Which application layer protocol is primarily responsible for sending emails?
- Which numerical method is commonly used to find the roots of nonlinear equations in statistical computing?
- Which of the following is a characteristic of an intelligent agent?
- Which protocol is used for reliable communication in data communication and networking?
- Which of the following cloud service models provides the most control over the underlying infrastructure to the user?
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