iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.341Medium

What is the correct way to handle resource management in JDBC with Java 7+?

Q.342Medium

Which JDBC feature allows monitoring of database metadata like table structure and column information?

Q.343Medium

A developer needs to execute the same SQL query multiple times with different parameters. Which JDBC feature should be used to optimize performance?

Q.344Medium

When using ResultSet in JDBC, which cursor type allows bidirectional movement through rows but does not reflect database changes?

Q.345Medium

In JDBC 2024-25, which exception is thrown when attempting to use a closed Connection object?

Q.346Medium

What is type erasure in Java Generics?

Q.347Medium

Which statement about wildcard generics (?) is correct?

Q.348Medium

What will happen when you try to create an array of generics? List<String>[] array = new List<String>[10];

Q.349Medium

Consider the code: List<? extends Number> list = new ArrayList<>(); list.add(5); // Will this compile?

Q.350Medium

Which of the following represents a bounded type parameter?

Q.351Medium

What is the difference between List<?> and List<Object>?

Q.352Medium

Consider this generic interface: interface Comparable<T> { int compareTo(T o); } Which class definition correctly implements this?

Q.353Medium

What will be the output? List<Integer> list = new ArrayList<>(); list.add(10); Object obj = list.get(0); System.out.println(obj instanceof Integer);

Q.354Medium

Which of these declarations would NOT cause a compilation warning or error?

Q.355Medium

In the declaration 'List<? extends Number> list', what types can be added to this list at runtime?

Q.356Medium

Which statement correctly uses the lower-bounded wildcard in generics?

Q.357Medium

Which generic declaration would allow storing both String and Integer in the same collection?

Q.358Medium

What does the PECS principle stand for in generics context?

Q.359Medium

In a generic class 'class Box<T extends Comparable<T>>', what constraint is placed on T?

Q.360Medium

Which generic wildcard usage is INCORRECT?