- Which abstract class is the super class of all classes used for reading bytes. Select the one correct answer.
- Which abstract class is the super class of all classes used for writing characters. Select the one correct answer.
- Which of these are legal ways of accessing a File named “file.tst” for reading. Select the two correct answers.
- FileReader fr = new FileReader(“file.tst”);
- FileInputStream fr = new FileInputStream(“file.tst”);
InputStreamReader isr = new InputStreamReader(fr, “UTF8”);
- FileReader fr = new FileReader(“file.tst”, “UTF8”);
- InputStreamReader isr = new InputStreamReader(“file.tst”);
- Name the class that allows reading of binary representations of Java primitives from an input byte stream.
- Which of these classes are abstract. Select the three correct answers.
- Name the exception thrown by the read method defined in InputStream class
Answers to questions on Files and I/O
- a, b. FileReader class uses the default character encoding, hence c is incorrect. InputStreamReader character class does not have a constructor that takes file name as an argument. Hence d is incorrect.
1. Online Compilers - Compile & Run your C/C++ programs:
2. Ask your questions or clarify your/others doubts from,