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 boolean variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - not precisely defined

Answer : B

Explaination

The boolean data type can take either true or false, but its "size" isn't precisely defined.

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

A - 0.0d

B - 0.0f

C - 0

D - not defined

Answer : A

Explaination

double variable has default value of 0.0d if defined as an instance/static variable.

Answer : C

Explaination

By default, variables, methods and constructors can be accessed by any class lying in the same package.

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 : B

Explaination

A class consist of Local variable, instance variables and class variables.

Answer : B

Explaination

Method Overriding is example of dynamic Binding.

Answer : A

Explaination

These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

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