GATE 2004
199 questions
MCQ 1991-mark 199
Questions 66–70 of 199
Let A = 1111 1010 and B = 0000 1010 be two 8-bit 2's complement numbers. Their product in 2's complement is
Answer: (A)
Decode A: the sign bit is 1, so A is negative. Invert to get , add 1 to get . So .
B: .
Product: , which fits in 8 bits (range to ).
Encode : , invert to get , add 1 to get .
Answer: (A)
B: .
Product: , which fits in 8 bits (range to ).
Encode : , invert to get , add 1 to get .
Answer: (A)
What is the result of evaluating the following two expressions using three-digit floating point arithmetic with rounding?
(113. + - 111.) + 7.51
113. + (- 111. + 7.51)
(113. + - 111.) + 7.51
113. + (- 111. + 7.51)
Answer: (A)
Each result is rounded to three digits after every addition.
First expression:
, exactly.
, which already has three digits.
Second expression:
, which rounds to three digits as .
.
So the two expressions give 9.51 and 10.0, because rounding in the inner bracket loses the 0.49. This shows that floating point addition is not associative.
Answer: (A)
First expression:
, exactly.
, which already has three digits.
Second expression:
, which rounds to three digits as .
.
So the two expressions give 9.51 and 10.0, because rounding in the inner bracket loses the 0.49. This shows that floating point addition is not associative.
Answer: (A)
If (in base-x number system) is equal to (in base y-number system), the possible values of x and y are
Answer: (D)
Convert both numbers to decimal and equate: and , so
Try each option:
(A) :
(B) :
(C) :
(D) : . This works; both numbers equal 59, and the digits (7 in base 8, 5 in base 11) are valid.
Answer: (D)
Try each option:
(A) :
(B) :
(C) :
(D) : . This works; both numbers equal 59, and the digits (7 in base 8, 5 in base 11) are valid.
Answer: (D)
If we use internal data forwarding to speed up the performance of a CPU (R1, R2 and R3 are registers and M[100] is a memory reference), then the sequence of operations
R1 M[100]
M[100] R2
M[100] R3
can be replaced by
R1 M[100]
M[100] R2
M[100] R3
can be replaced by
Answer: (D)
Internal data forwarding: when a value is written to a memory location and then read back, the reader takes it directly from the register that was written, and does not wait for memory.
Here is stored in , and then is read into and . Both reads would get the value of , so and can be done directly, and still has to be done. That is option (D).
Why the others are wrong:
(A) never gets the value of , and gets the old .
(B) It reads before it is written, and is never written with .
(C) copies the old value of , and is not loaded with the value of .
Answer: (D)
Here is stored in , and then is read into and . Both reads would get the value of , so and can be done directly, and still has to be done. That is option (D).
Why the others are wrong:
(A) never gets the value of , and gets the old .
(B) It reads before it is written, and is never written with .
(C) copies the old value of , and is not loaded with the value of .
Answer: (D)
Consider the following program segment for a hypothetical CPU having three user registers R1, R2 and R3.
Consider that the memory is byte addressable with size 32 bits, and the program has been loaded starting from memory location 1000 (decimal). If an interrupt occurs while the CPU has been halted after executing the HALT instruction, the return address (in decimal) saved in the stack will be
Consider that the memory is byte addressable with size 32 bits, and the program has been loaded starting from memory location 1000 (decimal). If an interrupt occurs while the CPU has been halted after executing the HALT instruction, the return address (in decimal) saved in the stack will be
Answer: (D)
One word is 32 bits bytes. From the table, the five instructions are 2, 1, 1, 2 and 1 words long, which is 7 words bytes. So they start at 1000, 1008, 1012, 1016 and 1024 (the 2-word instructions take two words), and the program ends just before .
The interrupt comes after HALT has already executed. The PC then points to the instruction after HALT, and this is the return address saved on the stack: 1028.
1024 is the address of HALT itself and 1020 is the second word of , so they are not the next instruction.
Answer: (D)
The interrupt comes after HALT has already executed. The PC then points to the instruction after HALT, and this is the return address saved on the stack: 1028.
1024 is the address of HALT itself and 1020 is the second word of , so they are not the next instruction.
Answer: (D)