Object Oriented Programming - I (3140705) MCQs

MCQs of Binary I/O ,Recursion and Generics

Showing 11 to 20 out of 34 Questions
11.
Which of these class is used to read and write bytes in a file?
(a) FileReader
(b) FileWriter
(c) FileInputStream
(d) InputStreamReader
Answer:

Option (c)

12.
Which of these method of InputStream is used to read integer representation of next available byte input?
(a) read()
(b) scanf()
(c) get()
(d) getInteger()
Answer:

Option (a)

13.
Which of these data type is returned by every method of OutputStream?
(a) int
(b) float
(c) byte
(d) none of the mentioned
Answer:

Option (d)

14.
Which of these is a method to clear all the data present in output buffers?
(a) clear()
(b) flush()
(c) fflush()
(d) close()
Answer:

Option (b)

15.
Which of these method(s) is/are used for writing bytes to an outputstream?
(a) put()
(b) print() and write()
(c) printf()
(d) write() and read()
Answer:

Option (b)

16.
What will be the output of the following Java program? (Note: inputoutput.java is stored in the disk.)
    import java.io.*;
    class filesinputoutput 
    {
        public static void main(String args[]) 
        {
            InputStream obj = new FileInputStream("inputoutput.java");
            System.out.print(obj.available());
        }
    }
(a) TRUE
(b) FALSE
(c) prints number of bytes in file
(d) prints number of characters in the file
Answer:

Option (c)

17.
Which of these stream contains the classes which can work on character stream?
(a) InputStream
(b) OutputStream
(c) Character Stream
(d) All of the mentioned
Answer:

Option (c)

18.
Which of these class is used to read characters in a file?
(a) FileReader
(b) FileWriter
(c) FileInputStream
(d) InputStreamReader
Answer:

Option (a)

19.
Which of these method of FileReader class is used to read characters from a file?
(a) read()
(b) scanf()
(c) get()
(d) getInteger()
Answer:

Option (a)

20.
Which of these class can be used to implement the input stream that uses a character array as the source?
(a) BufferedReader
(b) FileReader
(c) CharArrayReader
(d) FileArrayReader
Answer:

Option (c)

Showing 11 to 20 out of 34 Questions