Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  Which of these method can set the out stream to OutputStream?

a. setStream()

b. setosteam()

c. setOut()

d. streamtoOstream()


Answer- setOut()


Que-  Which of these values are returns under the case of normal termination of a program?

a.0

b.1

c.2

d.3


Answer-0


Que-  Which of these is a super class of wrappers Double and Float?

a. Long

b. Digits

c. Float

d. Number


Answer- Number


Que-  Which of the following methods return the value as a double?

a. doubleValue()

b. converDouble()

c. getDouble()

d. getDoubleValue()


Answer- doubleValue()


Que-  Which of these methods can be used to check whether the given value is a number or not?

a. isNaN()

b. isNumber()

c. checkNaN()

d. checkNumber()


Answer- isNaN()


Que-  Which of these method of Double wrapper can be used to check whether a given value is infinite or not?

a. Infinite()

b. isInfinite()

c. checkInfinite()

d. None of the mentioned


Answer- isInfinite()


Que-  Which of these exceptions is thrown by compareTo() method defined in a double wrapper?

a. IOException

b. SystemException

c. CastException

d. ClassCastException


Answer- ClassCastException


Que-  Which of these packages contain classes and interfaces used for input & output operations of a program?

a. java.util

b. java.lang

c. java.io

d. all of the mentioned


Answer- java.io


Que-  Which of these class is not a member class of java.io package?

a. String

b. StringReader

c. Writer

d. File


Answer- String


Que-  Which of these interface is not a member of java.io package?

a. DataInput

b. ObjectInput

c. ObjectFilter

d. FileFilter


Answer- ObjectFilter


Que-  Which of these class is not related to input and output stream in terms of functioning?

a. File

b. Writer

c. InputStream

d. Reader


Answer- File


Que-  Which of these is specified by a File object?

a. a file in disk

b. directory path

c. directory in disk

d. none of the mentioned


Answer- directory in disk


Que-  Which of these is method for testing whether the specified element is a file or a directory?

a. IsFile()

b. isFile()

c. Isfile()

d. isfile()


Answer- isFile()


Que-  Which of these classes is used for input and output operation when working with bytes?

a. InputStream

b. Reader

c. Writer

d. All of the mentioned


Answer- InputStream


Que-  Which of these class is used to read and write bytes in a file?

a. FileReader

b. FileWriter

c. FileInputStream

d. InputStreamReader


Answer- FileInputStream


Que-  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- read()


Que-  Which of these data type is returned by every method of OutputStream?

a. int

b. float

c. byte

d. none of the mentioned


Answer- none of the mentioned


Que-  Which of these is a method to clear all the data present in output buffers?

a. clear()

b. flush()

c. fflush()

d. close()


Answer- flush()


Que-  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- print() and write()


Que-  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- Character Stream


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

a. FileReader

b. FileWriter

c. FileInputStream

d. InputStreamReader


Answer- FileReader


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

a. read()

b. scanf()

c. get()

d. getInteger()


Answer- read()

Previous Post Next Post