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.181Easy

What does the DriverManager.getConnection() method return?

Q.182Easy

In JDBC, which exception is thrown when the database driver class is not found?

Q.183Easy

What is the purpose of the Connection.commit() method in JDBC?

Q.184Easy

Which interface in JDBC is used to execute SQL queries and retrieve results?

Q.185Easy

Which JDBC API is used to execute parameterized queries safely?

Q.186Easy

What is the correct syntax to load a JDBC driver in Java?

Q.187Easy

Which method is used to retrieve the next row from a ResultSet?

Q.188Easy

What exception is thrown when a database connection fails in JDBC?

Q.189Easy

In JDBC, what does the executeQuery() method return?

Q.190Easy

Which interface in JDBC is used to execute parameterized queries and prevent SQL injection attacks?

Q.191Easy

What is the correct sequence to establish a JDBC connection in Java?

Q.192Easy

Which method of Connection interface is used to start a transaction in JDBC?

Q.193Easy

In JDBC, what does the BatchUpdate feature allow developers to do?

Q.194Easy

Which exception is thrown when a JDBC driver is not found in the classpath?

Q.195Easy

What is the difference between commit() and rollback() in JDBC transactions?

Q.196Easy

In a JDBC application, which interface is responsible for executing SQL queries and returning ResultSet objects?

Q.197Easy

What is the primary purpose of Generics in Java?

Q.198Easy

Which keyword is used to declare a generic class in Java?

Q.199Easy

What will be the output of the following code? List<String> list = new ArrayList<>(); list.add("Java"); System.out.println(list.get(0).length());

Q.200Easy

Which of the following is a valid generic method declaration?