Ques 1 File Handling
Which class is used to perform file input/output operations in Java?
a) FileReader
b) FileWriter
c) FileHandler
d) FileIO
Ques 2 File Handling
Which method is used to check if a file exists in Java?
a) isFile()
b) exists()
c) fileExists()
d) checkFile()
Ques 3 File Handling
Which class is used to write data to a file in a buffered manner in Java?
a) FileWriter
b) FileOutputWriter
c) BufferedWriter
d) OutputStreamWriter
Ques 4 File Handling
Which method is used to check if a file is hidden in Java?
a) hide()
b) setHidden()
c) isHidden()
d) checkHidden()
Ques 5 File Handling
Which method is used to get the length of a file in Java?
a) length()
b) getSize()
c) getFileSize()
d) size()
Ques 6 File Handling
What will be the output of the following code snippet?
File file = new File("sample.txt"); System.out.println(file.length());