Sail E0 Webinar

MCQs

Total Questions : 51 | Page 5 of 6 pages
Question 41.

Which of these method of FileReader class is used to read characters from a file?


  1.    read()
  2.    scanf()
  3.    get()
  4.    getInteger()
 Discuss Question
Answer: Option A. -> read()


Question 42.

Which of these class is used to read characters and strings in Java from console?


  1.    BufferedReader
  2.    StringReader
  3.    BufferedStreamReader
  4.    InputStreamReader
 Discuss Question
Answer: Option A. -> BufferedReader

None.


Question 43.

Which of these exception is thrown in cases when the file specified for writing it 

not found?


  1.    IOException
  2.    FileException
  3.    FileNotFoundException
  4.    FileInputException
 Discuss Question
Answer: Option C. -> FileNotFoundException

In cases when the file specified is not found, then FileNotFoundException is thrown 

by java run-time system, earlier versions of java used to throw IOException but after 

Java 2.0 they throw FileNotFoundException.


Question 44.

Which of these class is used to create an object whose character sequence is 

mutable?


  1.    String()
  2.    StringBuffer()
  3.    Both of the mentioned
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> StringBuffer()

StringBuffer represents growable and writeable character sequence.


Question 45.

Which of these methods can be used to writing console output?


  1.    print()
  2.    println()
  3.    write()
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned

None


Question 46.

Which of these stream contains the classes which can work on character stream?


  1.    InputStream
  2.    OutputStream
  3.    Character Stream
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> Character Stream

InputStream & OutputStream classes under byte stream they are not streams. 

Character Stream contains all the classes which can work with Unicode


Question 47.

Which of these class contains the methods used to write in a file?


  1.    FileStream
  2.    FileInputStream
  3.    BUfferedOutputStream
  4.    FileBufferStream
 Discuss Question
Answer: Option B. -> FileInputStream

None.

Question 48.

Which of these is used to read a string from the input stream?


  1.    get()
  2.    getLine()
  3.    read()
  4.    readLine()
 Discuss Question
Answer: Option D. -> readLine()

None.


Question 49.

Which of these class is used to read characters in a file?


  1.    FileReader
  2.    FileWriter
  3.    FileInputStream
  4.    InputStreamReader
 Discuss Question
Answer: Option A. -> FileReader

We can read characters in a file using FileReader class of Java.


Question 50.

Which exception is thrown by read() method?


  1.    IOException
  2.    InterruptedException
  3.    SystemException
  4.    SystemInputException
 Discuss Question
Answer: Option A. -> IOException

read method throws IOException.


Latest Videos

Latest Test Papers