Data Structures & AlgorithmsHardGATE CS · TCS NQT
Four processes need CPU bursts [5, 3, 8, 2] (all arrive at time 0). A round-robin scheduler gives each process up to a quantum of 2 units per turn, in FIFO order. What is the total waiting time over all processes (waiting = completion time − burst)?
- A. 30
- B. 33
- C. 32
- D. 37
Correct answer: B. 33
Simulate with a queue: run the front process for min(quantum, remaining) units, and re-enqueue it if work remains. Waiting time is completion minus burst, since all arrive at 0. Changing the quantum changes both the ordering and the totals.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- Among all non-empty contiguous subarrays of 2 -1 4 -3 5 1, what is the largest sum that does NOT exceed 6?
- In how many ways can 1 2 2 0 3 2 1 2 2 be cut into exactly THREE non-empty contiguous parts whose sums are all equal? (A cut is a pair of…
- What is the maximum AVERAGE over all contiguous subarrays of 1 12 -5 -6 50 3 that have length at least 3? Give the answer as a fraction in…
- Choose two NON-OVERLAPPING contiguous windows of length exactly 2 from 4 -2 7 1 -5 6 3 -1. What is the largest possible total sum of their…
- How many contiguous subarrays of 3 1 2 4 0 contain EXACTLY 2 inversions (pairs i < j inside the subarray with a[i] > a[j])?
- What is the length of the longest contiguous subarray of 1 3 5 4 2 6 8 7 3 1 that is bitonic, meaning it strictly increases up to one peak…