Question 1. Try{ File f = new File("a.txt"); }catch(Exception e){ }catch(IOException io){ } Is this code create new file name a.txt ?
true
false
Compilation Error
None of these
Explanation:-
Answer: Option C. -> Compilation Error IOException is unreachable to compiler because all exception are going to catch up by Exception block.
Question 2. System class is defined in .................
java.util package
java.lang package
java.io package
java.awt package
None of these
Explanation:-
Answer: Option B. -> java.lang package
Question 3. Which of these classes defined in java.io and used for file-handling are abstract? A. InputStream B. PrintStream C. Reader D. FileInputStream E. FileWriter
Only A
Only C
A and C
B and D
A, B and E
Explanation:-
Answer: Option C. -> A and C
Question 4. When comparing java.io.BufferedWriter and java.io.FileWriter, which capability exist as a method in only one of two ?
closing the stream
flushing the stream
writting to the stream
writting a line separator to the stream
None of these
Explanation:-
Answer: Option D. -> writting a line separator to the stream A newLine() method is provided in BufferedWriter which is not in FileWriter.