GATE 2025 (Session 2)
65 questions
MCQ 32 · MSQ 18 · NAT 151-mark 30 · 2-mark 35
Questions 36–40 of 65
Suppose we are transmitting frames between two nodes using the Stop-and-Wait protocol. The frame size is 3000 bits. The transmission rate of the channel is 2000 bps (bits/second) and the propagation delay between the two nodes is 100 milliseconds. Assume that the processing times at the source and destination are negligible. Also, assume that the size of the acknowledgment packet is negligible. Which ONE of the following most accurately gives the channel utilization for the above scenario in percentage?
Answer: (A)
The time to transmit one frame is s. The one-way propagation delay is s.
In Stop-and-Wait, after the sender sends a frame, it has to wait for a full round trip before it sends the next one. The time to send the ack and the processing time are negligible:
Utilization
Answer: 88.23
In Stop-and-Wait, after the sender sends a frame, it has to wait for a full round trip before it sends the next one. The time to send the ack and the processing time are negligible:
Utilization
Answer: 88.23
Let be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant is added to the weight of every edge.
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in before and after the edge weight update?
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in before and after the edge weight update?
Answer: (C)
If we add the same positive constant to every edge, the total weight of any spanning tree goes up by exactly . This is because every spanning tree has exactly edges, the same number. The shift is the same for all trees, so it does not change which spanning tree has the minimum total weight. So every MST remains an MST.
Shortest paths are different. A path can have a different number of edges depending on the route. A path with fewer edges gets a smaller total addition of than a path with more edges. This can change which path is the shortest after the update. So SPs need not remain SPs.
Answer: Every MST remains an MST, and SPs need not remain SPs.
Shortest paths are different. A path can have a different number of edges depending on the route. A path with fewer edges gets a smaller total addition of than a path with more edges. This can change which path is the shortest after the update. So SPs need not remain SPs.
Answer: Every MST remains an MST, and SPs need not remain SPs.
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?
Answer: (A)
P (unsorted doubly linked list with head and tail pointers): Join the tail of the first list to the head of the second list, then update the tail pointer. This takes only a fixed number of pointer updates. Time: .
Q (array-based min-heap): Take two heaps of size . Join their arrays into one array, then run the usual bottom-up build-heap. Build-heap itself runs in linear time. Time: , and not .
R (Binary Search Tree): First, do an inorder traversal of each BST to get a sorted list (linear time). Next, merge the two sorted lists (linear time). Last, build a balanced BST from the merged list (linear time). The whole meld can be done in .
Answer: P: Θ(1), Q: Θ(n), R: Θ(n)
Q (array-based min-heap): Take two heaps of size . Join their arrays into one array, then run the usual bottom-up build-heap. Build-heap itself runs in linear time. Time: , and not .
R (Binary Search Tree): First, do an inorder traversal of each BST to get a sorted list (linear time). Next, merge the two sorted lists (linear time). Last, build a balanced BST from the merged list (linear time). The whole meld can be done in .
Answer: P: Θ(1), Q: Θ(n), R: Θ(n)
For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block.
Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
Answer: (A)
The block size byte . So the offset field has bits. The index is bits and the tag is bits. The total address width bits.
Main memory size bytes, which KB.
Cache size (number of lines) (block size) bytes, which KB.
Answer: 64 KB and 4 KB
Main memory size bytes, which KB.
Cache size (number of lines) (block size) bytes, which KB.
Answer: 64 KB and 4 KB
Given a Context-Free Grammar as follows:
Which ONE of the following statements is TRUE?
Which ONE of the following statements is TRUE?
Answer: (C)
Here , since gives and gives .
Item sets after reading :
- From the start state: .
- After then : .
SLR(1): in the first state, SLR reduces on every symbol of , including . But the item says to shift . That is a shift-reduce conflict. (The second state has the same problem on .) So the grammar is not SLR(1).
LALR(1): the lookahead of is taken from the context of that state. In the first state, comes from , so the lookahead is only and there is no conflict with shifting . In the second state, comes from , so the lookahead is only and there is no conflict with shifting . The two states have different cores, so LALR does not merge them. So the grammar is LALR(1) (and also CLR(1)).
Answer: (C)
Item sets after reading :
- From the start state: .
- After then : .
SLR(1): in the first state, SLR reduces on every symbol of , including . But the item says to shift . That is a shift-reduce conflict. (The second state has the same problem on .) So the grammar is not SLR(1).
LALR(1): the lookahead of is taken from the context of that state. In the first state, comes from , so the lookahead is only and there is no conflict with shifting . In the second state, comes from , so the lookahead is only and there is no conflict with shifting . The two states have different cores, so LALR does not merge them. So the grammar is LALR(1) (and also CLR(1)).
Answer: (C)