Georgia State University Department of Computer Science. Spring Semester – 3/29/2011 CSC 2010 Test 3 Name:_____________________________ Grade:______________/100 Answer all of the following questions. 1. Do the following showing the entire procedure involved (use 8 bits to represent each number): Use unsigned number. (4 pts) 125 – 14 125 → 01111101 14 → 00001110 .... 01111101 00001110 ---------------------01101111 2. Add the following using 8 bits to represent each number. Use unsigned number. (4 pts) 231 + 16 231 11100111 16 00010000 --------------Answer: 11110111 Circle clearly the correct letter for questions 3 – 9. For Q3-Q8, each question is 3 pts. For Q9, each sub question is 2pts. Binary to Hex number 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F 3. The Binary number for 25610 is: a. 100100000 b. 111111110 c. 101010100 d. 100000000 Answer: d. 4. The Hexadecimal number for 8010 is: a. 516 b. 5016 c. 616 d. 6016 Answer: b. 5. The decimal number (to base 10) of 11100110 is: a. 189 b. 255 c. 345 d. 230 Answer: d. 6. The decimal number (to base 10) of 2AF16 is: a. 688 b. 687 c. 777 d. 478 Answer: b. 7. The Hexadecimal number for 111100110001 is: a. F4116 b. E4216 c. F3116 d. A5616 Answer: c. 8. The Binary number for AD716 is: a. 110011001111 b. 101011110011 c. 101011010111 d. 111111000011 Answer: c. 9. Assuming that x = 1 and y = 2, circle the correct value for each of the following Boolean expression: (2 pts each) FALSE (a) (x = 1) AND (y = 3). TRUE (b) (x < y) OR (x > 1). TRUE FALSE (c) NOT [(x = 1) AND (y = 2)]. TRUE FALSE 10. Compress the following text stream. (5 pts) xxxzzzzAAxxxx a. Show the run-length encoding (2pts) (x,3) (y,6) (z,4) (A,2) (x,4) b. What is the compression ratio? (3 pts) 19/10 1:1.9 11. Store the following number in the space provided using 16 bits – 1 each for the sign, 4 for the exponent and 10 for the mantissa. (7 points) -133.75 a. binary value (2pt) b. normalized value (1pt) c. (4pt) 1 1000010111 0 1000 12. Draw a 3-8 decoder control circuit. (4 pts) Inputs 0 1 2 3 8 outputs 13. Draw a multiplexor that has 2 selector lines only. (4 pts) Inputs 0 1 2 1 output 3 A B Selector Lines 14. You found an old computer that has 3KB (kilobyte) of memory. In order to address each byte of memory, what is the minimum number of bits needed in a memory address? (3 pts) 12 bits 212 = 4096 just over 3000; 13 bits are too large, 11 bits are not enough 15. Describe any two important characteristics of RAM. (4 pts) Volatile, unique address per cell starting from 0 to 2n - 1, fixed size cell of 8 bits each, can read or write one cell at a time, randomly accessed. 16. Name the 4 major subsystems of the Von Neumann architecture. (4 pts) Memory, Input/output devices, ALU and control unit 17. Using the following truth table derive the expression for case 1, case 2 and case 3 then, build the circuit using AND, OR and NOT gates. Make sure you give the algebraic functions derived for case1 and case 2. (13 pts – 2 pts each for case 1 and case 2, 1 pts to put case 1 and case 2 expression as one expression, and 8 pts for the circuit) NOTE: To get full credit, you must use only 2-input AND and OR gates and 1input NOT gate. A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 Output 0 1 0 0 0 0 1 0 Cases Case 1: ________________ 1 Case2: _______________ Full Expression: __________________________ 2 Circuit: Case 1: (not)A.(not)B.C Case 2: A.B.(not)C Whole expression: (not)A.(not)B.C + A.B.(not)C • A (not)A.(not)B.C + B • • C A.B.(not)C • 18. Given the following partial table, fill in the empty columns with the values resulting from the indicated operations. (14 pts – 2 for each column) a 0 0 0 0 1 1 1 1 b 0 0 1 1 0 0 1 1 c 0 1 0 1 0 1 0 1 a.b.c a+b+c 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 not(a.b.c) not(a+b+c) 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 not(a) 1 1 1 1 0 0 0 0 not(b) not(c) 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 19. Assume that the variables v, w, x, y and z are stored in memory locations 200, 201, 202, 203 and 204, respectively. Using any of the machine language instructions in the textbook, translate the following algorithmic operation into their machine language equivalents. (10pts) (LOAD, STORE, MOVE, ADD, SUBTRACT, JUMP, JUMPGT, JUMPEQ, JUMPLT, JUMPGE, JUMPLE, JUMPNEQ) a. Set v to the value of x-y-z (2pts) SUBTRACT 202,203,200 SUBTRACT 200,204,200 b. Set v to the value (w+x) – (y+z) (3pts) ADD 201,202,200 ADD 203,204,201 SUBTRACT 200,201,200 c. While y>z do Set y to the value (y+w+z) Set z to the value (z+v) End of the loop (5pts) 1, COMPARE 203,204 2, JUMPGT 4 3, JUMP 8 4, ADD 203,201,203 5, ADD 203,204,203 6, ADD 204,200,204 7. JUMP 1 8. next instruction… Q19 continues… Extra Credits (10pts) d. If (v=w) then set x to y Else Set x to z (Use JUMPEQ) (5pts) 1, COMPARE 200,201 2, JUMPEQ 5 3, MOVE 204, 202 4, JUMP 6 5, MOVE 203, 202 6. next instruction… e. Rewrite question c without using JUMPEQ (5pts) 1, COMPARE 200,201 2, JUMPNEQ 5 3, MOVE 203, 202 4, JUMP 6 5, MOVE 204, 202 6. next instruction…