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

A - True

B - False

Answer : B

Explaination

Objects are allocated memory in heap memory space.

Q 2 - What is the size of boolean variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - not precisely defined

Answer : B

Explaination

The boolean data type can take either true or false, but its "size" isn't precisely defined.

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

A - 0

B - 0.0

C - null

D - not defined

Answer : A

Explaination

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

Answer : B

Explaination

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

Answer : B

Explaination

An immutable object can't be changed once it is created. String objects are immutable.

Answer : A

Explaination

An applet is a Java program that runs in a Web browser.

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.

Q 8 - Does garbage collection guarantee that a program will not run out of memory?

A - True.

B - False.

Answer : B

Explaination

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

Q 9 - Which arithmetic operations can result in the throwing of an ArithmeticException?

A - / , %

B - * , +

C - ! , -

D - >>, <<

Answer : A

Explaination

Integer / and % can result in the throwing of an ArithmeticException.

Answer : B

Explaination

A program is expected to recover if an exception occurs.


java_questions_answers.htm

Advertisements