GATE 2024 (Session 1)
65 questions
MCQ 29 · MSQ 20 · NAT 161-mark 30 · 2-mark 35
Questions 36–40 of 65
Consider a network path between nodes and via router . Node sends a file of size bytes to via this path by splitting the file into chunks of bytes each. Node sends these chunks one after the other without any wait time between the successive chunk transmissions. Assume that the size of extra headers added to these chunks is negligible, and that the chunk size is less than the MTU.
Each of the links and has a bandwidth of , and negligible propagation latency. Router immediately transmits every packet it receives from to , with negligible processing and queueing delays. Router can simultaneously receive on link and transmit on .
Assume P starts transmitting the chunks at time . Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which receives all the chunks of the file?
Each of the links and has a bandwidth of , and negligible propagation latency. Router immediately transmits every packet it receives from to , with negligible processing and queueing delays. Router can simultaneously receive on link and transmit on .
Assume P starts transmitting the chunks at time . Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which receives all the chunks of the file?
Answer: (B)
The file has chunks. Every chunk bits long, so one chunk takes ms to send on a link.
P sends the chunks one after another with no gap. P finishes sending the last chunk at s.
Q passes on each chunk while it receives the next one. So only the last chunk needs one extra 8 ms transmission on Q-R.
Total time: s.
Answer: 8.008
P sends the chunks one after another with no gap. P finishes sending the last chunk at s.
Q passes on each chunk while it receives the next one. So only the last chunk needs one extra 8 ms transmission on Q-R.
Total time: s.
Answer: 8.008
Consider the following syntax-directed definition (SDD).
Given "MMLK" as the input, which one of the following options is the CORRECT value computed by the SDD (in the attribute S.val)?
Given "MMLK" as the input, which one of the following options is the CORRECT value computed by the SDD (in the attribute S.val)?
Answer: (A)
The input "MMLK" gives the split D = "MM", H = "L", T = , U = "K".
Now find each value:
- Value of :
- Value of :
- Value of is
- Value of :
Add all the values:
Answer: 45
Now find each value:
- Value of :
- Value of :
- Value of is
- Value of :
Add all the values:
Answer: 45
Consider the following grammar , with as the start symbol. The grammar has three incomplete productions denoted by (1), (2), and (3).
The set of terminals is . The FIRST and FOLLOW sets of the different non-terminals are as follows.
Which one of the following options CORRECTLY fills in the incomplete productions?
The set of terminals is . The FIRST and FOLLOW sets of the different non-terminals are as follows.
Which one of the following options CORRECTLY fills in the incomplete productions?
Answer: (A)
Fill each blank so that the given FIRST and FOLLOW sets come out right.
(1) , but gives only . So (1) must give and . gives because can be empty. gives only .
(2) and , give only , so (2) is . would put in .
(3) and is already there, so (3) starts with . Try .
Check FOLLOW with , , , :
- : is followed by in , and it is last in (adds nothing new). So .
- : in , is followed by , so . Since can be empty, also . From , , and from , . So .
- is the start symbol, so .
- Putting these together, , as given.
With instead, nothing would put after , so would be missing from .
Answer: (A)
(1) , but gives only . So (1) must give and . gives because can be empty. gives only .
(2) and , give only , so (2) is . would put in .
(3) and is already there, so (3) starts with . Try .
Check FOLLOW with , , , :
- : is followed by in , and it is last in (adds nothing new). So .
- : in , is followed by , so . Since can be empty, also . From , , and from , . So .
- is the start symbol, so .
- Putting these together, , as given.
With instead, nothing would put after , so would be missing from .
Answer: (A)
Consider the following pseudo-code.
Which of of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively?
Which of of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively?
Answer: (D)
Leaders: the first instruction (L1), the jump targets (L3, L4, L11), and the instructions right after a conditional jump (L10, L13, L15).
Basic blocks:
- B1: L1-L2 (2)
- B2: L3 (1)
- B3: L4-L9 (6)
- B4: L10 (1)
- B5: L11-L12 (2)
- B6: L13-L14 (2)
- B7: L15 (1)
There are 7 basic blocks. The largest, B3, has 6 instructions.
Answer: 7 and 6
Basic blocks:
- B1: L1-L2 (2)
- B2: L3 (1)
- B3: L4-L9 (6)
- B4: L10 (1)
- B5: L11-L12 (2)
- B6: L13-L14 (2)
- B7: L15 (1)
There are 7 basic blocks. The largest, B3, has 6 instructions.
Answer: 7 and 6
Consider the following two threads and that update two shared variables and . Assume that initially . Though context switching between threads can happen at any time, each statement of or is executed atomically without interruption.
Which one of the following options lists all the possible combinations of values of and after both and finish execution?
Which one of the following options lists all the possible combinations of values of and after both and finish execution?
Answer: (A)
The final a is set by which a-update runs first. The final b is set by which b-update runs first.
- a: if T1 updates first, else .
- b: if T1 updates first, else .
- T1 then T2 gives (4, 4). T2 then T1 gives (3, 3).
- T1: a=a+1, T2: b=2b, T2: a=2a, T1: b=b+1 (4, 3).
- (3, 4) cannot happen. It needs T2's a-update before T1's a-update, and T1's b-update before T2's b-update. But T1 does a before b, and T2 does b before a, so this makes a cycle.
Answer: (a=4, b=4); (a=3, b=3); (a=4, b=3)
- a: if T1 updates first, else .
- b: if T1 updates first, else .
- T1 then T2 gives (4, 4). T2 then T1 gives (3, 3).
- T1: a=a+1, T2: b=2b, T2: a=2a, T1: b=b+1 (4, 3).
- (3, 4) cannot happen. It needs T2's a-update before T1's a-update, and T1's b-update before T2's b-update. But T1 does a before b, and T2 does b before a, so this makes a cycle.
Answer: (a=4, b=4); (a=3, b=3); (a=4, b=3)