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

Answer : C

Explaination

Correct syntax is public static void main(String[] args).

Q 2 - What is the size of long variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : D

Explaination

The long data type is represented by 64-bit two's complement integer.

Minimum value: -263

Maximum value: 263-1

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

A - 0

B - 0.0

B - null

B - undefined

Answer : A

Explianation

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

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 - 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.

Answer : A

Explaination

Method Overloading is example of static binding.

Answer : B

Explaination

A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization.

Q 9 - Can constructor be inherited?

A - True.

B - False.

Answer : B

Explaination

No, constructor cannot be inherited.

Q 10 - Which of the following is a marker interface?

A - serializable

B - comparable

C - cloneable

D - none of the above.

Answer : A

Explaination

serializable is a marker interface.


java_questions_answers.htm

Advertisements
E-Books Store