iGET

Java Programming - MCQ Practice Questions

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

951 questions | 100% Free

Q.141Hard

A batch update operation fails partially. How can you identify which statements failed in the batch?

Q.142Hard

In JDBC, what is the purpose of using a SavePoint in a transaction?

Q.143Hard

A developer creates a JDBC connection but forgets to close it. What might be the consequence?

Q.144Hard

Consider a scenario where a developer retrieves a ResultSet and then closes the Statement object. What happens to the ResultSet?

Q.145Hard

What is the optimal approach to handle JDBC resources to prevent memory leaks in a production application?

Q.146Hard

In a multi-threaded JDBC application, why should each thread have its own Connection object?

Q.147Hard

Consider a scenario: A developer uses Statement with user input directly in SQL queries. What is the primary risk?

Q.148Hard

In a JDBC application, when using transactions with setAutoCommit(false), what happens to intermediate savepoints if rollback() is called?

Q.149Hard

Which JDBC feature should be used for executing multiple SQL statements in a batch for optimal performance?

Q.150Hard

In JDBC, what is the significance of setting FetchSize on a Statement when dealing with large ResultSets?

Q.151Hard

When using JDBC with Spring Framework in 2024-25, which approach is recommended for resource management?

Q.152Hard

A developer wants to retrieve data from a stored procedure that returns multiple result sets and output parameters. Which approach is correct?

Q.153Hard

A query execution takes 5 seconds consistently. Which JDBC optimization technique should NOT be used for this scenario?

Q.154Hard

In a JDBC application using batch updates, what happens if one statement in the batch fails?

Q.155Hard

A Java application requires connection pooling to handle 1000+ concurrent database requests efficiently. Which JDBC component should be implemented?

Q.156Hard

In JDBC metadata operations, which method is used to retrieve information about table structure, column names, and their data types?

Q.157Hard

Which of these correctly demonstrates the Producer Extends Consumer Super (PECS) principle?

Q.158Hard

What will happen with this code? List list = new ArrayList<String>(); list.add(123); // Adding Integer String s = (String) list.get(0);

Q.159Hard

Consider this code: public <T extends Comparable<T>> T getMax(T a, T b) { return a.compareTo(b) > 0 ? a : b; } What is the benefit of this recursive bound <T extends Comparable<T>>?

Q.160Hard

Which statement is true about generic inheritance?