GATE 2024 (Session 1) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2024 (Session 1)

65 questions

MCQ 29 · MSQ 20 · NAT 161-mark 30 · 2-mark 35

Questions 36–40 of 65

Q36Physical Layer2 marksMCQ−0.67 if wrong
Consider a network path P−Q−R\mathrm{P}-\mathrm{Q}-\mathrm{R} between nodes P\mathrm{P} and R\mathrm{R} via router Q\mathrm{Q}. Node P\mathrm{P} sends a file of size 10610^6 bytes to RR via this path by splitting the file into chunks of 10310^3 bytes each. Node PP 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 P−Q\mathrm{P}-\mathrm{Q} and Q−R\mathrm{Q}-\mathrm{R} has a bandwidth of 106bits/sec10^6 \mathrm{bits} / \mathrm{sec}, and negligible propagation latency. Router QQ immediately transmits every packet it receives from PP to RR, with negligible processing and queueing delays. Router QQ can simultaneously receive on link P−QP-Q and transmit on link⁡Q−R\operatorname{link} Q-R.
Assume P starts transmitting the chunks at time t=0t=0. Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which R\mathrm{R} receives all the chunks of the file?

Q37Syntax-directed Translation2 marksMCQ−0.67 if wrong
Consider the following syntax-directed definition (SDD).

S→DHTU{S.val=D.val+H.val+T.val+U.val;}D→"M"D1{D.val=5+D1.val;}D→ϵ{D.val=−5;}H→"L"H1{H.val=5∗10+H1.val;}H→ϵ{H.val=−10;}T→"C"T1{T.val=5∗100+T1.val;}T→ϵ{T.val=−5;}U→"K"{U.val=5;}\begin{array}{|l|l|} \hline S \rightarrow DHTU & \{ S.val = D.val + H.val + T.val + U.val; \} \\ \hline D \rightarrow "M"D_1 & \{ D.val =5+D_1 . val; \} \\ \hline D \rightarrow \epsilon & \{ D.val =-5 ;\} \\ \hline H \rightarrow "L" H_1 & \{ H.val =5 * 10+H_1 . val; \} \\ \hline H \rightarrow \epsilon & \{ H.val =-10 ;\} \\ \hline T \rightarrow "C" T_1 & \{T . v a l=5 * 100+T_1 . val; \} \\ \hline T \rightarrow \epsilon & \{T . v a l=-5 ;\} \\ \hline U \rightarrow "K" & \{ U.val =5 ;\} \\ \hline \end{array}

Given "MMLK" as the input, which one of the following options is the CORRECT value computed by the SDD (in the attribute S.val)?

Q38Parsing2 marksMCQ−0.67 if wrong
Consider the following grammar GG, with SS as the start symbol. The grammar GG has three incomplete productions denoted by (1), (2), and (3).

S→daT∣(1)T→aS∣bT∣(2)R→ (3) ∣ϵ\begin{aligned} & S \rightarrow d a T \mid \quad(1) \\ & T \rightarrow a S|b T|(2) \\ & R \rightarrow \text { (3) } \mid \epsilon \end{aligned}

The set of terminals is {a,b,c,d,f}\{a, b, c, d, f\}. The FIRST and FOLLOW sets of the different non-terminals are as follows.

FIRST⁡(S)={c,d,f},FIRST⁡(T)={a,b,ϵ},FIRST⁡(R)={c,ϵ}FOLLOW⁡(S)=FOLLOW⁡(T)={c,f,$},FOLLOW⁡(R)={f}\begin{aligned} & \operatorname{FIRST}(S)=\{c, d, f\}, \operatorname{FIRST}(T)=\{a, b, \epsilon\}, \operatorname{FIRST}(R)=\{c, \epsilon\} \\ & \operatorname{FOLLOW}(S)=\operatorname{FOLLOW}(T)=\{c, f, \$\}, \operatorname{FOLLOW}(R)=\{f\} \end{aligned}

Which one of the following options CORRECTLY fills in the incomplete productions?

Q39Intermediate Code Generation2 marksMCQ−0.67 if wrong
Consider the following pseudo-code.
L1:t1=−1L2:t2=0L3:t3=0L4:t4=4∗t3L5:t5=4∗t2L6:t6=t5∗ML7:t7=t4+t6L8:t8=a[t7]L9:if  t8<=max  goto  L11L10:t1=t8L11:t3=t3+1L12:if  t3<M  gotoL4L13:t2=t2+1L14:if  t2<N  goto  L3L15:max=t1\begin{array}{ll} L 1: & t 1=-1 \\ L 2: & t 2=0 \\ L 3: & t 3=0 \\ L 4: & t 4=4 * t 3 \\ L 5: & t 5=4 * t 2 \\ L 6: & t 6=t 5 * M \\ L 7: & t 7=t 4+t 6 \\ L 8: & t 8=a[t 7] \\ L 9: & if \; t 8 \lt = max \; goto \; L 11 \\ L 10: & t 1=t 8 \\ L 11: & t 3=t 3+1 \\ L 12: & if \; t 3 \lt M \; goto L 4 \\ L 13: & t 2=t 2+1 \\ L 14: & if \; t 2 \lt N \; goto \; L 3 \\ L 15: & max =t 1 \end{array}
Which of of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively?

Q40Process Synchronization2 marksMCQ−0.67 if wrong
Consider the following two threads T1\mathrm{T} 1 and T2\mathrm{T} 2 that update two shared variables a\mathrm{a} and b\mathrm{b}. Assume that initially a=b=1\mathrm{a}=\mathrm{b}=1. Though context switching between threads can happen at any time, each statement of T1\mathrm{T} 1 or T2\mathrm{T} 2 is executed atomically without interruption.

T1 T2a=a+1;b=2∗b;b=b+1;a=2∗a;\begin{array}{cc} \mathrm{T} 1 & \mathrm{~T} 2 \\ \mathrm{a}=\mathrm{a}+1 ; & \mathrm{b}=2*\mathrm{b} ; \\ \mathrm{b}=\mathrm{b}+1 ; & \mathrm{a}=2*\mathrm{a} ; \end{array}

Which one of the following options lists all the possible combinations of values of a\mathrm{a} and b\mathrm{b} after both T1\mathrm{T} 1 and T2\mathrm{T} 2 finish execution?