created: Jan 27, 2006


on Object Data

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. What is a class?

A.    A class is a section of computer memory containing objects.
B.    A class is a section of the hard disk reserved for object oriented programs.
C.    A class is a description of a kind of object.
D.    A class is the part of an object that contains the variables.

2. How many objects of a given class may be constructed in a program?

A.    Only one object is constructed per run of the program.
B.    As many as the program asks for.
C.    Only one per class.
D.    One object per variable.

3. Which of the following is a correct way to construct a String object?

A.    String alpha("Hello Quiz!") ;
B.    String = "Hello Quiz!" ;
C.    String alpha = new "Hello Quiz!" ;
D.    String alpha = new String("Hello Quiz!") ;

4. What is an object?

A.    An object is a chunk of memory that can contain data along with methods to process data.
B.    An object is a tiny box of memory that contains only data.
C.    "Object" is another word for "program".
D.    An object is a description of a potential class.

5. Just as a program starts running, do any objects exist?

A.    Yes. All the objects that the program describes are created just as the program starts running.
B.    Yes. All the objects that the program describes are created when the program is compiled.
C.    No. Objects are a way to think about programming, but don't actually exist.
D.    No. Objects are created one by one as the program runs.

6. Which of the following invokes the method length() of the object referenced by str and stores the result in val?

A.    val = str.length() ;
B.    val = length.str() ;
C.    val = length().str ;
D.    val = length( str ) ;

7. Examine the following:

String myString;

What is myString?

A.    myString is a reference variable.
B.    myString is an object.
C.    myString always points to an object.
D.    myString is a String.

8. What is a reference to an object?

A.    one of the object's methods.
B.    one of the object's variables.
C.    data on where the object is located.
D.    a place in a program that created an object.

9. Examine the following:

String stringA = "Olde Frothingslosh" ;
String stringB;

stringB = stringA.substring(6);

What characters are in the String referred to by stringB?

A.    Olde
B.    Froth
C.    rothingslosh
D.    Frothingslosh

10. What is the class of the type wrapper for primitive type int?

A.    int
B.    INT
C.    Integer
D.    integer

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.