Quiz

The following questions will see whether you have the attributes and behavior to understand object-oriented coding techniques.

Questions

1:

In a Java class, a method is an example of what?

  1. Attributes
  2. Statements
  3. Behavior
2:

If you want to make a variable a class variable, what statement must you use when it is created?

  1. new
  2. public
  3. static
3:

What is the name for the part of a program in which a variable lives?

  1. Its nest
  2. The scope
  3. Variable valley

Answers

A1:

c. A method is made up of statements, but it's an example of behavior.

A2:

c. If the static statement is left off, the variable will be an object variable instead of a class variable.

A3:

b. The compiler fails with an error when a variable is used outside of its scope.

      
Comments