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 - Primitive variables are stored on Stack.

A - True

B - False

Answer : A

Explaination

Primitive variables like int, float are stored on Stack.

Q 2 - What is the size of short variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : C

Explaination

The short data type is represented by 16-bit signed two's complement integer.

Minimum value: -32,768

Maximum value: 32,767

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

A - 0

B - 0.0

C - null

D - not defined

Answer : A

Explaination

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

Answer : C

Explaination

Protected access modifier is used to restrict access to variables, methods and constructors to subclass only. Subclass can lie in different package.

Answer : A

Explaination

It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.

Q 6 - Can be constructor be made final?

A - True.

B - False.

Answer : B

Explaination

No, this is not possible.

Answer : A

Explaination

If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

Answer : B

Explaination

Serialization is the process of writing the state of an object to a byte stream.

Answer : B

Explaination

Program throws "NoSuchMethodError" error at runtime.

Q 10 - which operator is considered to be with highest precedence?

A - () , []

B - =

C - ?:

D - %

Answer : A

Explaination

Postfix operators i.e () [] . is at the highest precedence.


java_questions_answers.htm

Advertisements