Question 1
Which of the following is a superclass of all byte input streams?
InputStreamReader
Reader
InputStream
BufferedReader
Question 2
What does the read() method of FileInputStream return when the end of file is reached?
'0'
0
-1
null
Question 3
What is the primary difference between Reader and InputStream?
Reader is abstract, InputStream is not
Reader handles characters, InputStream handles bytes
InputStream handles characters, Reader handles lines
No difference
Question 4
Which class is used to write character data to a file?
FileReader
FileOutputStream
FileWriter
ObjectWriter
Question 5
What is the output of this snippet?
File f = new File("log.txt");
System.out.println(f.exists());
true if file exists
Always true
Always false
Compilation error
Question 6
Which method is used to close an IO stream in Java?
stop()
flush()
shutdown()
close()
Question 7
What is the purpose of the Java I/O (Input/Output) system?
To handle network communication
To handle file and console input and output
To manage database connections
To manage memory and CPU usage
Question 8
Which of the following I/O streams does not require closing after use?
Reader and Writer
FileInputStream and FileOutputStream
BufferedReader and BufferedWriter
None of the above
Question 9
What does the close() method do in the context of Java I/O streams?
Releases any system resources used by the stream
Reads data from the stream
Writes data to the stream
None of the above
There are 9 questions to complete.