GATE 2025 (Session 2)
65 questions
MCQ 32 · MSQ 18 · NAT 151-mark 30 · 2-mark 35
Questions 56–60 of 65
A 5-stage instruction pipeline has stage delays of 180, 250, 150, 170, and 250, respectively, in nanoseconds. The delay of an inter-stage latch is 10 nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process 1000 instructions in microseconds is __________ . (rounded off to two decimal places)
Answer: 260.2 to 261.2
In a -stage pipeline, one clock cycle must be long enough for the slowest stage plus the inter-stage latch delay. So each cycle takes ns.
The total time to run instructions in a pipeline takes cycles. Here is the number of pipeline stages, and this counts the first fill of the pipeline. So the time is ns, which s.
Answer: 261.04
The total time to run instructions in a pipeline takes cycles. Here is the number of pipeline stages, and this counts the first fill of the pipeline. So the time is ns, which s.
Answer: 261.04
In a -tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys and points to a subtree containing keys in , and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value 23 is inserted into the -tree.
The smallest key value in the parent of the leaf that contains 25* is __________. (Answer in integer)
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys and points to a subtree containing keys in , and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value 23 is inserted into the -tree.
The smallest key value in the parent of the leaf that contains 25* is __________. (Answer in integer)
Answer: 33
Leaf now covers the key range (between the separators of , and ). It is already full (at most keys per node).
Step 1 — leaf split: Inserting gives keys (), so splits into and . By the given rule, the smallest key of the new leaf, , is copied up into parent .
Step 2 — B overflows too: gets the new separator and becomes . That is keys, more than the limit of keys. is an internal node, so it splits by pushing up (not copying) its middle key (the rd of ) into the grandparent . So splits into and , and the child pointers are shared out correctly. The first child of now covers , which is exactly leaf , the one holding .
Step 3 — A takes the pushed-up key: had only keys (one empty slot), so it accepts without overflow: . No more splits are needed.
So the leaf with is , and its parent is now . The smallest key in this parent is .
Answer: 33
Step 1 — leaf split: Inserting gives keys (), so splits into and . By the given rule, the smallest key of the new leaf, , is copied up into parent .
Step 2 — B overflows too: gets the new separator and becomes . That is keys, more than the limit of keys. is an internal node, so it splits by pushing up (not copying) its middle key (the rd of ) into the grandparent . So splits into and , and the child pointers are shared out correctly. The first child of now covers , which is exactly leaf , the one holding .
Step 3 — A takes the pushed-up key: had only keys (one empty slot), so it accepts without overflow: . No more splits are needed.
So the leaf with is , and its parent is now . The smallest key in this parent is .
Answer: 33
A computer system supports a logical address space of bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a -bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.
The value of is ___________ . (Answer in integer)
The value of is ___________ . (Answer in integer)
Answer: 11
The page size bytes, so the offset inside a page needs bits. The logical address space bytes, so the other bits make up the page-number part. This part is shared by the outer index ( bits) and the offset in the inner page table.
Each inner page table must fit exactly in one page (the usual assumption for multi-level paging). Each entry takes bytes, so one inner page table holds entries. This means the inner-table offset needs bits.
Now find b:
Answer: 11
Each inner page table must fit exactly in one page (the usual assumption for multi-level paging). Each entry takes bytes, so one inner page table holds entries. This means the inner-table offset needs bits.
Now find b:
Answer: 11
Consider the following algorithm someAlgo that takes an undirected graph as input.
1. Let be any vertex in . Run BFS on starting at . Let be a vertex in at maximum distance from as given by the BFS.
2. Run BFS on again with as the starting vertex. Let be the vertex at maximum distance from as given by the BFS.
3. Output the distance between and in .
The output of for the tree shown in the given figure is __________. (Answer in integer)
1. Let be any vertex in . Run BFS on starting at . Let be a vertex in at maximum distance from as given by the BFS.
2. Run BFS on again with as the starting vertex. Let be the vertex at maximum distance from as given by the BFS.
3. Output the distance between and in .
The output of for the tree shown in the given figure is __________. (Answer in integer)
Answer: 6
This is the double-BFS method for the diameter of a tree (the longest path between two vertices). For a tree, the vertex farthest from any start vertex is always one end of a longest path, so the second BFS gives the diameter.
Name the vertices in the figure. Let be the upper-left vertex of degree 4 and the lower-centre vertex of degree 4, joined by an edge. From : one branch goes down-left through a vertex to a leaf ; another goes up-right to a vertex with two leaves; the rest are single leaves. From : two single leaves, and a branch to a fork vertex . From : one leaf, and a path to the far-right leaf .
Longest path: . This has 7 vertices, so 6 edges. The path from either leaf of , , also has 6 edges, and no path is longer.
Step 1: BFS from any ends at a farthest vertex . This is always a tip of a longest branch, for example (or or a leaf of ).
Step 2: BFS from reaches and the leaves of at distance 6, and nothing is farther. So the output is 6.
Answer: 6
Name the vertices in the figure. Let be the upper-left vertex of degree 4 and the lower-centre vertex of degree 4, joined by an edge. From : one branch goes down-left through a vertex to a leaf ; another goes up-right to a vertex with two leaves; the rest are single leaves. From : two single leaves, and a branch to a fork vertex . From : one leaf, and a path to the far-right leaf .
Longest path: . This has 7 vertices, so 6 edges. The path from either leaf of , , also has 6 edges, and no path is longer.
Step 1: BFS from any ends at a farthest vertex . This is always a tip of a longest branch, for example (or or a leaf of ).
Step 2: BFS from reaches and the leaves of at distance 6, and nothing is farther. So the output is 6.
Answer: 6
Let . For , let be the product of symbols in modulo 7. We take , where is the null string.
For example, .
Define
The number of states in a minimum state DFA for is ___________. (Answer in integer)
For example, .
Define
The number of states in a minimum state DFA for is ___________. (Answer in integer)
Answer: 6
Since 7 is prime and none of 1, 2, 3, 4 is a multiple of 7, the running product mod 7 is never 0. It always lies in . Let each DFA state be the product so far mod 7. The start state is 1 (because ), reading a symbol moves from to , and the only accepting state is 2.
All 6 states are reachable. Reading 3 again and again gives the products , which covers every nonzero residue.
No two states are equivalent. Take states . Every nonzero residue is the product of some string, so pick a string with (the inverse exists since 7 is prime). From this ends at , which accepts. From it ends at , which rejects.
So no state can be merged, and the minimal DFA has 6 states.
Answer: 6
All 6 states are reachable. Reading 3 again and again gives the products , which covers every nonzero residue.
No two states are equivalent. Take states . Every nonzero residue is the product of some string, so pick a string with (the inverse exists since 7 is prime). From this ends at , which accepts. From it ends at , which rejects.
So no state can be merged, and the minimal DFA has 6 states.
Answer: 6