Chapter 10 Object–Oriented Thinking
Section 10.4 Class Relationships
1. is attached to the class of the composing class to denote the aggregation relationship with the
composed object.
a. An empty diamond
b. A solid diamond
c. An empty oval
d. A solid oval
#
2. An aggregation relationship is usually represented as in .
a. a data field/the aggregating class
b. a data field/the aggregated class
c. a method/the aggregating class
d. a method/the aggregated class
#
67. Composition means .
a. that data fields should be declared private
a. that data fields should be declared private
b. that a class extends another class
c. that a variable of supertype refers to a subtype object
d. that a class contains a data field that references another object
#
Section 10.7 Processing Primitive Data Type Values as Objects
3. Which of the following statements will convert a string s into i of int type?
a. i = Integer.parseInt(s);
b. i = (new Integer(s)).intValue();
c. i = Integer.valueOf(s).intValue();
d. i = Integer.valueOf(s);
e. i = (int)(Double.parseDouble(s));
#
4. Which of the following statements will convert a string s into a double value d?
a. d = Double.parseDouble(s);
b. d = (new Double(s)).doubleValue();
c. d = Double.valueOf(s).doubleValue();
d. All of the above.
#
6. Which of the following statements are correct?
a. Integer.parseInt(“12”, 2);
b. Integer.parseInt(100);
c. Integer.parseInt(“100”);
d. Integer.parseInt(100, 16);
e. Integer.parseInt(“345”, 8);