GATE 2025 (Session 2)
65 questions
MCQ 32 · MSQ 18 · NAT 151-mark 30 · 2-mark 35
Questions 26–30 of 65
Processes arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.
Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?
Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?
Answer: (D)
Simulate SRTF (at each moment, run the available process with the least remaining time):
At : only is present (remaining ), so it runs.
At : arrives (remaining ). The remaining time of () is still the shortest, so keeps running.
At : arrives (remaining ). Now compare (), () and (). The shortest is , so the CPU switches to .
runs without a break from to (no shorter process arrives in between). It finishes just as arrives. turnaround time .
At : arrives (remaining ). Compare (), () and (). is the shortest and runs to completion at . turnaround time .
At : compare () and (). runs to completion at . Turnaround time .
At : only is left. It runs to completion at . Turnaround time .
Average turnaround time
Answer: 19
At : only is present (remaining ), so it runs.
At : arrives (remaining ). The remaining time of () is still the shortest, so keeps running.
At : arrives (remaining ). Now compare (), () and (). The shortest is , so the CPU switches to .
runs without a break from to (no shorter process arrives in between). It finishes just as arrives. turnaround time .
At : arrives (remaining ). Compare (), () and (). is the shortest and runs to completion at . turnaround time .
At : compare () and (). runs to completion at . Turnaround time .
At : only is left. It runs to completion at . Turnaround time .
Average turnaround time
Answer: 19
An audit of a banking transactions system has found that on an earlier occasion, two joint holders of account attempted simultaneous transfers of Rs. 10000 each from account to account . Both transactions read the same value, Rs. 11000, as the initial balance in and were allowed to go through. was credited Rs. 10000 twice. was debited only once and ended up with a balance of Rs. 1000.
Which of the following properties is/are certain to have been violated by the system?
Which of the following properties is/are certain to have been violated by the system?
One or more options are correct.
Answer: (B), (C)
This is the standard lost-update problem. Two transactions read the same old value, and one overwrites the effect of the other.
- Consistency is violated. A transfer must keep the total money the same. Here was debited Rs. 10000 once, but was credited Rs. 20000, so Rs. 10000 was created from nothing. A serial run would have rejected the second transfer, because had only Rs. 1000 left after the first.
- Isolation is violated. Both transactions read the balance of before either one had updated it, so their effects clashed. In a serial or serializable execution the second one would have seen the Rs. 1000 balance.
- Atomicity is not necessarily violated. Each transaction ran fully to the end, and none was executed in part.
- Durability is not related here. Nothing suggests that committed data was lost because of a crash.
Answer: (B), (C)
- Consistency is violated. A transfer must keep the total money the same. Here was debited Rs. 10000 once, but was credited Rs. 20000, so Rs. 10000 was created from nothing. A serial run would have rejected the second transfer, because had only Rs. 1000 left after the first.
- Isolation is violated. Both transactions read the balance of before either one had updated it, so their effects clashed. In a serial or serializable execution the second one would have seen the Rs. 1000 balance.
- Atomicity is not necessarily violated. Each transaction ran fully to the end, and none was executed in part.
- Durability is not related here. Nothing suggests that committed data was lost because of a crash.
Answer: (B), (C)
Which of the following is/are part of an Instruction Set Architecture of a processor?
One or more options are correct.
Answer: (D)
The Instruction Set Architecture (ISA) is the part of the processor that software can see. It sits between hardware and software. It covers the available instructions, the addressing modes, and the visible register set. The total number of (architecturally visible) registers belongs to the ISA, because programs and compilers must know how many registers they can use.
Cache size, clock frequency and the number of cache levels are microarchitecture (implementation) details. Two processors can have the very same ISA and still differ in these, and software will still work on both.
Answer: The total number of registers
Cache size, clock frequency and the number of cache levels are microarchitecture (implementation) details. Two processors can have the very same ISA and still differ in these, and software will still work on both.
Answer: The total number of registers
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph is/are TRUE?
One or more options are correct.
Answer: (B), (C), (D)
Check each claim about BFS and DFS on an undirected simple graph:
- (A) "A DFS tree is a shortest path tree": false — DFS goes as deep as it can along one branch first, so it gives no shortest-path guarantee. For example, in a triangle , DFS from can go , so is at depth though its distance from is . Only BFS gives shortest paths here.
- (B) "Every non-tree edge w.r.t. a DFS tree is a forward/back edge": true — in an undirected graph, DFS can never produce a cross edge. Every non-tree edge joins an ancestor and a descendant. Seen from the descendant it is a back edge, and seen from the ancestor it is a forward edge.
- (C) "Non-tree BFS edge (u,v): distances differ by at most 1": true — BFS explores level by level. Any edge can only join vertices in the same level or in adjacent levels.
- (D) "Both BFS and DFS can find connected components": true — if you run either search again and again from each vertex not yet visited, the graph is correctly split into its connected components.
Answer: (B), (C), (D)
- (A) "A DFS tree is a shortest path tree": false — DFS goes as deep as it can along one branch first, so it gives no shortest-path guarantee. For example, in a triangle , DFS from can go , so is at depth though its distance from is . Only BFS gives shortest paths here.
- (B) "Every non-tree edge w.r.t. a DFS tree is a forward/back edge": true — in an undirected graph, DFS can never produce a cross edge. Every non-tree edge joins an ancestor and a descendant. Seen from the descendant it is a back edge, and seen from the ancestor it is a forward edge.
- (C) "Non-tree BFS edge (u,v): distances differ by at most 1": true — BFS explores level by level. Any edge can only join vertices in the same level or in adjacent levels.
- (D) "Both BFS and DFS can find connected components": true — if you run either search again and again from each vertex not yet visited, the graph is correctly split into its connected components.
Answer: (B), (C), (D)
Consider the two lists List I and List II given below:
For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
One or more options are correct.
Answer: (B), (C)
Recall the closure properties of each class.
- Context-free languages: closed under union, not closed under complementation, not closed under intersection. So (i) can take (a) or (b), but not (c).
- Recursive languages: closed under union, complementation and intersection. So (ii) can take (a) or (c), but not (b).
- Regular languages: closed under union, complementation and intersection. So (iii) can take (a) or (c), but not (b).
Property (b) must go to a class that is not closed under complementation. Only context-free languages are, so (i)-(b). Then (a) and (c) are true for both recursive and regular languages, so they can be given out in either order. This gives two correct matchings:
- (i)-(b), (ii)-(a), (iii)-(c), which is option (B).
- (i)-(b), (ii)-(c), (iii)-(a), which is option (C).
Option (A) puts (b) with recursive languages, and option (D) puts (b) with regular languages. Both classes are closed under complementation, so these two are wrong.
Answer: (B), (C)
- Context-free languages: closed under union, not closed under complementation, not closed under intersection. So (i) can take (a) or (b), but not (c).
- Recursive languages: closed under union, complementation and intersection. So (ii) can take (a) or (c), but not (b).
- Regular languages: closed under union, complementation and intersection. So (iii) can take (a) or (c), but not (b).
Property (b) must go to a class that is not closed under complementation. Only context-free languages are, so (i)-(b). Then (a) and (c) are true for both recursive and regular languages, so they can be given out in either order. This gives two correct matchings:
- (i)-(b), (ii)-(a), (iii)-(c), which is option (B).
- (i)-(b), (ii)-(c), (iii)-(a), which is option (C).
Option (A) puts (b) with recursive languages, and option (D) puts (b) with regular languages. Both classes are closed under complementation, so these two are wrong.
Answer: (B), (C)