Java I/O Package - online test

Java I/O Package - online test


1) A stream is a sequence of data.In Java a stream is composed of?

A) Bytes
B) Bits
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Bytes




2) Which stream does Java application uses to read data from a source, it may be a file, an array, peripheral device or socket?

A) InputStream
B) OutputStream
C) Input/OutputStream
D) None of the above
View Answer / Hide Answer

ANSWER: A) InputStream




3) 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) OutputStream class
B) InputStream class
C) Input/OutputStream class
D) None of the above
View Answer / Hide Answer

ANSWER: B) InputStream class




4) Which is used for writing data to a file in file handling?

A) FileInputStream
B) FileOutputStream
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) FileOutputStream




5) Which is used for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader?

A) FileInputStream
B) FileOutputStream
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) FileInputStream




6) Which is Commonly used Methods of ByteArrayOutputStream class?

A) ByteArrayOutputStream()
B) ByteArrayOutputStream(int size)
C) public synchronized void writeTo(OutputStream out) throws IOException
D) Both A & B
View Answer / Hide Answer

ANSWER: C) public synchronized void writeTo(OutputStream out) throws IOException




7) SequenceInputStream class is used to read data from?

A) Single Stream
B) Multiple streams
C) Multilevel Streams
D) None of the above
View Answer / Hide Answer

ANSWER: B) Multiple streams




8) Which is used an internal buffer, It adds more efficiency than to write data directly into a stream. So, it makes the performance fast?

A) BufferedOutputStream
B) ByteArrayOutputStream
C) BufferedInputStream
D) ByteArrayInputStream
View Answer / Hide Answer

ANSWER: A) BufferedOutputStream




9) which classes does Sun Microsystem has suggested not to use the, if you have to read and write the textual information?

A) BufferedInputStream and BufferedOutputStream
B) SequenceInputStream and SequenceOutputStream
C) FileInputStream and FileOutputStream
D) Both A & B
View Answer / Hide Answer

ANSWER: C) FileInputStream and FileOutputStream




10) The CharArrayWriter class is not used to write data to multiple files?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




11) Which are the ways to read data from the keyboard?

A) InputStreamReader
B) Console
C) Scanner
D) DataInputStream
E) All Mentioned above
View Answer / Hide Answer

ANSWER: E) All Mentioned above




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

A) BufferedReader
B) InputStreamReader
C) DataInputStream
D) None of the above
View Answer / Hide Answer

ANSWER: A) BufferedReader




13) Which is used to converts the byte-oriented stream into character-oriented stream?

A) Console
B) Scanner
C) InputStreamReader
D) DataInputStream
View Answer / Hide Answer

ANSWER: C) InputStreamReader




14) 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) Console class
C) InputStreamReader class
D) DataInputStream
View Answer / Hide Answer

ANSWER: B) Console class




15) 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
B) Scanner class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Scanner class




16) Which class automatically flushes the data so there is no need to call flush() method. Moreover, its methods don't throw IOException?

A) Console class
B) Scanner Class
C) FileInputStream class
D) PrintStream class
View Answer / Hide Answer

ANSWER: D) PrintStream class




17) The PrintStream class provides methods to?

A) read data to another stream
B) Write data to another stream
C) read data to same stream
D) write data to same stream
View Answer / Hide Answer

ANSWER: B) Write data to another stream




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

A) DeflaterOutputStream class
B) InflaterInputStream class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) InflaterInputStream class




19) The PipedInputStream and PipedOutputStream classes can be used to read and write data simultaneously?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




20) Which are subclasses of FilterInputStream and FilterOutputStream?

A) PipedInputStream
B) PipedOutputStream
C) DataInputStream
D) DataOutputStream
E) Both C & D
View Answer / Hide Answer

ANSWER: E) Both C & D




21) To achieve performance, the DataInputStream class comes with some special methods like?

A) WriteDouble()
B) WriteInt()
C) WriteBytes()
D) None of the above
View Answer / Hide Answer

ANSWER: D) None of the above




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

A) WriteInt()
B) readLine()
C) readInt()
D) writeDouble()
View Answer / Hide Answer

ANSWER: B) readLine()




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

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




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

A) input stream of this tokenizer
B) output stream of this tokenizer
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) input stream of this tokenizer




25) Breaking a string or stream into meaningful independent words is known as tokenization.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




26) Which package includes StringTokenizer which tokenizes a string into independent words?

A) java.awt
B) java.applet
C) java.util
D) java.lang
View Answer / Hide Answer

ANSWER: C) java.util




27) In which field of StreamTokenizer if the token is a word, this filed contains the word that can be used in programming?

A) String sval
B) double nval
C) int ttype
D) static final int TT_WORD
View Answer / Hide Answer

ANSWER: B) double nval




28) StreamTokenization has following programs they are?

A) Tokenizing text file contents
B) Printing file contents
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




29) Java application uses an output stream to read data from a source, it may be a file, an array, peripheral device or socket?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




30) Both InputStream and OutputStream class is an abstract class. It is the superclass of all classes representing an output stream of bytes.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True


Post your comment

    Discussion

  • RE: Java I/O Package - online test -techepi.com (11/05/14)
  • Free online test , mobile free online test
    http://www.techepi.com/online-tests/java-online-test.html
  • RE: Java I/O Package - online test -santosh (10/15/14)
  • well done

You may like