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

A - null

B - 0

C - Depends upon the type of variable

D - Not assigned

Answer : C

Explaination

Instance variables are assigned default values based on their types. For example, int variable is assigned 0 and an object type variable is assigned null as default value.

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

A - ""

B - ''

C - null

D - not defined

Answer : C

Explaination

String variable has default value of null if defined as an instance/static variable.

Answer : C

Explaination

String is a object.

Q 5 - Inheritance represents

A - HAS-A relationship.

B - IS-A relationship.

Answer : B

Explaination

Inheritance represets IS-A relationship providing code reusablity . Consider the following statement: Circle is a Shape. Here Shape is super class and Circle is a child class extends the super class Shape.

Q 6 - Can be constructor be made final?

A - True.

B - False.

Answer : B

Explaination

No, this is not possible.

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

Explaination

When a task invokes its sleep() method, it returns to the waiting state.

Q 9 - Deletion is faster in LinkedList than ArrayList.

A - True.

B - False.

Answer : A

Explaination

Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.

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