Midterm Questions Answers
Midterm Questions Answers
2022
Number:
What does algorithm affect in terms of performance of computer and how? Please explain.
Answer #1:
Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600 MHz.Computer B
has a CPI of 2.5 and can be run at a clock rate of 750 Mhz. We have a particular program we
wish to run. When compiled for computer A, this program has exactly 100,000 instructions.
How many instructions would the program need to have when compiled for Computer B, in
order for the two computers to have exactly the same execution time for this program?
Since (CPUTime)A = (CPUTime)B,we have to solve for (I)B and get 65000.
Given the bit string 0x40500000, what floating point number does it represent?
Answer #3: (15p)
Assume that A is a 10-integer array whose starting address is in register $s0. The values 1 to
10 are stored in A in ascending order. Assume that B is another 10-integer array whose
starting address is in register $s1. $s0 and $s1 contain the values 1000 and 2000
respectively. Consider the following MIPS code:
a. What are the contents of $t0, $t1, $t2, $t3 at the end of the program above?
b. What are the contents of arrays A and B at the end of the program?
d. Does the above code correspond to accessing arrays using indices or using pointers?
We want to implement the following C-language code segment in MIPS assembly using a
JumpTable. Assume a is in $s0, b is in $s1, and c is in $s2.
What is the compiled MIPS assembly code for the above code segment? Assume that the
base of the JumpTable is in register $t4.
Answer #5:
a) The part of machine level instruction, which tells the central processor
what has to be done, is:
1) Operation code
2) Address
3) Locator
4) Flip-Flop
5) None of the above
1) main storage
2) secondary storage
3) printer
4) processor
5) scanner
Answer #6:
a) 1) Operation code
b) c) three
c) a) sll
d) 4) Processor
e) b) register
LO LO LO LO
1 LO2 3 LO4 5 LO6 7 LO8 LO9
Q1 X
Q2 X
Q3 X X
Q4 X X
Q5 X X X
Q6 X X X