辅导案例-CMPE12 S18
Name: Account: @ucsc.edu CMPE12 S18 Final, Version A June 11, 2018 • BEFORE YOU START, please fill out your name and CruzID on this exam and put the version of your exam on the scantron (it is at the top of this page). • FILL IN YOUR NEIGHBORS’ NAMES Person to your left← (skip empty seats): Person to your right→ (skip empty seats): • NO CELL PHONES ALLOWED. Once the exam has started if we see a cell phone you are done with your exam at that point (no further marks allowed). Leave your cell phone in your bag. • NO BAGS AT DESKS. All backpacks must go on the sides of the classrooms. If we see a bag after the exam has started we will require you to move it. • This exam is closed-book, closed-note, and no calculators. • If you wish to leave the room during the exam, bring your exam, scantron and your ID to the front of the room. We will hold your exam and scantron for you and will check your ID upon returning the exam room. • You are not required to show your work. However, if for some reason you are suspected of academic misconduct, your handwritten work is your best defense. • You may not use extra paper. • When you are done, turn in both your scantron and your exam to the staff at the exits. Have your UCSC ID card ready, as we will check them upon collecting your exam. • Put your name and cruzID on every page. • DO NOT OPEN THE EXAM UNTIL YOU ARE TOLD TO DO SO CMPE12 S18 Final, Version A Page 1 of 12 June 11, 2018 Name: Account: @ucsc.edu 1. (4 points) MIPS32 has how many general purpose registers? © A. 32 © B. 8 © C. 16 © D. 64 © E. 10 2. (4 points) What is the largest unsigned 6-bit number? © A. 0x111111 © B. 0x3F © C. 0xFFF © D. 0xF © E. 0x18 3. (4 points) What is the largest signed 2SC 4-bit number (in decimal)? © A. 8 © B. 4 © C. 6 © D. 16 © E. 7 4. (4 points) Which of these 8-bit signed magnitude numbers is the largest? © A. 0xEF © B. 0x7F © C. 0xFF © D. 0x8F © E. 0x80 5. (4 points) True or False: The ASCII character ’A’ is encoded by 10 in decimal. © A. True © B. False 6. (4 points) Convert the number 12010 to binary. © A. 11110002 © B. 11001102 © C. 10110002 © D. 11010012 © E. 10111012 7. (4 points) What is the result in binary of the octal addition 10108 +01008? © A. 00010001000100002 © B. A42 © C. 11102 © D. 0000000011102 © E. 0010010010002 8. (4 points) Convert 2610 to an excess-8 decimal number. © A. −2610,excess8 © B. 2610,excess8 © C. −810,excess8 © D. 3410,excess8 © E. 1810,excess8 CMPE12 S18 Final, Version A Page 2 of 12 June 11, 2018 Name: Account: @ucsc.edu 9. (4 points) A MUX with 4 selector pins has how many inputs? © A. 16 © B. 8 © C. 7 © D. 12 © E. 4 10. (4 points) If a computer has eight-byte addressability and needs three bits to access a location in memory, what is the total size of memory in bytes? © A. 768 © B. 32 © C. 256 © D. 128 © E. 64 11. (4 points) What is this logic circuit? © A. 2-1 multiplexor © B. half adder © C. full adder © D. shift register © E. decoder 12. (4 points) What is the unsimplified Product of Sums boolean expression that represents the following truth table? A B C Out 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 © A. (A¯+ B¯+C) · (A¯+B+C¯) · (A+ B¯+C¯) © B. (A+B+C) · (A+ B¯+C¯) · (A¯+B+C¯) · (A¯+ B¯+C) · (A¯+ B¯+C¯) © C. (A+B+C¯) · (A+ B¯+C) · (A¯+B+C) © D. (A¯+ B¯+C¯) · (A¯+B+C) · (A+ B¯+C) · (A+B+C¯) · (A+B+C) CMPE12 S18 Final, Version A Page 3 of 12 June 11, 2018 Name: Account: @ucsc.edu 13. (4 points) What is the result of the following binary XOR operation? 0b 0 0 1 1 1 0 1 1 ⊕ 0b 1 0 1 1 1 0 1 0 © A. 100000012 © B. 001110102 © C. 010001002 © D. 011111102 © E. 101110112 14. (4 points) X AND X is: © A. Always True © B. Always False © C. Depends on the value of X 15. (4 points) X OR X is: © A. Always True © B. Always False © C. Depends on the value of X 16. (4 points) What is the result of the following binary AND operation? 0b 0 0 1 1 1 0 1 1 · 0b 1 0 1 1 1 0 1 0 © A. 010001002 © B. 011111102 © C. 100000012 © D. 101110112 © E. 001110102 17. (2 points) How many more transistors does an AND gate have compared to a NAND gate? © A. 0 © B. 1 © C. 2 © D. 3 © E. 4 18. (2 points) What is the minimum number of transistors needed to create an OR gate? © A. 2 © B. 3 © C. 4 © D. 5 © E. 6 19. (2 points) Convert the 2SC number 110110112 into a decimal value in base 10. © A. −4110 © B. 3610 © C. −3710 © D. −9110 © E. −3810 CMPE12 S18 Final, Version A Page 4 of 12 June 11, 2018 Name: Account: @ucsc.edu 20. (4 points) Convert 0xCAFE to binary. © A. 01000101010000102 © B. 10101011101111102 © C. 11001010111111112 © D. 11001010111111102 © E. 10101011111010112 21. (4 points) Convert the BCD number 0b0100011100100011 to decimal. © A. 4723 © B. 043443 © C. 18211 © D. 118 22. (4 points) Convert the 4-bit unsigned binary number 0b1011 to 8 bits. © A. 0b11110111 © B. 0b11111011 © C. 0b00001011 © D. 0b01111011 © E. 0b11101011 23. (4 points) Consider a 4 bit ripple carry adder with inputs A=0101 and B=0011. What are the results of full adder for bit 0? © A. Cout=0, Sum=1 © B. Cout=1, Sum=1 © C. Cout=0, Sum=0 © D. Cout=1, Sum=0 24. (4 points) Assume all signed numbers are two’s complement. Which addition(s) have overflow? © A. (signed) 0xD02A + 0x57D9 = 0x2803 © B. (unsigned) 0xD02A + 0x57D9 = 0x2803 © C. (unsigned) 0x76F9 + 0x801A = 0xF713 © D. (unsigned) 0x0308 + 0x1198 = 0x14A0 © E. (signed) 0x0308 + 0x1198 = 0x14A0 25. (4 points) The product of two 32-bit numbers has how many bits? © A. 64 bits © B. 32 bits © C. 16 bits 26. (4 points) What is the result when adding the following 6-bit signed magnitude binary numbers? 0b 1 0 0 1 0 0 + 0b 1 0 1 1 0 0 © A. 0b100000 © B. 0b010000 © C. 0b1100000 © D. 0b000001 © E. 0b110000 CMPE12 S18 Final, Version A Page 5 of 12 June 11, 2018 Name: Account: @ucsc.edu 27. (4 points) What is the result of the following unsigned 8-bit binary multiplication? 0b 0 0 0 0 0 1 1 0 x 0b 0 0 0 0 1 0 1 0 © A. 0b00111100 © B. 0b00111101 © C. 0b01000001 © D. 0b00010000 © E. 0b01000000 28. (4 points) Assume an arbitrary 16-bit instruction format as follows: immediate rs1 rs2 opcode How many instructions can be encoded if there are 4 general purpose registers and an immediate field of 9 bits? © A. Unknown. There is not enough information given. © B. 16 © C. 8 © D. 32 © E. 32 29. (4 points) True or False: The address 0x00002028 is word aligned. © A. True © B. False 30. (4 points) Which of the following are true about instructions in a MIPS program once assembled? © A. instructions are stored in the heap © B. each instruction takes up 8 bytes of memory © C. instructions range in size from 1 to 4 bytes © D. instructions are stored in the stack © E. instructions are stored such that they fall on a word boundary For the following two questions, assume a portion of data memory looks like this: ADDRESS CONTENTS 0x10011014 0x90 0x10011013 0x78 0x10011012 0x56 0x10011011 0x34 0x10011010 0x12 31. (4 points) Assuming little endian memory storage, what is in $t0 after the following instructions? LI $t1, 0x10011011 LW $t0, ($t1) © A. 0x34567890 © B. 0x90785634 © C. Undefined. There will be an alignment error. © D. 0x87654321 © E. 0x78563412 CMPE12 S18 Final, Version A Page 6 of 12 June 11, 2018 Name: Account: @ucsc.edu 32. (4 points) Assuming little endian memory storage, what is in $t7 after the following instructions? ADDI $t0, $zero, 0x10011010 LH $t7, 2($t0) SW $t7, ($t0) LW $t7, ($t0) © A. 0x00008765 © B. Undefined. There will be an alignment error. © C. 0x78560000 © D. 0xFFFF8765 © E. 0x00007856 33. (4 points) True or False: A logical left shift and an arithmetic left shift perform the same operation © A. True © B. False 34. (4 points) Ignoring branch delay slots, which label will the following code branch/jump to? LI $t3,92 SRL $t3, $t3, 4 BLE $t3, 4, label1 BGE $t3, 12, label2 BEQ $t3, 5, label3 BLE $t3, 12, label4 J label5 © A. label3 © B. label2 © C. label4 © D. label5 © E. label1 35. (4 points) What value (in decimal) will be in $t2 after the following instructions execute? LI $t1, 6 SLL $t2, $t1, 4 © A. 6 © B. 24 © C. 194 © D. 96 © E. 48 CMPE12 S18 Final, Version A Page 7 of 12 June 11, 2018 Name: Account: @ucsc.edu 36. (4 points) What is printed to the screen after the following instructions execute? .data prompt1: .ascii "Hello" prompt2: .asciiz " World!" prompt3: .asciiz " CMPE 12 Final." .text LI $v0, 4 LA $a0, prompt1 SYSCALL © A. Hello World! © B. Hello © C. Hello World! © D. Hello World! CMPE 12 Final. © E. nothing 37. (4 points) What is printed to the screen after the following instructions execute? .data P1: .word 0xB P2: .asciiz "DYoonu’’tr eWOokraryy" .text L1: LA $t1, P2 ADDI $t2, $zero, 2 LB $t3, P1 L2: LB $a0, ($t1) LI $v0, 11 SYSCALL ADDI $t3, $t3, -1 BEQZ $t3, GLUE ADD $t1, $t1, $t2 B L2 GLUE: LI $v0, 10 SYSCALL © A. nothing there is an error © B. Don’t Worry © C. B © D. Don’t Worry You’re Okay © E. You’re Okay 38. (4 points) True or False: The mantissa in IEEE 754 floating point numbers is stored as two’s comple- ment. © A. True © B. False CMPE12 S18 Final, Version A Page 8 of 12 June 11, 2018 Name: Account: @ucsc.edu 39. (4 points) True or False: The exponent in IEEE 754 floating point numbers is stored as two’s comple- ment. © A. True © B. False 40. (4 points) The mantissa in an IEEE 754 Single Precision floating point number is © A. 16 bits © B. 8 bits © C. 46 bits © D. 11 bits © E. 23 bits 41. (4 points) Which IEEE 754 Single Precision number is the largest? © A. 0x389E5D4B © B. 0x781CCCCC © C. 0xC1200000 © D. 0x1F9FD394 © E. 0x402CCCCD 42. (4 points) What special exponent is used for NaN, +Inf, and -Inf in IEEE 754 Single Precision floating point? © A. 127 © B. 128 © C. 254 © D. 255 43. (4 points) Convert the following decimal value 86.210 to unsigned fractional binary. © A. 1010110.01 © B. 1010110.0011 © C. 1010110.0011 © D. 1010110.10 © E. 1010110.01 44. (4 points) The single precision floating point number 0x41680000 is what value in decimal? © A. 3.625 © B. 14.5 © C. 8.25 © D. 20 © E. 41.68 45. (4 points) Convert 47.62510 to single precision floating point format in hex © A. 0x423F7000 © B. 0x423E8000 © C. 0x425F4000 © D. 0x42F7D000 © E. 0x42DF4000 46. (4 points) Compute the single precision floating point value of 0.2510 +10010 © A. 0x40D20000 © B. 0x42E48000 © C. 0x42C88000 © D. 0x40A40000 © E. 0x42C90000 CMPE12 S18 Final, Version A Page 9 of 12 June 11, 2018 Name: Account: @ucsc.edu 47. (4 points) By what value is PC(program counter) incremented each time a non-branch or jump instruction is executed? © A. 4 © B. 1 © C. -1 © D. 2 48. (4 points) Processing an instruction requires the following steps: a. Fetch instruction from memory b. Write back result c. Memory Read/Write d. Decode instruction and access operands e. Execute operation What is the correct ordering for the steps? © A. adecb © B. acdeb © C. abcde © D. adebc © E. bdeca 49. (4 points) Assume the following sequence of push and pop operations on a stack. What is the order of items being popped off the stack? PUSH A PUSH B POP PUSH C PUSH D POP PUSH E POP POP POP © A. EDCBA © B. BADCE © C. BDECA © D. ABCDE © E. ACEDB 50. (4 points) The stack is used for all of the following except: © A. Passing more than 4 arguments © B. Preserving register values © C. Returning more than 2 values © D. Storing temporary local data © E. Dynamically allocating global data CMPE12 S18 Final, Version A Page 10 of 12 June 11, 2018 Name: Account: @ucsc.edu 51. (4 points) Which register(s) in MIPS must the callee preserve? © A. $k0-$k1 © B. $t0-$t9 © C. $v0-$v1 © D. $s0-$s7 © E. $a0-$a3 52. (4 points) Values returned from a subroutine are passed in which registers? © A. $k0-$k1 © B. $t0-$t9 © C. $a0-$a3 © D. $v0-$v1 © E. $s0-$s7 53. (4 points) True or False: The $fp register automatically points to the last value of the $sp after a function call. © A. True © B. False 54. (4 points) Which combination of MIPS instructions perform a push operation of one element onto the stack? © A. LW $t0, ($sp) ADDI $sp, $sp, 4 © B. ADDI $sp, $sp, 4 LW $t0, ($sp) © C. SW $t0, ($sp) SUBI $sp, $sp, 4 © D. SUBI $sp, $sp, 4 SW $t0, ($sp) 55. (4 points) When does the value in $ra need to be saved by the user? © A. anytime a function is called © B. any time a branch is executed © C. never © D. when there are nested functions © E. in every program This table shows the state of the $t0-$t4 registers before and after four successive instructions. The next four problems ask to fill in the omission (indicated by the number <#>) in the instructions and register file. Instr 1: SRA $t0, $t0, <1> Instr 2: <2> $t1, ($t2) Instr 3: LW <3>, ($t2) Instr 4: ADDI $t3, $t3, -8 Reg Initial After Instr 1 After Instr 2 After Instr 3 After Instr 4 $t0 0xABCDEF00 0xF579BDE0 0xF579BDE0 0xF579BDE0 0xF579BDE0 $t1 0x000A5C11 0x000A5C11 0x000A5C11 0x000A5C11 0x000A5C11 $t2 0x1001100C 0x1001100C 0x1001100C 0x1001100C 0x1001100C $t3 0xFFFFFFAA 0xFFFFFFAA 0xFFFFFFAA 0xFFFFFFAA < 4 > $t4 0xFFFA5C11 0xFFFA5C11 0xFFFA5C11 0x00005C11 0x00005C11 CMPE12 S18 Final, Version A Page 11 of 12 June 11, 2018 Name: Account: @ucsc.edu 56. (4 points) What is <1>? © A. $t1 © B. $t0 © C. There is not enough information to answer this. © D. 1 © E. 3 57. (4 points) What is <2>? © A. SH © B. SB © C. LW © D. There is not enough information to answer this. © E. LB 58. (4 points) What is <3>? © A. 0x000A5C11 © B. $t1 © C. $t4 © D. There is not enough information to answer this. © E. 0xFFFF 59. (4 points) What is <4>? © A. 0x00000064 © B. 0xFFFFFFA2 © C. 0x00000048 © D. There is not enough information to answer this. © E. 0xFFFFFFB2 60. (4 points) True or False: An object file contains only machine langauge instructions. © A. True © B. False 61. (4 points) True or False: ISR stands for Interrupt Service Routine. © A. True © B. False 62. (4 points) Which instruction cannot cause an exception? © A. SW © B. LW © C. SLL © D. SYSCALL © E. ADD CMPE12 S18 Final, Version A Page 12 of 12 June 11, 2018