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 - Which of the following is not a keyword in java?

A - static

B - Boolean

C - void

C - private

Answer : B

Explaination

Boolean is a class and is not a keyword.

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

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.

Answer : C

Explaination

Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application.

Answer : A

Explaination

Static binding occurs during Compile time.

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 - Can try statements be nested?

A - True.

B - False.

Answer : A

Explaination

Yes, try statements be nested.

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