Unbounded Wildcard Types QuizS2C Home « Unbounded Wildcard Types Quiz

Generics Quiz 6

The quiz below tests your knowledge of the material learnt in Generics - Lesson 6 - Unbounded Wildcard Types.

Question 1 : The following code snippet is an example of an unbounded wildcard type?
<T extends Number>
- <code>T extends Number</code> is an example of a <i>bounded type</i> NOT an <i>unbounded wildcard type</i>.
Question 2 : Which of the following is the wildcard symbol for generics?
- <code>?</code> is the wildcard symbol for generics.
Question 3 : Class literals cannnot be used with generic types?
- Class literals CANNOT be used with generic types.
Question 4 : Can we use primitives with Unbounded Wildcard Type?
- Primitives are invalid for any generic.
Question 5 : Is the following code snippet valid?
if (arg instanceof List<String>)
- You can only use <i>unbounded wildcard type</i> parameters with the <code>instanceof</code> operator.
Question 6 : What is the following code snippet an example of?
public boolean intEqual(WhichType<?> obj) { .. }
- The code is an example of an <i>unbounded wildcard type</em>.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we test your knowledge of bounded wildcard types.