Java Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Core Java. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - Objects are stored on Stack.

A - True

B - False

Answer : B

Explaination

Objects are allocated memory in heap memory space.

Q 2 - What is the size of double variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : D

Explaination

The double data type is represented by double-precision 64-bit IEEE 754 floating point.

Q 3 - What is the default value of int variable?

A - 0

B - 0.0

C - null

D - not defined

Answer : A

Explaination

int variable has default value of 0 if defined as an instance/static variable.

Q 5 - A class always has a default constructor.

A - True

B - False

Answer : B

Explaination

It is not mandatory to have a default constructor in a class.

Answer : C

Explaination

Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application.

Answer : A

Explaination

A NullPointerException is thrown when calling the instance method of a null object or modifying/accessing field of a null object.

Answer : A

Explaination

After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.

Answer : A

Explaination

Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass.

Answer : B

Explaination

A program is expected to recover if an exception occurs.

java_questions_answers.htm
Advertisements