GATE 2004
199 questions
MCQ 1991-mark 199
Questions 81–85 of 199
In an enhancement of a design of a CPU, the speed of a floating point unit has been increased by 20% and the speed of a fixed point unit has been increased by 10%. What is the overall speedup achieved if the ratio of the number of floating point operations to the number of fixed point operations is 2:3 and the floating point operation used to take twice the time taken by the fixed point operation in the original design?
Answer: (A)
Speedup
Take as the time of one fixed point operation.
Time before the change:
Time after the change:
Now the speedup
Correct Answer:
Take as the time of one fixed point operation.
Time before the change:
Time after the change:
Now the speedup
Correct Answer:
Consider a pipeline processor with 4 stages S1 to S4. We want to execute the following loop:
The output of I1 for i = 2 will be available after
for (i = 1; i < = 1000; i++)
{I1, I2, I3, I4}
where the time taken (in ns) by instructions I1 to I4 for stages S1 to S4 are given below:The output of I1 for i = 2 will be available after
Answer: (C)
Each cycle is 1 ns. A stage handles one instruction at a time, and an instruction stays in its stage (shown as --) until the next stage is free. The row I1 (i = 2) is the first instruction of the second loop pass, so it comes right after I4 of the first pass.
Some steps: I3 finishes S2 in t5 but S3 is busy with I2 until t6, so it waits in t6. I4 cannot enter S2 before I3 leaves it, and I1 (i = 2) in turn waits in S1 in t8. I1 (i = 2) does S2 in t9 to t10 (2 ns), S3 in t11, and S4 in t12 to t13 (2 ns).
The output of I1 for i = 2 is ready at the end of t13, which is 13 ns.
Answer: (C)
Some steps: I3 finishes S2 in t5 but S3 is busy with I2 until t6, so it waits in t6. I4 cannot enter S2 before I3 leaves it, and I1 (i = 2) in turn waits in S1 in t8. I1 (i = 2) does S2 in t9 to t10 (2 ns), S3 in t11, and S4 in t12 to t13 (2 ns).
The output of I1 for i = 2 is ready at the end of t13, which is 13 ns.
Answer: (C)
A 4-stage pipeline has the stage delays as 150, 120, 160 and 140 nanoseconds respectively. Registers that are used between the stages have a delay of 5 nanoseconds each. Assuming constant clocking rate, the total time taken to process 1000 data items on this pipeline will be
Answer: (C)
In a pipeline, all stages must work in step. So every stage is made as long as the slowest stage, which here is . The delay of the register between stages must be added too. Here it is . This gives a clock period of
The first instruction takes this time: ns.
After that, one instruction finishes in every ns. So,
The total time for instructions microseconds.
Correct Answer:
The first instruction takes this time: ns.
After that, one instruction finishes in every ns. So,
The total time for instructions microseconds.
Correct Answer:
Consider the following program segment for a hypothetical CPU having three user registers R1, R2 and R3.
Let the clock cycles required for various operations be as follows:
Register to/from memory transfer : 3 clock cycles
ADD with both operands in register : 1 clock cycle
Instruction fetch and decode : 2 clock cycles per word
The total number of clock cycles required to execute the program is
Let the clock cycles required for various operations be as follows:
Register to/from memory transfer : 3 clock cycles
ADD with both operands in register : 1 clock cycle
Instruction fetch and decode : 2 clock cycles per word
The total number of clock cycles required to execute the program is
Answer: (B)
Each instruction costs 2 cycles for each word to fetch and decode, plus its execute time: 3 cycles for a register to or from memory transfer, 1 cycle for an ADD on registers, and 0 for HALT. The sizes (in words) come from the table in the question.
So the program takes clock cycles.
Answer: (B)
So the program takes clock cycles.
Answer: (B)
Let x be an integer which can take a value of 0 or 1. The statement
if (x == 0) x = 1; else x = 0; is equivalent to which one of the following ? Answer: (B)
The statement must turn 0 into 1 and 1 into 0. Check each option for and :
(A) : for it gives 2. Wrong.
(B) : for it gives 1, and for it gives 0. Correct.
(C) : for it gives . Wrong.
(D) : for it needs , a remainder on division by zero, which is undefined. Wrong.
Answer: (B)
(A) : for it gives 2. Wrong.
(B) : for it gives 1, and for it gives 0. Correct.
(C) : for it gives . Wrong.
(D) : for it needs , a remainder on division by zero, which is undefined. Wrong.
Answer: (B)