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):
Copyright By PowCoder代写 加微信 powcoder
• 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
1. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
2. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
3. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
4. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
5. (4 points) ⃝ A. ⃝ B.
6. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
7. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
8. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
MIPS32 has how many general purpose registers? 32
8 16 64 10
What is the largest unsigned 6-bit number? 0x111111
What is the largest signed 2SC 4-bit number (in decimal)? 8
Which of these 8-bit signed magnitude numbers is the largest? 0xEF
0x7F 0xFF 0x8F 0x80
True or False: The ASCII character ’A’ is encoded by 10 in decimal. True
Convert the number 12010 to binary. 11110002
11010012 10111012
What is the result in binary of the octal addition 10108 +01008? 00010001000100002
0000000011102 0010010010002
Convert 2610 to an excess-8 decimal number. −2610,excess8
2610,excess8
−810,excess8
3410,excess8 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. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
11. (4 points)
12. (4 points) table?
What is this logic circuit?
2-1 multiplexor half adder
full adder
shift register decoder
What is the unsimplified Product of Sums boolean expression that represents the following truth
A B C Out 0001 0010 0100 0111 1000 1011 1101 1111
⃝ 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
13. (4 points)
⃝ A. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
14. (4 points)
15. (4 points)
16. (4 points)
⃝ A. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
17. (2 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
18. (2 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
19. (2 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
Account: @ucsc.edu
What is the result of the following binary XOR operation? 0b 00111011
⊕ 0b 10111010
100000012 001110102 010001002 011111102 101110112
X AND X is:
Always True
Always False
Depends on the value of X
Always True
Always False
Depends on the value of X
What is the result of the following binary AND operation? 0b 00111011
· 0b 10111010
010001002 011111102 100000012 101110112 001110102
How many more transistors does an AND gate have compared to a NAND gate? 0
What is the minimum number of transistors needed to create an OR gate? 2
Convert the 2SC number 110110112 into a decimal value in base 10. −4110
3610 −3710 −9110 −3810
CMPE12 S18 Final, Version A
Page 4 of 12
June 11, 2018
20. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
21. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
22. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
Convert 0xCAFE to binary. 01000101010000102 10101011101111102 11001010111111112 11001010111111102 10101011111010112
Convert the BCD number 0b0100011100100011 to decimal. 4723
Convert the 4-bit unsigned binary number 0b1011 to 8 bits. 0b11110111
0b11111011
0b00001011
0b01111011
0b11101011
23. (4 points) adder for bit 0?
⃝ A. ⃝ B. ⃝ C. ⃝ D.
24. (4 points)
25. (4 points) ⃝ A. ⃝ B. ⃝ C.
26. (4 points)
⃝ A. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
Cout=0, Sum=1 Cout=1, Sum=1 Cout=0, Sum=0 Cout=1, Sum=0
Assume all signed numbers are two’s complement. Which addition(s) have overflow? (signed) 0xD02A + 0x57D9 = 0x2803
(unsigned) 0xD02A + 0x57D9 = 0x2803
(unsigned) 0x76F9 + 0x801A = 0xF713
(unsigned) 0x0308 + 0x1198 = 0x14A0 (signed) 0x0308 + 0x1198 = 0x14A0
The product of two 32-bit numbers has how many bits? 64bits
What is the result when adding the following 6-bit signed magnitude binary numbers? 0b 100100
Consider a 4 bit ripple carry adder with inputs A=0101 and B=0011. What are the results of full
+ 0b 101100
CMPE12 S18 Final, Version A
Page 5 of 12
June 11, 2018
Name: 27. (4 points)
⃝ A. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
Account: @ucsc.edu
What is the result of the following unsigned 8-bit binary multiplication? 0b 00000110
0b00111100
0b00111101
0b01000001
0b00010000
0b01000000
x 0b 00001010
28. (4 points)
immediate rs1 rs2 opcode
How many instructions can be encoded if there are 4 general purpose registers and an immediate field of 9 bits?
Assume an arbitrary 16-bit instruction format as follows:
29. (4 points) ⃝ A. ⃝ B.
30. (4 points)
Unknown. There is not enough information given. 16
True or False: The address 0x00002028 is word aligned. True
Which of the following are true about instructions in a MIPS program once assembled? instructions are stored in the heap
each instruction takes up 8 bytes of memory
instructions range in size from 1 to 4 bytes
instructions are stored in the stack
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:
0x10011014
0x10011013
0x10011012
0x10011011
0x10011010
31. (4points)
Assuming little endian memory storage, what is in $t0 after the following instructions?
LI $t1, 0x10011011
LW $t0, ($t1)
0x34567890
0x90785634
Undefined. There will be an alignment error. 0x87654321
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. ⃝ B. ⃝ C. ⃝ D. ⃝ E.
33. (4 points) ⃝ A. ⃝ B.
34. (4 points)
0x00008765
Undefined. There will be an alignment error. 0x78560000
0xFFFF8765
0x00007856
True or False: A logical left shift and an arithmetic left shift perform the same operation True
Ignoring branch delay slots, which label will the following code branch/jump to?
SRL $t3, $t3, 4
BLE $t3, 4, label1
BGE $t3, 12, label2
BEQ $t3, 5, label3
BLE $t3, 12, label4
⃝ 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?
prompt1: .ascii “Hello”
prompt2: .asciiz ” World!”
prompt3: .asciiz ” CMPE 12 Final.”
LA $a0, prompt1
37. (4 points)
Hello World!
Hello World! CMPE 12 Final. nothing
What is printed to the screen after the following instructions execute?
P1: .word 0xB
P2: .asciiz “DYoonu’’tr eWOokraryy”
L1: LA $t1, P2
ADDI $t2, $zero, 2
LB $t3, P1
L2: LB $a0, ($t1)
LI $v0, 11
ADDI $t3, $t3, -1
BEQZ $t3, GLUE
ADD $t1, $t1, $t2
GLUE: LI $v0, 10
38. (4 points) ment.
nothing there is an error Don’t Worry
Don’t Worry You’re Okay You’re Okay
True or False: The mantissa in IEEE 754 floating point numbers is stored as two’s comple-
True False
CMPE12 S18 Final, Version A Page 8 of 12 June 11, 2018
39. (4 points) ment.
40. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
41. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
42. (4 points) point?
⃝ A. ⃝ B. ⃝ C. ⃝ D.
43. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
44. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
45. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
46. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
Account: @ucsc.edu
True or False: The exponent in IEEE 754 floating point numbers is stored as two’s comple-
True False
The mantissa in an IEEE 754 Single Precision floating point number is 16bits
11bits 23bits
Which IEEE 754 Single Precision number is the largest?
0x389E5D4B
0x781CCCCC
0xC1200000
0x1F9FD394
0x402CCCCD
What special exponent is used for NaN, +Inf, and -Inf in IEEE 754 Single Precision floating
Convert the following decimal value 86.210 to unsigned fractional binary. 1010110.01
1010110.0011
1010110.0011
1010110.10 1010110.01
The single precision floating point number 0x41680000 is what value in decimal? 3.625
14.5 8.25 20 41.68
Convert 47.62510 to single precision floating point format in hex 0x423F7000
0x423E8000
0x425F4000
0x42F7D000 0x42DF4000
Compute the single precision floating point value of 0.2510 + 10010 0x40D20000
0x42E48000
0x42C88000
0x40A40000 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?
50. (4 points)
EDCBA BADCE BDECA ABCDE ACEDB
The stack is used for all of the following except: Passing more than 4 arguments
Preserving register values
Returning more than 2 values
Storing temporary local data Dynamically allocating global data
CMPE12 S18 Final, Version A
Page 10 of 12
June 11, 2018
51. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
52. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
53. (4 points) call.
54. (4 points) stack?
55. (4 points)
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.
Which register(s) in MIPS must the callee preserve? $k0-$k1
$s0-$s7 $a0-$a3
Values returned from a subroutine are passed in which registers? $k0-$k1
$v0-$v1 $s0-$s7
True or False: The $fp register automatically points to the last value of the $sp after a function
True False
Which combination of MIPS instructions perform a push operation of one element onto the
LW $t0, ($sp) ADDI $sp, $sp, 4 ADDI $sp, $sp, 4 LW $t0, ($sp) SW $t0, ($sp) SUBI $sp, $sp, 4 SUBI $sp, $sp, 4 SW $t0, ($sp)
When does the value in $ra need to be saved by the user? anytime a function is called
any time a branch is executed
when there are nested functions in every program
Instr 1: SRA $t0, $t0, <1>
Instr 2: <2> $t1, ($t2)
Instr 3: LW <3>, ($t2)
Instr 4: ADDI $t3, $t3, -8
Reg Initial
$t0 0xABCDEF00
$t1 0x000A5C11
$t2 0x1001100C
$t3 0xFFFFFFAA
$t4 0xFFFA5C11
After Instr 1
0xF579BDE0
0x000A5C11
0x1001100C
0xFFFFFFAA
0xFFFA5C11
After Instr 2
0xF579BDE0
0x000A5C11
0x1001100C
0xFFFFFFAA
0xFFFA5C11
After Instr 3
0xF579BDE0
0x000A5C11
0x1001100C
0xFFFFFFAA
0x00005C11
After Instr 4 0xF579BDE0 0x000A5C11 0x1001100C <4> 0x00005C11
CMPE12 S18 Final, Version A
Page 11 of 12
June 11, 2018
Account: @ucsc.edu
56. (4 points)
57. (4 points)
58. (4 points)
59. (4 points)
60. (4 points) ⃝ A. ⃝ B.
61. (4 points) ⃝ A. ⃝ B.
62. (4 points) ⃝ A. ⃝ B. ⃝ C. ⃝ D.
What is <1>? $t1
There is not enough information to answer this. 1
What is <2>? SH
There is not enough information to answer this. LB
What is <3>? 0x000A5C11 $t1
There is not enough information to answer this. 0xFFFF
What is <4>?
0x00000064
0xFFFFFFA2
0x00000048
There is not enough information to answer this. 0xFFFFFFB2
True or False: An object file contains only machine langauge instructions. True
True or False: ISR stands for Interrupt Service Routine. True
Which instruction cannot cause an exception? SW
SLL SYSCALL ADD
CMPE12 S18 Final, Version A
Page 12 of 12
June 11, 2018
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com