Deck 20: Generic Classes and Methods: a Deeper Look

ملء الشاشة (f)
exit full mode
سؤال
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.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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.
سؤال
Which of the following statements is false?

A) Wildcard type arguments enable you to specify method parameters, return values, variables, and so on, that act as supertypes of parameterized types.
B) A wildcard-type argument is denoted by ?, which represents an "unknown type."
C) Because a wildcard is a type-parameter name, you can use it as a type name throughout a method's body.
D) If a wildcard is specified without an upper bound, then only the methods of type Object can be invoked on values of the wildcard type.
سؤال
Class Number is ________ of both Integer and Double.

A) the subclass
B) composed
C) a descendent
D) the superclass
سؤال
When the compiler translates a generic method into Java bytecodes, it uses __________ to replace the type parameters with actual types.

A) erasure.
B) compile-time type replacement.
C) compile-time type checking.
D) compile-time type safety.
سؤال
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.
سؤال
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.
سؤال
__________ 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.
سؤال
A wildcard type argument is denoted by a(n) __________.

A) asterisk (*).
B) underscore (_).
C) question mark (?).
D) caret (^).
سؤال
When compiling a generic class, the __________ option should be used to view the unchecked warning message.

A) -Xlint:unchecked.
B) -X:unchecked.
C) -warning:unchecked.
D) -unchecked.
سؤال
Which statement is false?

A) A generic method may be overloaded.
B) A class can provide two or more generic methods that specify the same method name but different method parameters.
C) A generic method cannot be overloaded by non-generic methods.
D) When the compiler encounters a method call, it searches for the method declaration that most precisely matches the method name and the argument types specified in the call.
سؤال
One generic Stack class could be the basis for creating many Stack classes,g., Stack<Double>, Stack<Integer> and Stack<Employee>. These classes are known as __________.

A) subclasses.
B) generic subclasses.
C) concrete classes.
D) parameterized classes.
سؤال
__________ is the default upper bound of a type parameter.

A) String.
B) Comparable.
C) Class.
D) Object.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/13
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 20: Generic Classes and Methods: a Deeper Look
1
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.
A
2
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.
angle brackets (< and >).
3
Which of the following statements is false?

A) Wildcard type arguments enable you to specify method parameters, return values, variables, and so on, that act as supertypes of parameterized types.
B) A wildcard-type argument is denoted by ?, which represents an "unknown type."
C) Because a wildcard is a type-parameter name, you can use it as a type name throughout a method's body.
D) If a wildcard is specified without an upper bound, then only the methods of type Object can be invoked on values of the wildcard type.
Because a wildcard is a type-parameter name, you can use it as a type name throughout a method's body.
4
Class Number is ________ of both Integer and Double.

A) the subclass
B) composed
C) a descendent
D) the superclass
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
5
When the compiler translates a generic method into Java bytecodes, it uses __________ to replace the type parameters with actual types.

A) erasure.
B) compile-time type replacement.
C) compile-time type checking.
D) compile-time type safety.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
6
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
7
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
8
__________ 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
9
A wildcard type argument is denoted by a(n) __________.

A) asterisk (*).
B) underscore (_).
C) question mark (?).
D) caret (^).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
10
When compiling a generic class, the __________ option should be used to view the unchecked warning message.

A) -Xlint:unchecked.
B) -X:unchecked.
C) -warning:unchecked.
D) -unchecked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which statement is false?

A) A generic method may be overloaded.
B) A class can provide two or more generic methods that specify the same method name but different method parameters.
C) A generic method cannot be overloaded by non-generic methods.
D) When the compiler encounters a method call, it searches for the method declaration that most precisely matches the method name and the argument types specified in the call.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
12
One generic Stack class could be the basis for creating many Stack classes,g., Stack<Double>, Stack<Integer> and Stack<Employee>. These classes are known as __________.

A) subclasses.
B) generic subclasses.
C) concrete classes.
D) parameterized classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
13
__________ is the default upper bound of a type parameter.

A) String.
B) Comparable.
C) Class.
D) Object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 13 في هذه المجموعة.