Created 6/26/03; revised 07/07/15


Quiz on Jump and Branch Instructions

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.



1. What are the three steps in the machine cycle?

A.    increment the PC; fetch the instruction; execute the instruction
B.    fetch the instruction; execute the instruction; increment the PC
C.    execute the instruction; fetch the instruction; increment the PC
D.    fetch the instruction; increment the PC; execute the instruction

2. What are the four bytes immediately following a jump instruction called?

A.    fetch delay slot
B.    pipeline delay slot
C.    branch delay slot
D.    PC advance slot

3. What is a pipeline?

A.    Several words of data from memory are moved into the processor before instructions need them.
B.    Several sequential instructions are simultaneously prepared for execution while one instruction finishes its execution.
C.    A single instruction is divided into four phases and each phase is executed in one machine cycle.
D.    Multiple items of data are sent down the system bus like water in a pipe.

4. Say that a sll instruction is located in memory at address 0x400100, and an add instruction is located in memory at address 0x400104. After the add instruction executes, what value will be in the PC?

A.    0x400100
B.    0x400104
C.    0x400105
D.    0x400108

5. Say that a j (jump) instruction is located in memory at address 0x400100, and a sll instruction is located in memory at address 0x400104. After the j instruction executes, what value will be in the PC?

A.    0x400100
B.    0x400101
C.    0x400102
D.    0x400104

6. Here is a schematic program loop.

AddressInstruction
(details omitted)
PC just after this
instruction has executed
(at the bottom of the cycle)
.......................... 00450008
00450008 add 0045000C
0045000C store 00450010
00450010 jump 0x00450008 004500___
00450014 no-op 004500___

What numbers go into the two blanks?

A.   
14
08
B.   
14
00
C.   
00
08
D.   
14
18

7. Here is a 32-bit j instruction. The first 6 bits are the op-code.

000010 00 0001 0000 0000 0000 0000 1000

Here is the value of the PC while the target address is being constructed:

0000 1000 0001 0000 0000 1100 0110 1000

What address does the j put into the PC?

A.    0000 00 0001 0000 0000 0000 0000 1000 00
B.    0000 1000 0001 0000 0000 1100 0110 1000
C.    0000 10 0001 0000 0000 1100 0110 1000 00
D.    1000 00 0001 0000 0000 0000 0000 1000 00

8. Examine the following program fragment. The program is to add $5 and $6 together only if they are not equal.

         ori   $5,$0,8            # load $5 with 8
         ori   $6,$0,9            # load $6 with 9
      
         ____  $5,$6,spot
      
         ____  $0,$0,0            # branch delay slot
      
         addu  $8,$5,$6           # $8 = $5 + $6      
      
spot:  

Pick instructions to fill the blanks.

A.    beq ; addu
B.    bne ; sll
C.    bne ; addu
D.    beq ; sll

9. Here is an if-then-else structure. The code is to compare $10 and $11. If these registers contain the same bit pattern, set register $7 to 1. Otherwise set $7 to 0.

        ori   $10,$0,123
        ori   $11,$0,123
        
        ___   $10,$11,_____
        sll   $0,$0,0
        ori   $7,$0,0
        j     _____
        sll   $0,$0,0

equal:  ori   $7,$0,1

join:   .....

Which choices should fill the blanks?

A.    bne ; equal ; join
B.    beq ; join ; equal
C.    beq ; equal ; join
D.    bne ; join ; equal

10. Say that registers $5 and $6 each contain an ASCII character in the low order byte. Can the beq instruction be used to compare the characters?

A.    Yes, because beq will recognize the character data and do a character comparison.
B.    No, because beq only works with two's complement integers.
C.    No, because beq only works with full 32-bit data.
D.    Yes, because beq compares bit patterns regardless of what they represent.

The number you got right:       Percent Correct:       Letter Grade:   


Click here

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.