Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  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- CharArrayReader


Que-  Which of these classes can return more than one character to be returned to input stream?

a. BufferedReader

b. Bufferedwriter

c. PushbachReader

d. CharArrayReader


Answer- PushbachReader


Que-  Which of the following is not a segment of memory in java?

a. Stack Segment

b. Heap Segment

c. Code Segment

d. Register Segment


Answer- Register Segment


Que-  Does code Segment loads the java code?

a.TRUE

b.FALSE

c.Nothing Can be Said

d.None of the mentioned


Answer-TRUE


Que-  What is JVM?

a. Bootstrap

b. Interpreter

c. Extension

d. Compiler


Answer- Interpreter


Que-  Which one of the following is a class loader?

a. Bootstrap

b. Compiler

c. Heap

d. Interpreter


Answer- Bootstrap


Que-  Which class loader loads jar files from JDK directory?

a. Bootstrap

b. Extension

c. System

d. Heap


Answer- Extension


Que-  Which of the following is not a memory classification in java?

a. Young

b. Old

c. Permanent

d. Temporary


Answer- Temporary


Que-  What is the Java 8 update of PermGen?

a. Code Cache

b. Tenured Space

c. Metaspace

d. Eden space


Answer- Metaspace


Que-  Classes and Methods are stored in which space?

a. Eden space

b. Survivor space

c. Tenured space

d. Permanent space


Answer- Permanent space


Que-  Where is String Pool stored?

a. Java Stack

b. Java Heap

c. Permanent Generation

d. Metaspace


Answer- Java Heap


Que-  Which of these exceptions handles the situations when an illegal argument is used to invoke a method?

a. IllegalException

b. Argument Exception

c. IllegalArgumentException

d. IllegalMethodArgumentExcepetion


Answer- IllegalArgumentException


Que-  Which of these exceptions will be thrown if we declare an array with negative size?

a. IllegalArrayException

b. IllegalArraySizeExeption

c. NegativeArrayException

d. NegativeArraySizeExeption


Answer- NegativeArraySizeExeption


Que-  Which of these packages contain all the Java's built in exceptions?

a. java.io

b. java.util

c. java.lang

d. java.net


Answer- java.lang


Que-  Which of these exceptions will be thrown if we use null reference for an arithmetic operation?

a. ArithmeticException

b. NullPointerException

c. IllegalAccessException

d. IllegalOperationException


Answer- NullPointerException


Que-  Which of these class is used to create user defined exception?

a. java.lang

b. Exception

c. RunTime

d. System


Answer- Exception


Que-  Which of these class provides various types of rounding functions?

a. Math

b. Process

c. System

d. Object


Answer- Math


Que-  Which of these methods return a smallest whole number greater than or equal to variable X?

a. double ceil(double X)

b. double floor(double X)

c. double max(double X)

d. double min(double X)


Answer- double ceil(double X)


Que-  Which of these method returns a largest whole number less than or equal to variable X?

a. double ceil(double X)

b. double floor(double X)

c. double max(double X)

d. double min(double X)


Answer- double floor(double X)


Que-  Which of function return absolute value of a variable?

a. abs()

b. absolute()

c. absolutevariable()

d. none of the mentioned


Answer- abs()


Que-  Which of these methods of Byte wrapper can be used to obtain Byte object from a string?

a. toString()

b. getString()

c. decode()

d. encode()


Answer- decode()


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

a. doubleValue()

b. converDouble()

c. getDouble()

d. getDoubleValue()


Answer- doubleValue()


Que-  Which of these is a super class of wrappers Byte and short wrappers?

a. Long

b. Digits

c. Float

d. Number


Answer- Number


Que-  Which of these methods is not defined in both Byte and Short wrappers?

a. intValue()

b. isInfinite()

c. toString()

d. hashCode()


Answer- isInfinite()


Que-  Which of these methods of Byte wrapper can be used to obtain Byte object from a string?

a. toString()

b. getString()

c. decode()

d. encode()


Answer- decode()


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

a. doubleValue()

b. converDouble()

c. getDouble()

d. getDoubleValue()


Answer- doubleValue()


Que-  Which of these is a super class of wrappers Byte and short wrappers?

a. Long

b. Digits

c. Float

d. Number


Answer- Number

Previous Post Next Post