- •Import java.Util.*;
- •I, II, and III
- •I only
- •I, II, and III
- •I, II, and III
- •II only
- •III only
- •I and II only
- •II only
- •I and III only
- •I only
- •II and III only
- •I only
- •I and II only
- •I and III only
- •I, II, and III
- •II only
- •II only
- •I only
- •II only
- •II and III only
- •I and III only
- •I and II
- •I, II, and III
I and II
II only
None
I only
Which of the following identifiers follow(s) Sun's naming conventions for Java constants?
START_DATE
Serving_Size
AnnualFee
I, II, and III
I and II only
I and III only
I only
Which of the following identifiers follow(s) Sun's naming conventions for Java variables?
myvalue
myValue
my_value
II and III only
I and II only
I only
II only
Which of the following follow(s) Sun's naming conventions for Java methods?
getValue();
GetValue();
GET_VALUE();
II only
I, II, and III
I and II only
I only
Which of the following lines follow(s) Sun's guidelines for documenting input parameters in a Javadoc comment?
* @param foo the value to be tested
* @param int foo
* @param the value to be tested
II only
III only
None
I only
Which of the following lines follow(s) Sun's guidelines for documenting the return value in a Javadoc comment?
* @return foo the result of the calculations
* @return the result of the calculations
* @return int foo the result of the calculations
I only
III only
None
II only
If a Java class contains a Boolean variable named rhodesScholar, then the name of the associated accessor method should be
getRhodesScholar
retrieveRhodesScholar
getRhodesScholarFlag
isRhodesScholar
Which of the following can be represented in a UML class diagram?
Class name
Class attributes
Class methods
I and II only
II and III only
I and III only
I, II, and III
Consider the following UML class diagram with numbered compartments.
1 |
2 |
3 |
Following UML specifications, a private method toggle() would be represented by the element _____ in compartment _____.
+toggle(), 3
-toggle(), 2
+toggle(), 2
-toggle(), 3
Consider the following UML class diagram.
The diagram describes a(n) _____ association.
one-way
one-to-many
aggregation
binary
Consider the following UML class diagram.
Which of the following kinds of associations is not indicated by the class diagram?
Binary
One-to-one
One-way
Specialization/generalization
Consider the following UML class diagram.
Which of the following may be substituted for X in the above diagram to represent a multiplicity between A and B?
1
0..*
1..*
II and III only
III only
I and II only
I, II, and III
In object-oriented design, types of multiplicity for associations among classes include which of the following?
One-to-one
One-to-many
Many-to-many
II and III only
I and II only
I and III only
I, II, and III
In a UML diagram, a specialization/generalization relationship is characterized by a line between two classes and a _____ next to the _____ class.
diamond, generalization
triangle, specialization
diamond, specialization
triangle, generalization
Consider the following UML diagrams.
Which of the diagrams represents a specialization/generalization relationship in which X is the specialization of Y?
C
D
A
B
Consider the following class definitions.
public class Publication {
private String author;
}
public class Book extends Publication {
private int edition;
public Book(int edition) {
this.edition = edition;
}
public int getEdition() {
return edition;
}
}
Based on these class definitions, which of the following program segments will compile?
Publication publication = new Book(2);
int edition = publication.getEdition();
Publication publication = new Book(2);
int edition = ((Book) publication).getEdition();
Book book = new Book(2);
if (book.getEdition() instanceof int) {
System.out.println(book.getEdition());
}