Java I/O Package MCQs

Java I/O Package MCQs

Answer these Java I/O Package MCQs and see how sharp is your knowledge of Java I/O Package. Scroll down and let's start!

1: The PrintStream class provides methods to?

A.   Write data to another stream

B.   Read data to same stream

C.   Read data to another stream

D.   Write data to same stream

2: A stream is a sequence of data.In Java a stream is composed of?

A.   Bytes

B.   Bits And Bytes

C.   None

D.   Bits

3: The PipedInputStream and PipedOutputStream classes can be used to read and write data simultaneously?

A.   False

B.   True

4: The stream tokenizer class can recognize identifiers, numbers, quoted strings, and various comment styles?

A.   True

B.   False

5: Which class can be used to read data line by line by readLine() method?

A.   DataInputStream

B.   BufferedReader

C.   InputStreamReader

D.   None

6: Which is used to converts the byte-oriented stream into character-oriented stream?

A.   DataInputStream

B.   InputStreamReader

C.   Scanner

D.   Console

7: Which are the ways to read data from the keyboard?

A.   InputStreamReader

B.   DataInputStream

C.   Scanner

D.   All

E.   Console

8: Which class is used to uncompress the file in the deflate compression format, It provides facility to the other uncompression filters?

A.   None

B.   InflaterInputStream class

C.   DeflaterOutputStream class

D.   DeflaterOutputStream class And InflaterInputStream class

9: Which method of DataInputStream class reads a line from the file and returns it as a string?

A.   ReadInt()

B.   WriteDouble()

C.   WriteInt()

D.   ReadLine()

10:

These commonly used methods of:

1) public abstract int read()throws IOException

2) public int available()throws IOException

3) public void close()throws IOException

A.   Input/OutputStream class

B.   None

C.   OutputStream class

D.   InputStream class

11: Which class breaks the input into tokens using a delimiter which is whitespace bydefault, It provides many methods to read and parse various primitive values?

A.   Console class And Scanner class

B.   None

C.   Console class

D.   Scanner Class

12: The java.io.StreamTokenizer.nextToken() method parses the next token from the?

A.   Output stream of this tokenizer

B.   Output stream of this tokenizer And input stream of this tokenizer

C.   None

D.   Input stream of this tokenizer

13:

These four methods are commonly used in?

public char[] readPassword(String fmt,Object... args)

public String readLine()

public String readLine(String fmt,Object... args)

public char[] readPassword(

A.   Scanner Class

B.   InputStreamReader class

C.   Console class

D.   DataInputStream

14: SequenceInputStream class is used to read data from?

A.   None

B.   Single Stream

C.   Multiple streams

D.   Multilevel Streams

15: Breaking a string or stream into meaningful independent words is known as tokenization.

A.   False

B.   True