Generic Interfaces QuizJ8 Home « Generic Interfaces Quiz

The questions in this quiz on Java are on the topics covered in the Generics section of the site. The table below lists the lesson used for each quiz, a description of the lesson content and the quiz number and questions associated with that lesson.

Lesson Summary

Click on a lesson in the table to go to that lesson for a refresher on the topics for that quiz.

Click on a quiz in the table to go straight to the quiz for a particular lesson.

Generics Lessons Description Quiz Info.
Lesson 1 - Generic BasicsIn our first lesson on on generics we unravel the terminology behind java generics and look at some of the strange syntax we get when using it.Quiz1
7 questions
Lesson 2 - Raw/Generic Type ComparisonIn this lesson we compare raw and generic types to see the advantages of using generics.Quiz2
6 questions
Lesson 3 - Generic InterfacesIn this lesson we look at generic interfaces and how to apply them in our Java code.This quiz.
6 questions
Lesson 4 - Generic ClassesThis lesson is about generic classes.Quiz4
6 questions
Lesson 5 - Bounded TypeIn this lesson on Java generics we investigate invariance and Bounded Type.Quiz5
7 questions
Lesson 6 - Unbounded Wildcard TypeIn this lesson we learn about generic Unbounded Wildcard Type.Quiz6
6 questions
Lesson 7 - Upper Bounded Wildcard TypeThis lesson on generics is about upper bounded wildcard types.Quiz7
6 questions
Lesson 8 - Lower Bounded Wildcard TypeThis lesson on generics is about lower bounded wildcard types.Quiz8
6 questions
Lesson 9 - Generic MethodsThis lesson is about generic methods.Quiz9
6 questions
Lesson 10 - Generic ConstructorsIn our final lesson on generics we look at generic constructors.Quiz10
7 questions

Generics Quiz 3

The quiz below tests your knowledge of the material learnt in Generics - Lesson 3 - Generic Interfaces.

Question 1 : When creating your own generic interfaces it is best practice to use pneumonics for the formal type parameter rather than multiple letters.?
- When creating your own generic interfaces IT IS best practice to use pneumonics for the formal type parameter rather than multiple letters.
Question 2 : Which of the following code snippets is valid?
interface SimpleGenericInterface<? extends Number> //1
interface SimpleGenericInterface<T> //2
interface SimpleGenericInterface<?> //3
- Only 2 is valid syntax.
Question 3 : Is the following code snippet valid?

public class SimpleGenericInterfaceImpl implements SimpleGenericInterface<String>
- The code snippet is valid as actual object type specified for implementation, so not generic.
Question 4 : Generic interface methods must be generic?
- Generic interface methods DO NOT have to be generic.
Question 5 : Is the following code snippet good practice when creating a generic interface?

interface SimpleGenericInterface<String>
- Use pneumonics for the type rather than an actual type when creating generic interfaces or the interface isn't generic.
Question 6 : Generic interfaces can have default methods?
- Generic interfaces CAN have default methods.
Quiz Progress Bar Please select an answer

What's Next?

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