Java BufferedReader vs Scanner and Fast I/O

Here are 10 essential multiple-choice questions on Java BufferedReader vs Scanner and Fast I/O, covering key concepts.

Last Updated :
Discuss
Comments

Question 1

Which class is more suitable for fast input of large data in Java?

  • Scanner

  • BufferedReader

  • System.in

  • Console

Question 2

What does the readLine() method of BufferedReader return at end-of-file?

  • null

  • 0

  • -1

  • EOFException

Question 3

Which of the following supports regex-based input parsing?

  • BufferedReader

  • Scanner

  • InputStreamReader

  • FileInputStream

Question 4

What is the main purpose of wrapping InputStreamReader in BufferedReader?

  • To add output capabilities

  • To convert bytes to characters

  • To make reading faster and efficient

  • To enable writing to file

Question 5

What will be the output of this code snippet?

Java
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
System.out.println(str);


  • Compilation error

  • Prints nothing

  • Reads and prints one line of input

  • Throws IOException always

Question 6

Which stream would you use to write raw bytes to a file?

  • BufferedReader

  • FileWriter

  • FileOutputStream

  • PrintWriter

Question 7

How does Scanner detect input tokens by default?

  • By commas

  • By newline

  • By whitespace

  • By semicolon

Question 8

Which method is used to check if more input exists in Scanner?

  • hasInput()

  • hasNext()

  • nextLine()

  • checkNext()

Question 9

What is a key disadvantage of Scanner over BufferedReader?

  • Doesn’t support String input

  • Slower for large inputs

  • Can't parse integers

  • Requires exception handling

Question 10

What must you handle when using BufferedReader.readLine()?

  • ClassCastException

  • ArrayIndexOutOfBoundsException

  • IOException

  • NullPointerException

There are 10 questions to complete.

Take a part in the ongoing discussion