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

Consider processing a 1GB file. Which approach would be most memory-efficient?

Q.282Medium

What does the available() method in InputStream return?

Q.283Medium

In Java NIO, which class is used for channel-based I/O?

Q.284Medium

What is the correct way to ensure resources are properly closed in Java 7+?

Q.285Medium

What happens when you create a FileOutputStream with an existing file?

Q.286Medium

What is the default buffer size used by BufferedInputStream?

Q.287Medium

Which class is used to read primitive data types and strings from a binary stream?

Q.288Medium

Which of the following best describes the relationship between InputStream and Reader classes?

Q.289Medium

In a scenario where you need to write formatted output (like printf), which class should be used?

Q.290Medium

What is the difference between read() and read(byte[] b) methods in InputStream?

Q.291Medium

Which exception is thrown when you try to serialize an object that contains non-serializable fields?

Q.292Medium

What is the purpose of the serialVersionUID field in a serializable class?

Q.293Medium

You need to read a file line by line efficiently. Which approach is best?

Q.294Medium

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

Q.295Medium

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

Q.296Medium

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

Q.297Medium

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

Q.298Medium

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

Q.299Medium

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

What does the executeUpdate() method return in JDBC?