11.) In Java, which class is used to write binary data to an output stream?
A) DataInputStream
B) FileInputStream
C) ObjectOutputStream
D) FileOutputStream
12.) Which method is used to check if there are more characters to read from an input stream in Java?
A) hasNext()
B) hasMore()
C) hasNextLine()
D) hasMoreChars()
13.) Which class is used for formatted output in Java?
A) BufferedReader
B) PrintWriter
C) InputStreamReader
D) FileReader
14.) What is the purpose of the “append” parameter in FileWriter’s constructor?
A) To specify the file mode (read or write)
B) To specify the file’s encoding
C) To indicate whether to create a new file or append to an existing one
D) To enable or disable character encoding
15.) Which class is used to write formatted binary data to an output stream in Java?
A) PrintWriter
B) DataOutputStream
C) OutputStreamWriter
D) BinaryWriter
16.) What is the purpose of the “BufferedWriter” class in Java?
A) To read binary data from an input stream
B) To write binary data to an output stream
C) To write character-based data efficiently to an output stream
D) To read character-based data efficiently from an input stream
17.) Which method is used to flush the output buffer in Java?
A) flush()
B) clear()
C) reset()
D) close()
18.) In Java, what is the purpose of the “DataInputStream” class?
A) To read character-based data from an input stream
B) To read primitive data types from an input stream
C) To write primitive data types to an output stream
D) To read and write binary data simultaneously
19.) Which class is used for reading text from the standard input (keyboard) in Java?
A) Console
B) System
C) Scanner
D) KeyboardReader
20.) In Java, which exception is thrown when there is an end-of-file condition while reading data from an input stream?
A) EOFException
B) FileEndException
C) EndOfFileException
D) NoEndException