See which of your colleagues or former colleagues are already on Java Link: Check out the Contact Finder
News »Browse Articles » Questions on Files and Input/Output
+4
Vote Vote

Questions on Files and Input/Output

Views 26 Views    Comments 2 Comments    Share Share    Posted by Mahi 23-02-2009  
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
+4
Vote  Vote
Enter your comment:
Intakhab 02-03-2009
nice
Prakash 29-06-2009
good

Search News

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

Most Recent User Submitted News