GATE 2016 (Session 2)
65 questions
MCQ 38 · NAT 271-mark 30 · 2-mark 35
Questions 41–45 of 65
Consider a processor with 64 registers and an instruction set of size twelve. Each instruction has five distinct fields, namely, opcode, two source register identifiers, one destination register identifier, and a twelve-bit immediate value. Each instruction must be stored in memory in byte-aligned fashion. If a program has 100 instructions, the amount of memory(in bytes) consumed by the program text is _____ .
Answer: 500
Let us go through each field:
- Opcode: 12 instructions 4 bits
- Three register fields: 64 registers 6 bits each, so 18 bits in all
- Immediate value: 12 bits
Sum = 34 bits with byte alignment, 5 bytes for each instruction. For 100 instructions: 100 5 = 500 bytes.
Answer: 500
- Opcode: 12 instructions 4 bits
- Three register fields: 64 registers 6 bits each, so 18 bits in all
- Immediate value: 12 bits
Sum = 34 bits with byte alignment, 5 bytes for each instruction. For 100 instructions: 100 5 = 500 bytes.
Answer: 500
The width of the physical address on a machine is 40 bits. The width of the tag field in a 512KB 8-way set associative cache is ________ bits.
Answer: 24
Size of one way = 512 KB / 8 = 64 KB = bytes. So the index and offset bits together are 16 bits.
Tag bits = 40 16 = 24 bits
Answer: 24
Tag bits = 40 16 = 24 bits
Answer: 24
Consider a 3GHz (gigahertz) processor with a three-stage pipeline and stage latencies , , and such that . If the longest pipeline stage is split into two pipeline stages of equal latency, the new frequency is _____GHz, ignoring delays in the pipeline registers.
Answer: 3.9 to 4.1
Take . Then and . The longest stage is 8k, and it fixes the clock at 3 GHz.
Now cut into two stages of 4k each. After this, the longest stage is .
New frequency: GHz
Answer: 4
Now cut into two stages of 4k each. After this, the longest stage is .
New frequency: GHz
Answer: 4
A complete binary min-heap is made by including each integer in [1,1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is_____. .
Answer: 8
In a min-heap, every ancestor of 9 has to be smaller than 9. Only the numbers 1 to 8 are smaller. So 9 can have at most 8 ancestors the depth is at most 8. This can happen: place 1, 2, , 8, 9 along one path (the heap with 1023 nodes has depths 0 to 9).
Answer: 8
Answer: 8
The following function computes for positive integers X and Y.
int exp(int X,int Y){
int res=1, a=X, b=Y;
while (b!=0){
if(b%2==0){a=a*a; b=b/2;}
else {res=res*a; b=b-1;}
}
return res;
} Which one of the following conditions is TRUE before every iteration of the loop?Answer: (C)
Show that always equals :
- At the start: holds.
- When b is even: , and holds.
- When b is odd: , and holds.
At b = 0, res = .
Answer:
- At the start: holds.
- When b is even: , and holds.
- When b is odd: , and holds.
At b = 0, res = .
Answer: