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.581Medium

What happens if you try to read from a closed stream?

Q.582Medium

Which class wraps a byte stream to handle character encoding/decoding?

Q.583Medium

In the try-with-resources statement, what happens to resources automatically?

Q.584Hard

What is the main advantage of using RandomAccessFile over sequential streams?

Q.585Hard

When deserializing an object, which methods are called in order?

Q.586Hard

Consider a scenario where you need to read a large binary file efficiently without loading it entirely into memory. Which approach combines best practices?

Q.587Hard

What is the primary advantage of PushbackInputStream?

Q.588Easy

Which of the following classes is used to read primitive data types from an input stream in Java?

Q.589Medium

In a file I/O operation, you need to write objects to a file and later retrieve them. Which approach is most appropriate?

Q.590Medium

What will happen if you attempt to serialize a class that contains a non-serializable instance variable without declaring it as transient?

Q.591Medium

Consider a scenario where you're processing a 5GB log file and need to count specific error messages. Which I/O strategy would be most memory-efficient?

Q.592Easy

Which interface must a class implement to be eligible for serialization in Java, and what is the significance of implementing it with no abstract methods?

Q.593Hard

In a multi-threaded application, multiple threads are writing to the same file simultaneously using FileOutputStream. What is the primary issue and best solution?

Q.594Easy

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

Q.595Easy

What is the correct order of JDBC operations?

Q.596Easy

Which JDBC driver type is platform-independent and does not require native code?

Q.597Easy

What exception is thrown when a database connection cannot be established?

Q.598Easy

Which method is used to retrieve a String value from a ResultSet object?

Q.599Medium

What does the executeUpdate() method return in JDBC?

Q.600Medium

Which interface is used to execute precompiled SQL statements in JDBC?