Sail E0 Webinar

MCQs

Total Questions : 18 | Page 2 of 2 pages
Question 11. Which of these classes can return more than one character to be returned to input stream?
  1.    BufferedReader
  2.    Bufferedwriter
  3.    PushbachReader
  4.    CharArrayReader
 Discuss Question
Answer: Option C. -> PushbachReader


PushbackReader class allows one or more characters to be returned to the input stream. This allows looking ahead in input stream and performing action accordingly.


Question 12. Which of these is a method to clear all the data present in output buffers?
  1.    clear()
  2.    flush()
  3.    fflush()
  4.    close()
 Discuss Question
Answer: Option B. -> flush()


flush()


Question 13. Which of these class can be used to implement input stream that uses a character array as the source?
  1.    BufferedReader
  2.    FileReader
  3.    CharArrayReader
  4.    FileArrayReader
 Discuss Question
Answer: Option C. -> CharArrayReader


CharArrayReader is an implementation of an input stream that uses character array as a source. Here array is the input source.


Question 14. Which of these is a method to clear all the data present in output buffers?
  1.    clear()
  2.    flush()
  3.    fflush()
  4.    close()
 Discuss Question
Answer: Option B. -> flush()


flush()


Question 15. 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


FileReader


Question 16. Which of these is method is used for writing bytes to an outputstream?
  1.    put()
  2.    print()
  3.    printf()
  4.    write()
 Discuss Question
Answer: Option B. -> print()


write() and read() are the two main methods of OutputStream & InputStream respectively that are used for printing and reading the byte data.


Question 17. 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 18. 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()


read()


Latest Videos

Latest Test Papers