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.141Hard

Which method is used to check if a CallableStatement has a return value from a stored procedure?

Q.142Hard

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

Q.143Hard

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

Q.144Hard

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

Q.145Hard

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

Q.146Hard

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

Q.147Hard

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

Q.148Hard

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

Q.149Hard

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

Q.150Hard

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

Q.151Hard

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

Q.152Hard

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

Q.153Hard

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

Q.154Hard

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

Q.155Hard

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

Q.156Hard

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

Q.157Hard

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

Q.158Hard

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

Q.159Hard

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

Q.160Hard

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>>?