Sail E0 Webinar

MCQs

Total Questions : 18 | Page 1 of 2 pages
Question 1. Which of these packages contain classes and interfaces used for input & output operations of a program?
  1.    java.util
  2.    java.lang
  3.    java.io
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> java.io


java.io provides support for input and output operations.


Question 2. Which of these is specified by a File object?
  1.    a file in disk
  2.    directory path
  3.    directory in disk
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> directory in disk


directory in disk


Question 3. Which of these interface is not a member of java.io package?
  1.    DataInput
  2.    ObjectInput
  3.    ObjectFilter
  4.    FileFilter
 Discuss Question
Answer: Option C. -> ObjectFilter


ObjectFilter


Question 4. Which of these class is not related to input and output stream in terms of functioning?
  1.    File
  2.    Writer
  3.    InputStream
  4.    Reader
 Discuss Question
Answer: Option A. -> File


A File describes properties of a file, a File object is used to obtain or manipulate the information associated with a disk file, such as the permissions, time date, and directories path, and to navigate subdirectories.


Question 5. Which of these class is not a member class of java.io package?
  1.    String
  2.    StringReader
  3.    Writer
  4.    File
 Discuss Question
Answer: Option A. -> String


String


Question 6. Which of these is method for testing whether the specified element is a file or a directory?
  1.    IsFile()
  2.    isFile()
  3.    Isfile()
  4.    isfile()
 Discuss Question
Answer: Option B. -> isFile()


isFile() returns true if called on a file and returns false when called on a directory.


Question 7. Which of these class is used to read and write bytes in a file?
  1.    FileReader
  2.    FileWriter
  3.    FileInputStream
  4.    InputStreamReader
 Discuss Question
Answer: Option C. -> FileInputStream


FileInputStream


Question 8. Which of these classes is used for input and output operation when working with bytes?
  1.    InputStream
  2.    Reader
  3.    Writer
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> InputStream


InputStream & OutputStream are designed for byte stream. Reader and writer are designed for character stream.


Question 9. Which of these method of InputStream is used to read integer representation of next available byte input?
  1.    read()
  2.    scanf()
  3.    get()
  4.    getInteger()
 Discuss Question
Answer: Option A. -> read()


read()


Question 10. Which of these data type is returned by every method of OutputStream?
  1.    int
  2.    float
  3.    byte
  4.    None of the mentioned
 Discuss Question
Answer: Option D. -> None of the mentioned


Every method of OutputStream returns void and throws an IOExeption in case of errors.


Latest Videos

Latest Test Papers