Java Online Quiz


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

Explaination

A class is a blue print from which individual objects are created. A class can contain fields and methods to describe the behavior of an object.

Q 2 - Can we have two public classes in one java file?

A - True

B - False

Answer : B

Explaination

No, a java file can contain only one public class.

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

A - 0.0

B - 0

C - null

D - not defined

Answer : B

Explaination

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

Answer : C

Explaination

static block is used to initialize the static data member.It is executed before main method at the time of loading of a class.

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

Explaination

A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

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