Java Generics Quiz Form
Test your knowledge of Java generics. Please fill in your information and answer all quiz questions below.
Full Name
*
First Name
Last Name
Email Address
*
example@example.com
Which of the following is the correct syntax for declaring a generic class in Java?
*
class MyClass { }
class MyClass<> { }
class MyClass { }
class MyClass { }
Select all valid generic type parameter declarations in Java.
*
1
2
3
4
What is the output type of the method signature: public T identity(T value)?
*
T
Object
void
value
Which statement best describes Java type erasure?
*
Generic type information is removed at runtime
Generic types are checked at runtime
Type parameters are converted to Object at compile time
Generics are not supported in Java
Which of the following are advantages of using generics in Java?
*
Type safety
Code reusability
Performance improvement
Compile-time checking
Fill in the blank: List
*
What will happen if you try to add an element to a List
*
You can add Integer and its subclasses
You can add only Integer
You can add only Object
You cannot add any element
Write a short explanation of the difference between and .
*
Which of the following code snippets will NOT compile?
*
List list = new ArrayList();
List list = new ArrayList();
List list = new ArrayList();
List list = new ArrayList();
Submit Quiz
Should be Empty: