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 - Static functions can be accessed using null reference.

A - True

B - False

Answer : A

Explaination

True, Static functions can be accessed via class name or via null reference.

Q 2 - Is an empty .java file a valid source file?

A - True

B - False

Answer : A

Explaination

True, an empty .java file is a valid source file.

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

A - 0.0d

B - 0.0f

C - 0

D - not defined

Answer : B

Explaination

float variable has default value of 0.0f if defined as an instance/static variable.

Q 4 - What is the default value of Boolean variable?

A - true

B - false

C - null

D - not defined

Answer : B

Explaination

boolean variable has default value of false if defined as an instance/static variable.

Answer : B

Explaination

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

Answer : C

Explaination

Set is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.

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

Q 10 - This is the parent of Error and Exception classes.

A - Throwable

B - Catchable

C - MainError

D - MainException

Answer : A

Explaination

Throwable is the parent of both Error and Exception class.


java_questions_answers.htm

Advertisements