GATE 2001
60 questions
MCQ 601-mark 60
Questions 21–25 of 60
Consider the following circuit with initial state Q0 = Q1 = 0. The D flip-flops are positive edged triggered and have set up times 20 nanosecond and hold times 0.
Answer: (A)
Read the circuit: , and . Both flip-flops change only at a rising clock edge. The clock period is at least 40 ns, more than the 20 ns setup time, so each edge sees steady inputs. Start with .
Edge 1: (it rises only after this edge), so and . stays 0.
Edge 2: and , so and becomes 1. becomes 1, so becomes 0.
Edge 3: but , so and goes back to 0. ( fell to 0 before this edge, but changes only at the edge.)
Later edges: while , stays 0, so . After falls, because . So never goes to 1 again.
So is high for exactly one clock period, from the second edge to the third. Waveform (a) is a one-period pulse that starts at the second edge. Waveform (c) is also a one-period pulse, but it starts near the first edge, where is still 0. Waveforms (b) and (d) are high for several periods, which cannot happen.
Note: the option waveforms are drawn on their own time scale, not aligned to the clock diagram, as in the original paper. Only (a) and (c) have the correct one-clock-wide pulse shape, and the official key is (a).
Answer: (A)
Edge 1: (it rises only after this edge), so and . stays 0.
Edge 2: and , so and becomes 1. becomes 1, so becomes 0.
Edge 3: but , so and goes back to 0. ( fell to 0 before this edge, but changes only at the edge.)
Later edges: while , stays 0, so . After falls, because . So never goes to 1 again.
So is high for exactly one clock period, from the second edge to the third. Waveform (a) is a one-period pulse that starts at the second edge. Waveform (c) is also a one-period pulse, but it starts near the first edge, where is still 0. Waveforms (b) and (d) are high for several periods, which cannot happen.
Note: the option waveforms are drawn on their own time scale, not aligned to the clock diagram, as in the original paper. Only (a) and (c) have the correct one-clock-wide pulse shape, and the official key is (a).
Answer: (A)
The 2's complement representation of is hexadecimal is
Answer: (C)
All the options have 12 bits, so put two 0's in front.
For 2's complement, flip every bit left of the rightmost 1. The result is
Correct Answer:
Suppose a processor does not have any stack pointer register. Which of the following statements is true ?
Answer: (B)
A call has to save the return address, and the return instruction uses it to come back. Without a stack pointer, there is still a way to do this for one call: keep the return address in a fixed register or a fixed memory location (as a link register does). So a subroutine call instruction can exist, and (A) is wrong.
With nested calls, a second call is made before the first returns. It would write its return address into the same place and overwrite the first one, so the first subroutine could not return to its caller. A stack is what keeps many return addresses in order, so nested calls need one. So (B) is right.
(C) is wrong because nested calls are not possible. (D) is wrong for the same reason.
Answer: (B)
With nested calls, a second call is made before the first returns. It would write its return address into the same place and overwrite the first one, so the first subroutine could not return to its caller. A stack is what keeps many return addresses in order, so nested calls need one. So (B) is right.
(C) is wrong because nested calls are not possible. (D) is wrong for the same reason.
Answer: (B)
Which is the most appropriate match for the items in the first column with the
items in the second column
Answer: (A)
Match each addressing mode with its use:
- Indexed addressing (Y): the index register steps through the elements one by one, so it fits array implementation (I).
- Base register addressing (Z): the code is relocated by changing only the value in the base register, so it fits writing re-locatable code (II).
- Indirect addressing (X): when an array is passed as a parameter, only its address (a pointer) is passed. The address is then followed to reach the array, so it fits passing array as parameter (III).
So the pairs are (X, III), (Y, I), (Z, II).
Answer: (A)
- Indexed addressing (Y): the index register steps through the elements one by one, so it fits array implementation (I).
- Base register addressing (Z): the code is relocated by changing only the value in the base register, so it fits writing re-locatable code (II).
- Indirect addressing (X): when an array is passed as a parameter, only its address (a pointer) is passed. The address is then followed to reach the array, so it fits passing array as parameter (III).
So the pairs are (X, III), (Y, I), (Z, II).
Answer: (A)
Consider the following data path of a simple non-pipelined CPU. The registers A, B, A1, A2, MDR, the bus and the ALU are 8-bit wide. SP and MAR are 16- bit registers. The MUX is of size 8x(2:1) and the DEMUX is of size 8x(1:2). Each memory operation takes 2 CPU clock cycles and uses MAR (Memory Address Register) and MDR (Memory Data Register). SP can be decremented locally.
The CPU instruction "push r", where r = A or B, has the specification
M[SP] r
SP SP - 1
How many CPU clock cycles are needed to execute the "push r" instruction ?
The CPU instruction "push r", where r = A or B, has the specification
M[SP] r
SP SP - 1
How many CPU clock cycles are needed to execute the "push r" instruction ?
Answer: (D)
Here "push r" stores the register r into memory at the address in SP, and then decrements SP.
Facts from the data path: there is one 8-bit bus, SP and MAR are 16-bit, and each memory operation takes 2 clock cycles.
1. : MUX puts the low byte of SP on the bus, and DEMUX loads it into the low half of MAR.
2. : the same for the high byte of SP and the high half of MAR. So takes 2 cycles.
3. : over the bus. It cannot be done earlier, because the bus is busy in and .
4. : memory write , which takes 2 cycles.
SP can be decremented locally, so runs in parallel with one of these cycles and adds none.
Total cycles.
Answer: (D)
Facts from the data path: there is one 8-bit bus, SP and MAR are 16-bit, and each memory operation takes 2 clock cycles.
1. : MUX puts the low byte of SP on the bus, and DEMUX loads it into the low half of MAR.
2. : the same for the high byte of SP and the high half of MAR. So takes 2 cycles.
3. : over the bus. It cannot be done earlier, because the bus is busy in and .
4. : memory write , which takes 2 cycles.
SP can be decremented locally, so runs in parallel with one of these cycles and adds none.
Total cycles.
Answer: (D)