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

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : C

Explaination

The float data type is represented by single-precision 32-bit IEEE 754 floating point.

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

A - '\u0000'

B - 0

C - null

D - not defined

Answer : A

Explaination

char variable has default value of '\u0000' if defined as an instance/static variable.

Answer : C

Explaination

Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded.

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 - Dynamic binding uses which information for binding?

A - type.

B - object.

C - Both of the above.

D - None of the above.

Answer : B

Explaination

Dynamic binding uses object information for binding.

Answer : A

Explaination

When a task invokes its yield() method, it returns to the ready 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.


java_questions_answers.htm

Advertisements