Professional Documents
Culture Documents
Ive Made A Huge Mistake
Ive Made A Huge Mistake
Miniaturization
Which of the following is true about the sign and magnitude representation?
it has two zeroes &
bitwise addition of the positive and negative version of a number do not produce 0
Given the hexadecimal 8-bit signed integer 17, its value in decimal is:
1*16+7=23
The instruction 0x9010 uses the memory addressing mode. Here, it means:
one operand is at memory[0x10]
The user-accessible registers (those that can be manipulated directly by a user program) in the Simple
Machine are:
the accumulator, address register, and counter
The number 32 comes up with respect to our version of basic MIPS technology because:
it has 32 registers
Which of the following statements is true about basic (R- and I-type) MIPS instructions?
each instruction has room for encoding at least two registers
Which of the following would a right- or left-shift instruction NOT be used for?
adding two numbers
Given two MIPS registers $t0, which contains 6 and $t1, which contains 5, what is the result of the
following instruction in $t2?
or $t2, $t0, $t1
0x7
This section introduces an addressing mode that MIPS has that the Simple Machine didn't have. It is:
base plus displacement
I-type instructions:
have room for two registers and a 16-bit immediate field
There are only two native branch statements on MIPS. They are:
beq and bne
Which non-native branch instruction do the following two instructions implement?
slt $at,$t0,$t1
bne $at,$zero,Label
blt $t0,$t1,Label
Given two integers i and N, where N>=0, what might this loop be translated to?
i=0;
while (i<N) i++;
i = 0;
loop: if (i>=N) goto loopdone:
i++:
goto loop;
loopdone:
In the code sample below, $t0 contains the value of i, and the goal is to place A[i] in $t1. What is the
missing instruction X?
la $t2,A
X
add $t2,$t2,$t0
lw $t1,0($t2)
sll $t0,$t0,2
Which of the following characteristics of a switch statement would suggest implementing it using a jump
table?
both b and c must be true to use a jump table
The branch instructions use their 16-bit immediate constant to encode where to branch. If the immediate
has the value X, it means:
none of the above
You must add X<<2 to the contents of the PC to get the branch target (X is a word offset)
In the leaf function below, which does not allocate a stack frame, what is the location of
argument e?
int foo (int a, int b, int c, int d, int e) {
...
16($sp)
The starting addresses for data and text are "far apart". This:
allows each segment to be contiguous and allows sufficient space for each.
Which of the following is true about the stack?
Locations in the stack are accessed as offsets from a movable pointer.
Which of the following is true about 16-bit Unicode being transmitted using UTF-8?
Each Unicode character is encoded as one or more UTF-8 characters.
An international character can be encoded in a maximum of three bytes of UTF-8.
The most-significant bit of the first byte of the character indicates whether it has been encoded
using UTF-8.
foo calls moo and foo is using regX. If regX is a caller-save register...
foo must save regX before the call to moo, and restore it afterwards
How would you describe the type of foo in the following declaration?
char ** foo;
a pointer to a character string (a pointer to a char *)
a pointer to a pointer to a char
an array of character strings (an array of char *'s)
In the following code, where the register $s0 is to be used for banner, $s0 is initialized by what?
foo(void) {
char *banner = "the result is: ";
...
Placing a copy of the string on the stack and initializing $s0 with the address of the first byte of
the string.
When the exception handler is invoked, all registers must be preserved except:
k0 and k1
The MIPS instructions which are used to simulate an atomic operation are:
load linked and store conditional
When a [virtual] memory address is not in the cache it is referred to as a cache miss.
If the [virtual] memory address is not in memory at all it is referred to as a:
page fault
During the translation of a virtual to a physical address, the virtual address is broken up into a:
virtual page number and page offset
If a direct-mapped cache has eight blocks with a blocksize of 1, address 0xff maps to block
number:
7
A decoder has:
n inputs and 2^n outputs