GATE 2021 (Session 1)
65 questions
MCQ 34 · MSQ 13 · NAT 181-mark 30 · 2-mark 35
Questions 31–35 of 65
Consider the following sequence of operations on an empty stack.
push(54); push(52); pop(); push(55); push(62); s=pop();
Consider the following sequence of operations on an empty queue.
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q=dequeue();
The value of s+q is ___________.
push(54); push(52); pop(); push(55); push(62); s=pop();
Consider the following sequence of operations on an empty queue.
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q=dequeue();
The value of s+q is ___________.
Answer: 86
Stack: push 54, push 52, then pop (this removes 52). Next push 55 and push 62. The last pop gives s = 62.
Queue: enqueue 21 and 24, then dequeue (this removes 21). Next enqueue 28 and 32. The last dequeue gives q = 24.
So s + q = 86
Answer: 86
Queue: enqueue 21 and 24, then dequeue (this removes 21). Next enqueue 28 and 32. The last dequeue gives q = 24.
So s + q = 86
Answer: 86
Consider a computer system with a byte-addressable primary memory of size . Assume the computer system has a direct-mapped cache of size , and each cache block is of size 64 bytes.
The size of the tag field is __________ bits.
The size of the tag field is __________ bits.
Answer: 17
Number of cache lines = 32 KB / 64 B = 512 so the index is 9 bits. The block offset is 6 bits.
Tag = 32 9 6 = 17 bits
Answer: 17
Tag = 32 9 6 = 17 bits
Answer: 17
A relation in a relational database has 1200 tuples. The attribute has integer values ranging from 6 to 20, and the attribute has integer values ranging from 1 to 20. Assume that the attributes and are independently distributed.
The estimated number of tuples in the output of is ____________
The estimated number of tuples in the output of is ____________
Answer: 820
Estimate the fraction of tuples that pass the condition, then multiply by the number of tuples.
- has 15 values (6 to 20). The values 11 to 20 satisfy , so .
- has 20 values, so .
- and are independent, so
Estimated tuples in the output: .
(Counting the different value pairs that satisfy the condition, , does not give the number of tuples.)
Answer: 820
- has 15 values (6 to 20). The values 11 to 20 satisfy , so .
- has 20 values, so .
- and are independent, so
Estimated tuples in the output: .
(Counting the different value pairs that satisfy the condition, , does not give the number of tuples.)
Answer: 820
Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
S:1
E:10000001
F:11110000000000000000000
Here, S,E and F denote the sign, exponent, and fraction components of the floating point representation.
The decimal value corresponding to the above representation (rounded to 2 decimal places) is ____________.
S:1
E:10000001
F:11110000000000000000000
Here, S,E and F denote the sign, exponent, and fraction components of the floating point representation.
The decimal value corresponding to the above representation (rounded to 2 decimal places) is ____________.
Answer: -7.75
Exponent: 129 127 = 2.
Mantissa: 1.1111 = 1 + 0.5 + 0.25 + 0.125 + 0.0625 = 1.9375.
The sign bit is 1, so the number is negative.
Final value:
Answer: -7.75
Mantissa: 1.1111 = 1 + 0.5 + 0.25 + 0.125 + 0.0625 = 1.9375.
The sign bit is 1, so the number is negative.
Final value:
Answer: -7.75
Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.
Answer: 12
Shortest job first gives the least average waiting time. Run the jobs in the order 10, 16, 20:
The waiting times are 0, 10 and 26 so the average = 36 / 3 = 12 ms.
Answer: 12
The waiting times are 0, 10 and 26 so the average = 36 / 3 = 12 ms.
Answer: 12