Quiz about Java Quiz Day 50

Java Quiz Day 50

Last Updated :
Discuss
Comments

Question 1

What is the purpose of the Java I/O (Input/Output) system?

  • A

    To handle network communication

  • B

    To handle file and console input and output

  • C

    To manage database connections

  • D

    To manage memory and CPU usage

Question 2

Which of the following classes is used to read data from a file in Java?

  • A

    Writer

  • B

    Reader

  • C

    OutputStream



  • D

    FileInputStream

Question 3

What does the Writer class in Java primarily handle?

  • A

    Reading binary data from a file

  • B

    Writing text data to a file

  • C

    Writing binary data to a file

  • D

    Reading text data from a file

Question 4

Which of the following classes is a direct subclass of InputStream in Java?

  • A

    Reader

  • B

    FileReader



  • C

    BufferedReader

  • D

    FileInputStream

Question 5

What is the primary function of the read() method in the Reader class?

  • A

    To read text data one character at a time

  • B

    To read text data line by line

  • C

    To read binary data

  • D

    To convert data into a byte array

Question 6

Which of the following is true about Writer and Reader classes in Java I/O?

  • A

    Writer handles character streams, while Reader handles byte streams

  • B

    Writer and Reader are used for handling character streams

  • C

    Writer handles byte streams, while Reader handles character streams

  • D

    Both handle binary data

Question 7

Which of the following is a subclass of Writer in Java?

  • A

    FileReader

  • B

    OutputStreamWriter

  • C

    BufferedReader

  • D

    FileInputStream

Question 8

Which method of the Reader class is used to read a single character?

  • A

    readByte()

  • B

    readChar()

  • C

    read()

  • D

    readLine()

Question 9

Which of the following I/O streams does not require closing after use?

  • A

    Reader and Writer

  • B

    FileInputStream and FileOutputStream

  • C

    BufferedReader and BufferedWriter

  • D

    None of the above

Question 10

What does the close() method do in the context of Java I/O streams?

  • A

    Releases any system resources used by the stream

  • B

    Reads data from the stream

  • C

    Writes data to the stream

  • D

    None of the above

Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion