1. What is the main purpose of generics in Java? A. To enable type-safe collections and eliminate type casting B. To increase program execution speed C. To simplify the syntax of Java code D. To improve memory management Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
2. Which symbol is used to denote a generic type parameter in Java? A. `&` B. `@` C. `#` D. `` Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
3. In a generic class, what does the wildcard `>` represent? A. A wildcard type B. A specific class C. An unknown type D. An exception type Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
4. What is the benefit of using generics with collections in Java? A. It allows collections to store any type of elements B. It ensures type safety by allowing only specific types of elements C. It reduces the size of collections D. None of These Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
5. What does the `E` represent in generic class declarations in Java? A. Extends type B. Enum type C. Element type D. Exception type Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
6. In Java generics, what is the purpose of the `` syntax? A. It allows any type to be used as a generic B. It specifies an enum type C. It specifies a generic exception type D. It restricts the generic type to be a subclass of `SomeClass` Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
7. What is type erasure in Java generics? A. The process of removing generic type information at compile time B. The process of adding generic type information at runtime C. The process of converting generics to non-generic code D. The process of checking type compatibility Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
8. Which of the following is a generic class in Java? A. `HashMap` B. `Integer` C. `String` D. `ArrayList` Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
9. What is the purpose of the `? super T` wildcard in Java generics? A. It restricts the use of the `super` keyword B. It represents an unknown type C. It allows you to specify that the type must be a superclass of `T` D. It allows any type to be used as a generic Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
10. In Java generics, what is the purpose of the diamond operator (`<>`)? A. It specifies a superclass B. It simplifies the instantiation of generic classes C. It indicates a generic exception D. None of These Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board