1. One or more objects may be created from a(n)
b.
class
2. Class objects normally have __________ that perform useful operations on their data, but primitive variables do not.
a.
fields
b.
instances
c.
methods
d.
relationships
3. In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the cookies.
a.
object; classes
b.
class; objects
c.
class; fields
d.
attribute; methods
4. A UML diagram does not contain
a.
the class name.
b.
the method names.
c.
the field names.
d.
object names
5. Data hiding, which means that critical data stored inside the object is protected from code outside the object is accomplished in Java by
a.
using the public access specifier on the class methods
b.
using the private access specifier on the class methods
c.
using the private access specifier on the class definition
d.
using the private access specifier on the class fields
6. For the following code, which statement is not true?
public class Sphere
{
private double radius; public double x; private double y; private double z;
}
a. x is available to code that is written outside the Circle class.
b.
radius is not available to code written outside the Circle class.
c.
radius, x, y, and z are called members of the Circle class.
d.
z is available to code that is written outside the Circle class.
7. You should not define a class field that is dependent upon the values of other class fields...
a.
in order to avoid having stale data
b.
because it is redundant
c.
because it should be defined in another class
d.
in order to keep it current
8. What does the following UML diagram entry mean?
+ setHeight(h : double) : void
a. this is a public attribute named Height and is a double data type
b.
this is a private method with no parameters and returns a double data type
c.
this is a private attribute named Height and is a double data type
d.
this is a public method with a parameter of data type double