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

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

Q.42Medium

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

Q.43Medium

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

Q.44Medium

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

Q.45Medium

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

Q.46Medium

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

Q.47Medium

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

Q.48Medium

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

Q.49Medium

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

Q.50Medium

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

Q.51Medium

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

Q.52Medium

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

Q.53Medium

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?