Upper Bounded Wildcard Type QuizS2C Home « Upper Bounded Wildcard Type Quiz

Generics Quiz 7

The quiz below tests your knowledge of the material learnt in Generics - Lesson 7 - Upper Bounded Wildcard Type.

Question 1 : If we had a scenario where we only want a method to work on a particular class or subclasses of it which generic type would we use?
- If we had a scenario where we only want a method to work on a particular class or subclasses of it we would use the generic <i>upper bounded wildcard type</i> type.
Question 2 : The following code snippet is an example of an upper bounded wildcard type?
<? super Number>
- <code>? super Number</code> is an example of a <i>lower bounded wildcard type</i> NOT <i>upper bounded wildcard type</i>.
Question 3 : Is the following code snippet valid?
<? extends Object>
- <code>? extends Object</code> IS valid but would allow any type so is not recommended when using an <i>upper bounded wildcard type</i>.
Question 4 : Which reserved word is used with with an upper bounded wildcard type ?
- The <code>extends</code> reserved word is used with with an <i>upper bounded wildcard type</i>.
Question 5 : Upper bounded wildcard type checks allow for the Object type?
- The <i>upper bounded wildcard type</i> checks DO ALLOW for the <code>Object</code> type if that is what is being extended from, which means everything, so is pointless when using an <i>upper bounded wildcard type</i>.
Question 6 : The following code snippet is an example of an upper bounded wildcard type?
<? extends Number>
- <code>? extends Number</code> IS an example of an <i>upper bounded wildcard type</i>.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we test your knowledge of generic methods.