GATE 2018
65 questions
MCQ 41 · NAT 241-mark 30 · 2-mark 35
Questions 31–35 of 65
Consider the following C program:
#include <stdio.h>
int counter = 0;
int calc (int a, int b) {
int c;
counter++;
if (b==3) return (a*a*a);
else {
c = calc(a, b/3);
return (c*c*c);
}
}
int main (){
calc(4, 81);
printf ("%d", counter);
} The output of this program is _____.Answer: 4
The variable counter goes up by one in every call. The calls go like this: calc(4, 81) calc(4, 27) calc(4, 9) calc(4, 3), which is the base case. So there are 4 calls in total.
Answer: 4
Answer: 4
Consider the sequential circuit shown in the figure, where both flip-flops used are positive edge-triggered D flip-flops.
The number of states in the state transition diagram of this circuit that have a transition back to the same state on some value of "in" is _____.
The number of states in the state transition diagram of this circuit that have a transition back to the same state on some value of "in" is _____.
Answer: 2
The two D flip-flops work as a shift register. The next state is equal to (in, ). A state returns to itself only when in = = . These are state 00 (when in = 0) and state 11 (when in = 1).
Answer: 2
Answer: 2
A 32-bit wide main memory unit with a capacity of 1 GB is built using 256M x 4-bit DRAM chips. The number of rows of memory cells in the DRAM chip is . The time taken to perform one refresh operation is 50 nanoseconds. The refresh period is 2 milliseconds. The percentage (rounded to the closest integer) of the time available for performing the memory read/write operations in the main memory unit is __________.
Answer: 59 to 60
Each 256M 4 chip refreshes its rows, one row after another. This takes ns = 819.2 s in every 2 ms (all chips refresh in parallel).
Refresh uses 0.8192 / 2 = 40.96% of the time. So about 59% is left for read and write operations.
Answer: 59
Refresh uses 0.8192 / 2 = 40.96% of the time. So about 59% is left for read and write operations.
Answer: 59
Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is ____.
Answer: 2
No deadlock can happen if one instance is still free even when each process holds K 1 instances: .
Take K = 3. Then two processes could each hold 2 instances and wait for each other forever.
Answer: 2
Take K = 3. Then two processes could each hold 2 instances and wait for each other forever.
Answer: 2
Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= bits-per-second). The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closest integer) before this sequence number can be used again is _______.
Answer: 34 to 35
TCP gives a number to every byte. The sequence number is 32 bits long, so it starts again after bytes.
Time taken = s 34 s.
Answer: 34
Time taken = s 34 s.
Answer: 34