CS312 Quiz #2
*9) How will "-1(10)" be represented using n-bits two's complimentary number?
"1" for all of the n bits (e.g., "1111 1111 1111 1111" for 16-bit processors)
3) What are three major weaknesses in "unsigned integers"?
- No negative numbers - Huge numbers require a lot of binary bits - Different operations for addition and subtraction
2) Show "78(10)" using unsigned integer format. How many bits are needed?
0 1 0 0 1 1 1 0 (8 bits)
8) How will "0(10)" be represented using n-bits two's complimentary number?
0000
13) Extend the 8 bit binary bit pattern for the 2's complement expression to 16 bit: "1 1 1 0 1 0 1 0"
1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0
14) Given N bits for 2's complement integers, what is the largest positive integer (in decimal) a processor can have and what is the smallest negative integer (in decimal) a processor can have?
2^(N-1)- 1 (e.g., if N = 16, it's (2^(16 - 1) - 1) = 32,767)
10) Show all the possible numbers (in the binary format, in 2's complement) a processor can use if three bits are used (including the sign bit) for 2's complement number?
7 to -8
What are the two types of fractions ?
Floating point numbers and fixed point numbers
What are the two types of arithmetic systems used in computers?
Integers and fractions
5) What is "Overflow Flag" in a processor (how is it used) for handling operations in two's compliment integers?
It adds a number to the front to indicate an overflow
What does "la" instruction do?
Load address loads a constant as a 32 bit memory address
12) When a calculation (either the result of a mathematic operations, +, -, x, etc.) either exceeds the maximum number or goes under the minimum number in two's complement arithmetic, how can the processor indicate that an error occur?
Overflow Flag
*9) What is the difference between "li $a0, 1024" and "la $a0, 1024" instructions? Assume that this computer system is a 32-bit system (i.e., all the registers are 32-bit registers and its ALU can deal with up to 32-bit inputs and outputs).
The former (li) encodes a given integer immediate based on the 2's complement integer, while the latter (la) encodes a given integer immediate based on the unsigned integer.
What are the two types of integers?
Unsigned and signed
3) What is "PC-SPIM"?
a 32 bit RISC CPU
What are conditional branch statements
compares two different registers and them jumps to the instruction in the destination address
1) What are "registers" in processors?
fast locations for data. Data must be in registers to perform arithmetic
11) Which of the following load instructions does not access memory at all ( li, la, lb, lw, lhw)?
li and la
10) "li $t1, $t0" is an illegal instruction (if you try to assemble that instruction using PC-SPIM simulator, that instruction will cause a syntax error). What's wrong?
load instructions can not be used for data transfer between two registers
8) "li $t0, (1024)" is an illegal instruction (if you try to assemble that instruction using PC-Spim simulator, that instruction will cause a syntax error). What's wrong?
must be a positive number / no pare
What are the two types of signed integers?
sign magnitude and two's compliment
5) What are "system calls" in MIPS Simulator?
something like sub-routine calls high - level programming language that perform useful tasks.
6) Transform a decimal number to the two's complimentary number. Ex -63(10)
step 1: obtain positive counterpart step 2: invert the numbers step 3: add one 1 1 0 0 0 0 0 1
4) Why do we need "jr $31" at the end of an assembly program?
to return the caller, ends the program
11) What is the condition for a mathematical operation (such as +, -, and x) on two's complement numbers to cause an error (the result of the operation becomes an error)?
two negative numbers or two positive numbers
7) Which numbering system solves the two problems in the "sign magnitude integers"?
two's compliment integers