What will be the output of the following code?
FileOutputStream fos = new FileOutputStream("test.txt", true);
What does the 'true' parameter indicate?
Q.82Medium
Which of the following best describes the relationship between InputStream and Reader classes?
Q.83Medium
In a scenario where you need to write formatted output (like printf), which class should be used?
Q.84Medium
What is the difference between read() and read(byte[] b) methods in InputStream?
Q.85Medium
Which exception is thrown when you try to serialize an object that contains non-serializable fields?
Advertisement
Q.86Medium
What is the purpose of the serialVersionUID field in a serializable class?
Q.87Medium
You need to read a file line by line efficiently. Which approach is best?
Q.88Medium
What happens if you try to read from a closed stream?
Q.89Medium
Which class wraps a byte stream to handle character encoding/decoding?
Q.90Medium
In the try-with-resources statement, what happens to resources automatically?
Q.91Hard
What is the main advantage of using RandomAccessFile over sequential streams?
Q.92Hard
When deserializing an object, which methods are called in order?
Q.93Hard
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.94Hard
What is the primary advantage of PushbackInputStream?
Q.95Easy
Which of the following classes is used to read primitive data types from an input stream in Java?
Q.96Medium
In a file I/O operation, you need to write objects to a file and later retrieve them. Which approach is most appropriate?
Q.97Medium
What will happen if you attempt to serialize a class that contains a non-serializable instance variable without declaring it as transient?
Q.98Medium
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.99Easy
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.100Hard
In a multi-threaded application, multiple threads are writing to the same file simultaneously using FileOutputStream. What is the primary issue and best solution?