GATE 2024 (Session 1)
65 questions
MCQ 29 · MSQ 20 · NAT 161-mark 30 · 2-mark 35
Questions 56–60 of 65
A given program has 25% load/store instructions. Suppose the ideal CPI (cycles per instruction) without any memory stalls is 2. The program exhibits 2% miss rate on instruction cache and 8% miss rate on data cache. The miss penalty is 100 cycles. The speedup (rounded off to two decimal places) achieved with a perfect cache (i.e., with NO data or instruction cache misses) is _________
Answer: 3
Each instruction is fetched from the I-cache. Also, 25% of instructions use the D-cache for data.
Stall cycles for each instruction:
- I-cache:
- D-cache:
CPI with the real cache: . CPI with a perfect cache: .
Speedup:
Answer: 3
Stall cycles for each instruction:
- I-cache:
- D-cache:
CPI with the real cache: . CPI with a perfect cache: .
Speedup:
Answer: 3
Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors.
int x = 3;
while(x > 0) {
fork();
printf("hello");
wait(NULL);
x--;
} The total number of times the printf statement is executed is ___Answer: 14
In every iteration, each process that exists calls fork(). So the number of processes becomes double, and every one of them prints once. (wait() changes only the order of printing, not the count. Each child carries on with the loop using the current x.)
- x = 3: 1 2 processes, so 2 prints
- x = 2: 2 4 processes, so 4 prints
- x = 1: 4 8 processes, so 8 prints
Total prints:
Answer: 14
- x = 3: 1 2 processes, so 2 prints
- x = 2: 2 4 processes, so 4 prints
- x = 1: 4 8 processes, so 8 prints
Total prints:
Answer: 14
Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation "" in a prefix indicates a subnet mask with the most significant bits set to 1.
This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205. The number of packets forwarded via the next hop router is
This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205. The number of packets forwarded via the next hop router is
Answer: 40
Apply the longest prefix match rule. The last byte range of each prefix is:
/24 0-255 (R1), .128/25 128-255 (R2), .64/26 64-127 (R3), .192/26 192-255 (R4).
- 10.1.1.16 matches only /24 R1
- 10.1.1.72 matches /26 (64-127) R3
- 10.1.1.132 matches /25 R2
- 10.1.1.191 matches /25 (it is not in 192-255) R2
- 10.1.1.205 matches /26 (192-255) R4
R2 gets 2 hosts 20 packets each .
Answer: 40
/24 0-255 (R1), .128/25 128-255 (R2), .64/26 64-127 (R3), .192/26 192-255 (R4).
- 10.1.1.16 matches only /24 R1
- 10.1.1.72 matches /26 (64-127) R3
- 10.1.1.132 matches /25 R2
- 10.1.1.191 matches /25 (it is not in 192-255) R2
- 10.1.1.205 matches /26 (192-255) R4
R2 gets 2 hosts 20 packets each .
Answer: 40
Let be a context-free grammar in Chomsky Normal Form with and containing 10 variable symbols including the start symbol . The string is derivable from . The number of steps (application of rules) in the derivation is _____
Answer: 179
A CNF rule has the form or .
- A rule adds 1 symbol each time. Going from 1 symbol (S) to symbols takes steps.
- Then each of the variables becomes a terminal using . That takes steps.
Total: . Here , so .
Answer: 179
- A rule adds 1 symbol each time. Going from 1 symbol (S) to symbols takes steps.
- Then each of the variables becomes a terminal using . That takes steps.
Total: . Here , so .
Answer: 179
The number of edges present in the forest generated by the DFS traversal of an undirected graph with 100 vertices is 40 . The number of connected components in is ____
Answer: 60
DFS gives one tree for each connected component. A tree with vertices has edges. So a forest with vertices and trees has edges.
Put in the given values:
Answer: 60
Put in the given values:
Answer: 60