Generic Basics QuizS2C Home « Generic Basics 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.This quiz.
8 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.Quiz3
6 questions
Lesson 4 - Generic ClassesThis lesson is about generic classes.Quiz4
7 questions
Lesson 5 - Bounded TypesIn this lesson on Java generics we investigate invariance and bounded types.Quiz5
7 questions
Lesson 6 - Unbounded Wildcard TypesIn this lesson we learn about generic unbounded wildcard types.Quiz6
7 questions
Lesson 7 - Upper Bounded Wildcard TypeThis lesson on generics is about Upper Bounded Wildcard Type.Quiz7
6 questions
Lesson 8 - Lower Bounded Wildcard TypeThis lesson on generics is about Lower Bounded Wildcard Type.Quiz8
6 questions
Lesson 9 - Generic MethodsThis lesson is about generic methods.Quiz9
6 questions
Lesson 10 - Generic ConstructorsIn for final lesson on generics we look at generic constructors.Quiz10
7 questions

Generics Quiz 1

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

Question 1 : In which version of Java were Generics added to the language
- Generics were added to Java in version 5.0.
Question 2 : When we talk about generics or a generic type what we are actually talking about?
- When we talk about generics or a generic type what we are actually talking about is a <i>parameterized type</i>.
Question 3 : How are generics implemented?
- Generics are implemented by <i>erasure</i> (all generic code is removed at compile time) so legacy code can interoperate with generic code.
Question 4 : When creating your own generic types it is best practice to use pneumonics for the formal type parameter rather than multiple letters?
- When creating your own generic types IT IS best practice to use pneumonics for the <i>formal type parameter</i> rather than multiple letters.
Question 5 : What is the advantage of using generics
- The advantage of using generics is type safety.
Question 6 : Which operator was introduced in Java 7 to aid with verbosity when using generics?
- The diamond operator was introduced in Java 7 to aid with verbosity when using generics.
Question 7 : Generics have stopped the use of raw types?
- To keep Java backward compatible YOU CAN still use raw types instead of generics although this is in no way recommended!
Quiz Progress Bar Please select an answer

What's Next?

In the next quiz we test your knowledge of raw and generic types and the advantages of using generic types.