11.) Which class is used to write serialized objects to a file in Java?
A) ObjectInputStream
B) FileOutputStream
C) ObjectOutputStream
D) FileWriter
12.) In Java, which class is used for reading and writing character data to a file in a platform-independent way?
A) FileReader
B) FileWriter
C) BufferedReader
D) PrintWriter
13.) What does the File.delete() method do in Java?
A) Delete a file.
B) Appends text to an existing file.
C) Deletes a file or directory.
D) Delete binary data from a file.
14.) What does the File.renameTo() method do in Java?
A) Renames a file or directory.
B) Renames only a file.
C) Renames only a directory.
D) None of these.
15.) Which method is used to close a file stream in Java?
A) close()
B) flush()
C) closeStream()
D) exit()
16.) What is the primary purpose of the RandomAccessFile class in Java?
A) To read data from a file.
B) To write data to a file.
C) To read and write data at a specific position in a file.
D) To create directories.
17.) What is the role of the BufferedInputStream class in Java file handling?
A) To read character data from a file.
B) To read binary data from a file efficiently.
C) To create a new file.
D) To append text to an existing file.
18.) Which class is used to represent a directory in Java’s file handling?
A) FileReader
B) File
C) BufferedReader
D) FileWriter