Object Oriented Programming - I (3140705) MCQs

MCQs of Binary I/O ,Recursion and Generics

Showing 21 to 30 out of 34 Questions
21.
A stream is a sequence of data. In Java a stream is composed of?
(a) Bytes
(b) Bits
(c) Both A & B
(d) None of the above
Answer:

Option (a)

22.
Which stream does Java application uses to read data from a source, it may be a file, an array, peripheral device or socket?
(a) InputStream
(b) OutputStream
(c) Input/OutputStream
(d) None of the above
Answer:

Option (a)

23.
These are commonly used methods of _____ class
1) public abstract int read()throws IOException
2) public int available()throws IOException
3) public void close()throws IOException
(a) OutputStream class
(b) InputStream class
(c) Input/OutputStream class
(d) None of the above
Answer:

Option (b)

24.
Which is used as an internal buffer to add more efficienctly than to write data directly into a stream?
(a) BufferedOutputStream
(b) ByteArrayOutputStream
(c) BufferedInputStream
(d) ByteArrayInputStream
Answer:

Option (a)

25.
Which classes does Oracle has suggested not to use if you have to read and write the textual information?
(a) BufferedInputStream and BufferedOutputStream
(b) SequenceInputStream and SequenceOutputStream
(c) FileInputStream and FileOutputStream
(d) Both A & B
Answer:

Option (c)

26.
Which are the ways to read data from the keyboard?
(a) InputStreamReader
(b) Console
(c) DataInputStream
(d) All Mentioned above
Answer:

Option (d)

27.
Which is used to converts the byte-oriented stream into character-oriented stream?
(a) Console
(b) Scanner
(c) InputStreamReader
(d) DataInputStream
Answer:

Option (c)

28.
Which class breaks the input into tokens using a delimiter which is whitespace by default? It provides many methods to read and parse various primitive values.
(a) Console class
(b) Scanner class
(c) Both A & B
(d) None of the above
Answer:

Option (b)

29.
Which class automatically flushes the data so there is no need to call flush() method. Moreover, its methods don't throw IOException?
(a) Console class
(b) Scanner Class
(c) FileInputStream class
(d) PrintStream class
Answer:

Option (d)

30.
The PrintStream class provides methods to?
(a) read data to another stream
(b) Write data to another stream
(c) read data to same stream
(d) write data to same stream
Answer:

Option (b)

Showing 21 to 30 out of 34 Questions