Java Online Quiz


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 - What of the following is the default value of a local variable?

A - null

B - 0

C - Depends upon the type of variable

D - Not assigned

Answer : D

Explaination

Local variables are not assigned any value by default.

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.

Answer : C

Explaination

An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

Q 6 - Composition represents

A - HAS-A relationship.

B - IS-A relationship.

Answer : A

Explaination

Holding the reference of the other class within some other class is known as composition. It represents a HAS-A relationship. For example, a Student has a Pen. Here Student class has Pen as its instance variable.

Q 7 - Static binding uses which information for binding?

A - type.

B - object.

C - Both of the above.

D - None of the above.

Answer : A

Explaination

Static binding uses type information for binding.

Answer : A

Explaination

Deserialization is the process of restoring state of an object from a byte stream.

Q 9 - Is it necessary that each try block must be followed by a catch block?

A - True.

B - False.

Answer : B

Explaination

It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.

java_questions_answers.htm
Advertisements