Chapter 20 Generic Classes and Methods
20.1 Q1: __________ enable programmers to specify, with a single method declaration, a set of related
methods.
a. Overloaded methods.
b. Overriden methods.
c. Generic methods.
d. Generics.
20.1 Q2: Generics provide __________ that allows programmers to catch invalid types at compile time.
a. compile-time type safety.
b. compile-time exception handling.
c. compile-time error checking.
d. run-time type safety.
20.2 Q1: Which of the following statements is true?
a. Overloaded methods are often used to perform similar operations on different types of data.
b. When the compiler encounters a method call, it attempts to locate a method declaration with a name and
parameters that are compatible with the argument types in the method call.
c. Both a) and b) are true.
d. Neither a) nor b) is true.
20.3 Q1: All generic method declarations have a type parameter section delimited by __________.
a. curly brackets ({ and }).
b. angle brackets (< and >).
c. square brackets ([ and ] ).
d. parenthesis.
20.3 Q2: Which statement is false?
a. When declaring a generic method, the type parameter section is placed before the return type of the
method.
b. Each type parameter section contains only one type parameter.
c. A type parameter is an identifier that specifies a generic type name.
d. Type parameters can represent only reference types.
20.4 Q1: __________ is the default upper bound of a type parameter.
a. String.