Java I/O Streams and String Handling

Tests knowledge of Java I/O Stream classes (InputStream, OutputStream, Reader, Writer) and String class methods and operations.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

The stream class can be categorized into how many groups depending upon the data on which they operate?

  1. 5
  2. 4
  3. 3
  4. 2
  5. None of these
Question 2 Multiple Choice (Single Answer)

Which of the following methods are defined in OutputStream class?

  1. flush()
  2. write(byte[ ] b)
  3. write(byte[ ] b , int offset, int len) :-
  4. Both 1 and 3
  5. All of these
Question 3 Multiple Choice (Single Answer)

Which of the following methods are defined in InputStream class of Bytes Stream?

  1. read(byte[ ] b)
  2. mark(int limit)
  3. read()
  4. Both 1 and 3
  5. All of these
Question 4 Multiple Choice (Single Answer)

How many subclasses of OutputStream Class are present in java?

  1. 9
  2. 6
  3. 5
  4. 8
  5. 7
Question 5 Multiple Choice (Single Answer)

Which of the following are the subclasses of OutputStream Class?

  1. ObjectOutputStream
  2. PipedOutputStream
  3. ByteOutputStream
  4. Both 1 and 2
  5. All of these
Question 6 Multiple Choice (Single Answer)

How many subclasses are there of InputStream Class?

  1. 9
  2. 7
  3. 8
  4. 6
  5. 5
Question 7 Multiple Choice (Single Answer)

Character Stream class is defined by using _____ class hierarchy?

  1. 7
  2. 5
  3. 2
  4. 4
  5. None of these
Question 8 Multiple Choice (Single Answer)

Byte stream are defined by using _____ class hierarchy?

  1. 4
  2. 3
  3. 2
  4. 1
  5. None of these
Question 9 Multiple Choice (Single Answer)

How many subclasses of Reader Class are there in Java?

  1. 9
  2. 8
  3. 7
  4. 6
  5. 5
Question 10 Multiple Choice (Single Answer)

Which of the following methods are defined in Reader class?

  1. skip(long)
  2. mark(int limit)
  3. reset()
  4. Both 1 and 3
  5. All of these
Question 11 Multiple Choice (Single Answer)

Which of the following is/are not the subclasses of Reader class?

  1. StringReader
  2. PipeReader
  3. InputReader
  4. Both 1 and 2
  5. Both 1 and 3
Question 12 Multiple Choice (Single Answer)

Which of the following is /are not the subclasses of Writer class in java?

  1. CharWriter
  2. StringWriter
  3. BufferedWriter
  4. Both 1 and 2
  5. Both 1 and 3
Question 13 Multiple Choice (Single Answer)

Which of the following are the subclasses of InputStream Class?

  1. StringBufferedInputStream
  2. FilterInputStream
  3. SequenceInputStream
  4. Both 2 and 3
  5. All of these
Question 14 Multiple Choice (Single Answer)

Which of the following methods is/are defined in the File class in Java?

  1. getPath()
  2. getName()
  3. length()
  4. Both 1 and 2
  5. All of these
Question 15 Multiple Choice (Single Answer)

How many subclasses of Writer class are there in Java?

  1. 7
  2. 6
  3. 8
  4. 9
  5. 5
Question 16 Multiple Choice (Single Answer)

What will be the result of the above code?
String s = �Welcome To Java�;

s.charAt(s.length());

  1. a
  2. v
  3. Compiler Error : canoot pass a function as parameter
  4. Compiler Error : parameters not sufficient
  5. Compiler Error : parameters not sufficient
Question 17 Multiple Choice (Single Answer)

Which of the following methods are defined in the String class for comparing the Strings?

  1. equals(String s)
  2. compareToIgnoreCase(String s1)
  3. compareTo(String s3)
  4. Both 2 and 3
  5. All of these
Question 18 Multiple Choice (Single Answer)

What will be the result of the above code?
String s = �Welcome To Java�

s.substring(4 , 3 );

  1. ome
  2. - 1
  3. com
  4. Run time error
  5. Compile time error
Question 19 Multiple Choice (Single Answer)

Which of the following functions cannot be invoked using the object of String class?

  1. toLower()
  2. trim()
  3. split()
  4. Both 1 and 3
  5. Both 2 and 3
Question 20 Multiple Choice (Single Answer)

What will be the output of the given piece of code?

String s = �Welcome To Java�;

String s1 = �Java�;

s.match(s1);

  1. true
  2. false
  3. - 1
  4. Compile time error
  5. Run time error