GATE 2016 (Session 1)
65 questions
MCQ 39 · NAT 261-mark 30 · 2-mark 35
Questions 41–45 of 65
The size of the data count register of a DMA controller is 16 bits. The processor needs to transfer a file of 29,154 kilobytes from disk to main memory. The memory is byte addressable. The minimum number of times the DMA controller needs to get the control of the system bus from the processor to transfer the file from the disk to main memory is ____.
Answer: 456
The data count register has 16 bits. So in one bus grab, the DMA can transfer at most bytes = 64 KB.
Number of times the DMA needs the bus:
Answer: 456
Number of times the DMA needs the bus:
Answer: 456
The stage delays in a 4-stage pipeline are 800,500,400 and 300 picoseconds.The first stage (with delay 800 picoseconds)is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds.The throughput increase of the pipeline is ________ percent.
Answer: 33 to 34
Throughput equals 1 divided by the delay of the slowest stage.
- Before: the largest delay is 800 ps.
- After: the stages are 600, 350, 500, 400, 300 so the largest delay is 600 ps.
Percentage increase:
Answer: 33.33
- Before: the largest delay is 800 ps.
- After: the stages are 600, 350, 500, 400, 300 so the largest delay is 600 ps.
Percentage increase:
Answer: 33.33
Consider a carry lookahead adder for adding two n-bit integers,built using gates of fan-in at most two. The time to perform addition using this adder is
Answer: (B)
A carry lookahead adder finds every carry from the generate and propagate signals. The gates have fan-in 2, so joining n signals takes a tree whose depth is .
Answer:
Answer:
The following function computes the maximum value contained in an integer array p[] of size n (n>=1).
int max(int*p, int n){
int a=0,b=n-1;
while (__________){
if (p[a]<=p[b]){a=a+1;}
else {b=b-1;}
}
return p[a];
} The missing loop condition isAnswer: (D)
Two pointers start at the two ends of the array. In each step, the smaller of p[a] and p[b] is dropped, so the maximum is never dropped. The loop must stop when only one element is left, that is, when a and b become equal.
The loop condition is: b != a.
Answer: b != a
The loop condition is: b != a.
Answer: b != a
What will be the output of the following C program?
void count(int n){
static int d=1;
printf("%d ",n);
printf("%d ",d);
d++;
if(n>1) count(n-1);
printf("%d ",d);
}
void main(){
count(3);
}Answer: (A)
d is static, so there is only one copy and it starts at 1.
- count(3): prints 3, 1; d becomes 2; calls count(2)
- count(2): prints 2, 2; d becomes 3; calls count(1)
- count(1): prints 1, 3; d becomes 4; prints 4
- Back in count(2): prints 4. Back in count(3): prints 4
Output: 3 1 2 2 1 3 4 4 4
Answer: 312213444
- count(3): prints 3, 1; d becomes 2; calls count(2)
- count(2): prints 2, 2; d becomes 3; calls count(1)
- count(1): prints 1, 3; d becomes 4; prints 4
- Back in count(2): prints 4. Back in count(3): prints 4
Output: 3 1 2 2 1 3 4 4 4
Answer: 312213444