Created 07/03/03; edited 02/17/08


on Branch and Comparison Pseudoinstructions

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

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. Translate the following pseudoinstruction into basic instructions:

beqz   $t0,spot

A.   
beqz   $t0,$0,spot
B.   
beqz   $t0,$t0,spot
C.   
beq   $t0,spot
D.   
beq   $t0,$0,spot

2. With what addresses may the b instruction be used with?

A.    Any address in memory.
B.    Any address in the first 64K of memory.
C.    Any address within 32K of the current address.
D.    Any address within the current program.

3. What format of data do the branch instructions assume?

A.    unsigned integers only
B.    two's complement integers only
C.    Depending on the instruction, unsigned integers or two's complement integers.
D.    Depending on the instruction, unsigned integers, two's complement integers, or abstract bit patterns.

4. Which of the following instruction sequences computes the absolute value of the integer in $t0? (Branch delays are turned off.)

A.   
     bgez  $t0,pos
     subi  $t0,$0,$t0
pos:
B.   
     bgez   $t0,pos
     subu   $t0,$0,$t0
pos:
C.   
     blez   $t0,pos
     subu   $t0,$0,$t0
pos:
D.   
     bnez   $t0,pos
     subu   $t0,$0,$t0
pos:

5. What register do some of the branch instructions use when they are translated into basic instructions?

A.    $t0
B.    $a0
C.    $at
D.    hi

6. Pick the syntactically incorrect instruction from the following:

A.    bge $t1,$t3,lbl
B.    bge $t1,-98,lbl
C.    bge $t1,value,lbl
D.    bge $t1,124034,lbl

7. Pick the syntactically incorrect instruction from the following:

A.    slt $v0,$s1,123
B.    slt $v0,$s1,$s3
C.    slt $v0,$s1,0x123
D.    slt $t1,$s1,lbl

8. Is it possible that a given pseudoinstruction could be translated into several different sequences of basic instructions?

A.    No. There is only one possible translation of any given pseudoinstruction.
B.    Yes. Each pseudoinstruction asks for a little program of basic instructions, and many little programs do the same thing.

9. Here is a fragment of code:

         .data        
array:   .byte   12,23,45,12,-5,72

Which of the following pseudoinstructions loads register $s1 with the 45?

A.   
li    $t0,2
lw    $s1,array($t0)
B.   
li    $t0,8
lw    $s1,array($t0)
C.   
li    $t0,2
lb    $s1,array($t0)
D.   
li    $t0,2
lw    $s1,$t0(array)

10. Here is a fragment of code. (Note the subtle change from the previous question.)

         .data        
array:   .word   12,23,45,12,-5,72

Which of the following pseudoinstructions loads register $s1 with the 45?

A.   
li    $t0,2
lw    $s1,array($t0)
B.   
li    $t0,8
lw    $s1,array($t0)
C.   
li    $t0,2
lb    $s1,array($t0)
D.   
li    $t0,2
lw    $s1,$t0(array)

11. Here is a fragment of code.

         .data        
string:  .asciiz   "Hello Virtual World!"

Which of the following pseudoinstructions loads register $s1 with the 'V'?

A.   
li    $t0,5
lw    $s1,string($t0)
B.   
li    $t0,6
lb    $s1,string($t0)
C.   
li    $t0,7
lb    $s1,string($t0)
D.   
li    $t0,12
lw    $s1,$t0(string)

12. Where do indexes begin for arrays in C or Java?

A.    0
B.    1
C.    at any index the programmer picks
D.    at any multiple of four

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.