Created 07/03/03; edited: 06/22/15


On Objects

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 is the name for a list of entry points used to call subroutines?

A.    call table
B.    entry table
C.    call list
D.    jump table

2. Here is a list of five entry points.

jtab:    .word  sub0
         .word  sub1
         .word  sub2
         .word  sub3
         .word  sub4

Which of the following sequences calls sub3?

A.   
         lw    $t1,jtab+3
         jalr  $t1
B.   
         lw    $t1,jtab+12
         jalr  $t1
C.   
         jal  jtab+3
D.   
         jal  jtab+12

3. Where does the instruction jalr $t0 put the return address?

A.    $t0
B.    $sp
C.    $ra
D.    $jr

4. What is it called when the machine code for a subroutine is loaded only when a running program requires it?

A.    run time loading
B.    linking
C.    library loading
D.    dynamic loading

5. Does each software object of an executing program need a copy of its methods.

A.    No--all objects of any type can use any method in the system.
B.    No--all objects of the same type can share the code for their methods.
C.    Yes--to enforce modularity each object has its own copy of each method.
D.    Yes--in order to access the data of an object, the code must be part of it.

6. What is a DISadvantage when running programs share subroutines?

A.    The subroutines need to be written only once.
B.    The sizes of the programs is reduced.
C.    Calling a subroutine is more complicated.
D.    System resources managed by the subroutines can be effectively coordinated.

7. What are the characteristics of a software object?

A.    A software object has identity, state, and behavior.
B.    A software object is any block of main memory.
C.    A software object has variables, values, and entry points.
D.    A software object has data and methods to initialize the data.

8. Here is an object constructed in static memory:

          .data
object:   .word    print     # methods
          .word    read
          .word    clear
          .word    0         # data
          .word    7

Which of the following invokes the read method of the object? (Assume that the method expects the address of the object in $a0.)

A.   
          la       $a0,object
          lw       $t0,0($a0) 
          jalr     $t0 
B.   
          la       $a0,object
          lw       $t0,4($a0) 
          jalr     $t0 
C.   
          la       $a0,object
          lw       $t0,1($a0) 
          jr       $t0 
D.   
          lw       $a0,object
          lw       $t0,8($a0) 
          jr       $t0 

9. Here is an object constructed in static memory:

          .data
object:   .word    print     # methods
          .word    read
          .word    clear
          .word    0         # data
          .word    7

Which of the following implements the clear method of the object? The method clears the second word of data to zero. (Assume that the method expects the address of the object in $a0.)

A.   
clear:    sw   $0,4($a0)
          jr   $ra
B.   
clear:    lw   $t1,8($a0)
          jalr $t1
          jr   $ra
C.   
clear:    lw   $t1,8($a0)
          sw   $t1,16($a0)
          jr   $ra
D.   
clear:    sw   $0,16($a0)
          jr   $ra

10. If a program is changed so that one new method is added to an object type, how much larger does each object of that type become?

A.    Larger by as many bytes as it takes for the code of the new method.
B.    0 bytes
C.    4 bytes
D.    This is impossible to estimate.

   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.