CMPE 12 Final – Version A Spring 2019
Combinational Logic & Boolean Algebra
1. True or False: These two circuits are logically equivalent.
⃝x A. True ⃝ B. False
2. Select the Boolean expression(s) matching the grey filled areas of this Venn diagram.
CruzID:
@ucsc.edu
⃝ A.
⃝ B.
⃝x C.
⃝ D.
⃝ E.
SCF+S ̄CF ̄+SC ̄F+S ̄C ̄F SCF+C ̄F+S ̄CF ̄
S ̄ C ̄ F ̄ + S F ̄ + S ̄ F C
Correct answer not listed S ̄C ̄F ̄+S ̄F+SF ̄C+CF
Page 1 of 15
3. Which circuit matches this truth table?
CruzID: @ucsc.edu
A
B
C
D
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
1
1
1
1
0
⃝ A.
⃝x B.
⃝ C.
⃝ D.
⃝ E.
Page 2 of 15
4. What kind of multiplexor has 3 select lines? ⃝ A. 3-to-1
⃝ B. 2-to-1 ⃝ C. 16-to-1 ⃝x D. 8-to-1 ⃝ E. 9-to-1
5. What equation does this PLA represent?
⃝ A. (A ̄+B+C)(A+B ̄+C ̄)(A+B+C)(A ̄+B ̄+C ̄) ⃝ B. (A ̄+B ̄+C ̄)(A+B+C ̄)(A ̄+B+C ̄)(A ̄+B ̄+C) ⃝ C. (A ̄+B ̄+C)(A ̄+B+C ̄)(A+B ̄+C ̄)(A+B ̄+C) ⃝ D. (A+B+C)(A+B ̄+C ̄)(A ̄+B+C ̄)(A ̄+B ̄+C) ⃝x E. (A+B+C)(A ̄+B+C)(A+B ̄+C)(A+B+C ̄)
Sequential Logic
6. What
device does this timing diagram represent?
CruzID: @ucsc.edu
⃝x A.
⃝ B.
⃝ C.
⃝ D.
⃝ E.
D flip flop, edge triggered D-Rlatch
D latch, level triggered S-R latch, active high S-R latch, active low
Page 3 of 15
7. Which of the following circuits can form a latch?
⃝x A.
⃝ B.
⃝ C.
⃝ D.
⃝ E.
CruzID: @ucsc.edu
Page 4 of 15
Integers
8. What is 12304 in base 32? Assume A32 = 10, B32 = 11, … , G32 = 16, etc. ⃝x A. 3C32
⃝ B. 3D32
⃝ C. BT32
⃝ D. 3C032
⃝ E. 4D32
⃝x B.
⃝ C.
⃝ D.
⃝ E.
9. What ⃝ A.
is the range of values for an integer in 8-bit sign-magnitude representation? -127 to 128
-127 to 127 0to255 -128 to 127 -128 to 128
10. Extendthefollowing4-bitsign-magnitudevalueto8-bits:0b1101 ⃝ A. 0b11111101
⃝ B. 0b00001101 ⃝ C. 0b10001101 ⃝x D. 0b10000101 ⃝ E. 0b00001101
11. Whatisthedecimalequivalentofthe8-bittwo’scomplementnumber0b10010111? ⃝x A. -105
⃝ B. -151 ⃝ C. 151 ⃝ D. 105 ⃝ E. -104
12. Convert2103tobase5. ⃝ A. 215
⃝ B. 4110 ⃝ C. 2105 ⃝ D. 2115 ⃝x E. 415
13. Whatisthelowestnumberthatcanberepresentedusing8-bitbias127representation? ⃝ A. 127
⃝x B. -127 ⃝ C. -256 ⃝ D. 0
⃝ E. -128
14. Convertthe8-bittwo’scomplementnumber0b11001101to8-bitsign-magnituderepresentation. ⃝ A. 0b11001100
⃝ B. 0b01001100 ⃝ C. 0b00110011 ⃝ D. 0b01001101 ⃝x E. 0b10110011
Page 5 of 15
CruzID:
@ucsc.edu
CruzID:
@ucsc.edu
15. Whatisthelargestunsignedintegera6-bitregistercanhold? ⃝ A. 0x8
⃝ B. 0xF ⃝ C. 0xFF ⃝ D. 0xFFF ⃝x E. 0x3F
Fractions & Floating Point
16. WhichIEEE754singleprecisionfloatingpointnumberisfurthestfromzero? ⃝ A. 0x4479C000
⃝x B. 0xC47A0000 ⃝ C. 0x41300000 ⃝ D. 0xC25C0000 ⃝ E. 0x431B0000
17. Convertthedecimalvalue51.810tounsignedfractionalbinary ⃝x A. 110011.1100
⃝ B. 110011.0001 ⃝ C. 110011.1000 ⃝ D. 110011.1100 ⃝ E. 110011.0001
18. WhichIEEE754singleprecisionfloatingpointnumberhasthelargestpositiveexponent? ⃝ A. 0x42903333
⃝x B. 0x43F7999A ⃝ C. 0xC3018000 ⃝ D. 0xC2366666 ⃝ E. 0x425A6666
19. Convertthefloatingpointnumber0x40400000tounsignedbinary. ⃝ A. 0b101
⃝ B. 0b001 ⃝x C. 0b011 ⃝ D. 0b110 ⃝ E. 0b010
Page 6 of 15
Strings
20. WhatisprintedtothescreeninthisMIPSprogram?
.data
P1: .space 27
P2: .asciiz “ABCDEFGHIJKLMNOPQRSTUZWXYZ”
.text
L1: la $t0, P1
addi $t1, $zero, 26
addi $t2, $zero, 97
L2: sb $t2, ($t0)
addi $t1, $t1, -1
beqz $t1, GLUE
addi $t0, $t0, 1
addi $t2, $t2, 1
b L2
GLUE: li $v0, 4
la $a0, P1
syscall
li $v0, 10
syscall
# ascii value for ’a’
# increment address
# increment ascii value
⃝x A.
⃝ B.
⃝ C.
⃝ D.
⃝ E.
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUZWXYZ
Correct answer not listed; runtime error abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUZWXYZ 27
21. DecodethefollowingASCIIstring.Valuesaregiveninhex:
49 20 68 61 76 65 20 74 68 65 20 68 69 67 68 20 67 72 6f 75 6e 64 21.
⃝x A.
⃝ B.
⃝ C.
⃝ D.
⃝ E.
I have the high ground!
I have no idea what the other sentences mean. It’s over Anakin!
You underestimate my power!
Don’t try it.
Page 7 of 15
CruzID:
@ucsc.edu
Arithmetic & Logical Operations
22. Whatistheresultofabit-wiseXORperformedonthefollowing8-bitbinarynumbers:
0b 1 0 1 1 0 1 1 0 ⊕0b 1 0 1 0 1 0 1 0 ————————————
⃝ A. 0b01000001 ⃝x B. 0b00011100 ⃝ C. 0b10111110 ⃝ D. 0b11100011 ⃝ E. 0b10100010
23. What is the result of a shift right arithmetic by three and a shift right logical by three of the 8-bit number 10010110 = 0x96? The operations are performed independently of each other.
⃝ A.
⃝ B.
⃝ C.
⃝ D.
⃝x E.
0x12 and 0x12 0xB0 and 0xB7 0x12 and 0xF2 0xB7 and 0xB0 0xF2 and 0x12
24. Whichofthese8-bittwo’scomplementcomputationshascarryoutbutnooverflow?Selectallthatapply. ⃝ A. 0x80 + 0x80 = 0x00
⃝x B. 0xFB + 0xCC = 0xC7
⃝ C. 0x7F + 0x70 = 0xEF
⃝x D. 0x89 + 0xFF = 0x88 ⃝x E. 0xA7 + 0x61 = 0x08
Memory
25. Assumealittleendianmemorysystem.Whatisstoredin$s0afterthefollowingprogramisexecuted?
.data
flux: .word 0xC0FFEEEE
some_data: .byte 0xFE 0xED 0xBB
some_more_data: .byte 0xCE 1
.text
la $t1 some_more_data
lw $t0 ($t1)
sb $t0 2($t1)
lw $s0 ($t1)
2 0x00
⃝ A.
⃝ B.
⃝x C.
⃝ D.
⃝ E.
0x00CE01CE
0x000200CE
Answer not listed; memory alignment error 0xCE010000
0xCE01CE00
Page 8 of 15
CruzID:
@ucsc.edu
CruzID: @ucsc.edu
26. Howmanybitsareneededtorepresenttheaddressinabyte-addressablememoryspacewithcapacityof5TB?
⃝x A.
⃝ B.
⃝ C.
⃝ D.
⃝ E.
43
Correct answer not listed 33
20
40
27. Howmany32-bitintegerscanbestoredinthearraylabeledmyArrayasshownbelow: .data
msg: .asciiz “Good luck!!”
myArray: .space 20
tacos:
⃝ A. 80 ⃝x B. 5 ⃝ C. 4 ⃝ D. 10 ⃝ E. 2.5
MIPS Instruction Set Architecture
28. Howcanwecreateamaskforbits4:14of$t0? ⃝x A. andi $t0 $t0 0x7ff0
⃝ B. andi $t0 $t0 0x800f
⃝ C. ori $t0 $t0 0x800f
⃝ D. ori $t0 $t0 0x7ff0 ⃝ E. xori $t0 $t0 0x7ff0
29. Whatisthevaluein$10afterthefollowinginstructionsareexecuted? ADDI $10 $0 11
SLL SRL
⃝x ⃝ ⃝ ⃝ ⃝
$10 $10 30
$10 $10 29
A. 0xFFFE B. 0xFFFF C. 0x000B D. 0x000F E. 0x000E
.asciiz “Tacos and 2SC make me happy!!”
30. DecodethefollowingMIPSinstruction.Selectallthatapply.
0x8D090008
⃝ A. sw $8 8($9) ⃝B.addi$8 $9 8 ⃝xC.lw $t18($t0)
⃝ D. sw $t1 8($t0)
⃝ E. lw $t0 8($t1)
Page 9 of 15
CruzID: @ucsc.edu 31. Assume$s0=0x6and$t7=0xA.Whatvalueisstoredin$t7afterthefollowinginstruction?
div $t7 $s0
⃝ A. 0x1 ⃝ B. 0x6 ⃝ C. 0x4 ⃝ D. 0x0 ⃝x E. 0xA
32. DecodethefollowingMIPSinstruction.Selectallthatapply.
0x012F4020
⃝xA.ADD$8$9 $15 ⃝B. AND$9 $15 $8 ⃝ C. ADD $t1 $t7 $t0 ⃝x D. ADD $t0 $t1 $t7 ⃝E. ADD$9 $15 $8
33. WhatisthesizeofaregisterinMIPS32?Selectallthatapply.
⃝ A.
⃝ B.
⃝x C. ⃝x D. ⃝x E.
64bits 8bytes 32 bits
8 nybbles 4 bytes
34. Whatisthevaluein$t0afterthefollowinginstructionsareexecuted?
li $t0, 5
li $t1, 10
xor $t0, $t0, $t0
loop: nop
addi $t0, $t0, 1
subi $t1, $t1, 1
bgtz $t1, loop
li $v0, 10
syscall
⃝ A. 16 ⃝ B. 15 ⃝x C. 10 ⃝ D. 5 ⃝ E. 0
Page 10 of 15
CruzID: @ucsc.edu 35. Whatisthevalueofregister$v0afterthefollowinginstructions?
addi $t1 $zero 8
addi $s0 $zero 50
addi $v0 $zero 0
loop: nop
andi $a0 $s0 0
add $v0 $v0 $a0
srl $t1 $t1 1
bnez $t1 loop
⃝ A. 2
⃝ B. 20
⃝ C. 18
⃝x D. 0 ⃝ E. 50
# 50 = 0b110010
Page 11 of 15
CruzID: @ucsc.edu
Stack & Subroutines
36. Whichinstructionwilltheprogramcounterpointtoafterthe“jr$ra”instructionexecutesinthePromptuser subroutine?
.data
P1: .asciiz “Input: ”
N1: .word
.text
la $a0, P1
la $a1, N1
jal Prompt_user
halt: li $v0, 10
syscall
PrintString:
li $v0, 4
syscall
jr $ra
Prompt_user:
jal PrintString
⃝ A.
⃝ B.
⃝x C.
⃝ D.
⃝ E.
move $a0, $a1
li $v0, 8
syscall
jr $ra
jal Prompt user
jal PrintString
move $a0, $a1
Answer not listed; code doesn’t assemble halt: li $v0, 10
Page 12 of 15
37. Which combination of MIPS instructions perform a push operation of two elements (in $t0 and $t1) on the stack? Select all that apply.
⃝ A. sw $t0, ($sp) sw $t1, 4($sp)
subi $sp,
subi $sp,
sw $t0,
sw $t1, 4($sp)
⃝xB. ⃝xC.
⃝ D. lw
lw $t1,
addi $sp, ⃝E. addi $sp, lw $t0, addi $sp, lw $t1,
$sp, 8 ($sp)
subi $sp,
sw $t0,
subi $sp,
sw $t1, ($sp)
$sp, 8
$sp, 4 ($sp)
$sp, 4
$t0, ($sp)
($sp)
$sp, 8
$sp, 4
($sp) $sp, 4
($sp)
Page 13 of 15
CruzID: @ucsc.edu
⃝ A.
⃝ B.
⃝ C.
⃝x D. ⃝ E.
0x0B0C
0x10
Not enough information given. 0x02C3
0x11
40. Assumethevaluesonwires’1’,’5’,’10’,’11’and’12’are0x08,0x10,0xAF,0xBEand0xBErespectively. Which instruction could correspond to these values?
⃝ A.
⃝ B.
⃝x C.
⃝ D. LH $7 10($8)
⃝ E.
Not enough information given.
LW $s0 16($s0)
ADDI $t0 $t0 0x10
LB $t1 16($t0)
Page 14 of 15
CruzID: @ucsc.edu
Data Path
Refer to this MIPS data path for the next three questions:
38. Assume$s0=0xAB,$s1=0x11andSH $s1 8($s0)isexecuted.Whatisthevalueonwire’8’?
⃝ A. ⃝x B.
⃝ C.
⃝ D.
⃝ E.
Not enough information given.
0x11
0xAB
0x08
0x10
39. Assumeinstruction0x150802C3isexecuted.Whatisthevalueonwire’4’?
Command Line Interface
41. TrueorFalse:Listingthefilesofadifferentdirectorychangesthedirectoryyouarein. ⃝x A. False
⃝ B. True
42. TrueorFalse:Thecommand’mv’canbeusedtorenameafile. ⃝x A. True
⃝ B. False
Page 15 of 15
CruzID:
@ucsc.edu