Questions on Files and Input/Output:
1) Which abstract class is the super class of all classes used for reading bytes. Select the one correct answer.
Reader
a)FileReader
b)ByteReader
c)InputStream
d)FileInputStream
2)Which abstract class is the super class of all classes used for writing characters. Select the one correct answer.
a)Writer
b)FileWriter
c)CharWriter
OutputStream
d)FileOutputStream
3) Which of these are legal ways of accessing a File named "file.tst" for reading. Select the two correct answers.
a)FileReader fr = new FileReader("file.tst");
b)FileInputStream fr = new FileInputStream("file.tst");
c)InputStreamReader isr = new InputStreamReader(fr, "UTF8");
d)FileReader fr = new FileReader("file.tst", "UTF8");
e)InputStreamReader isr = new InputStreamReader("file.tst");
4) Name the class that allows reading of binary representations of Java primitives from an input byte stream.
5)Which of these classes are abstract. Select the three correct answers.
a) FilterWriter
b)Reader
c)InputStream
d)CharArrayReader
DataInputStream
6)Name the exception thrown by the read method defined in InputStream class
Answers to questions on Files and I/O
d
a
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.
DataInpiutStream
a,b,c
IOException
1) Which abstract class is the super class of all classes used for reading bytes. Select the one correct answer.
Reader
a)FileReader
b)ByteReader
c)InputStream
d)FileInputStream
2)Which abstract class is the super class of all classes used for writing characters. Select the one correct answer.
a)Writer
b)FileWriter
c)CharWriter
OutputStream
d)FileOutputStream
3) Which of these are legal ways of accessing a File named "file.tst" for reading. Select the two correct answers.
a)FileReader fr = new FileReader("file.tst");
b)FileInputStream fr = new FileInputStream("file.tst");
c)InputStreamReader isr = new InputStreamReader(fr, "UTF8");
d)FileReader fr = new FileReader("file.tst", "UTF8");
e)InputStreamReader isr = new InputStreamReader("file.tst");
4) Name the class that allows reading of binary representations of Java primitives from an input byte stream.
5)Which of these classes are abstract. Select the three correct answers.
a) FilterWriter
b)Reader
c)InputStream
d)CharArrayReader
DataInputStream
6)Name the exception thrown by the read method defined in InputStream class
Answers to questions on Files and I/O
d
a
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.
DataInpiutStream
a,b,c
IOException
Search News
News Categories
What's the News?
Post a link to something interesting from another site, or submit your own original writing for the Java community to read.
Most Popular News
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- JPPF v1.9
Published about 02-05-2009 | Rated +1 - How to Java Program
Published about 13-05-2009 | Rated +1 - Can a class be declared as protected?
Submitted by Balamurali | Rated 0 - JavaBlackBelt opens advanced coached eLearning courses
Published about 19-07-2009 | Rated 0









