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

Explaination

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

Answer : B

Explaination

A class consist of Local variable, instance variables and class variables.

Answer : C

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.

Answer : A

Explaination

Deserialization is the process of restoring state of an object from a byte stream.

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.


java_questions_answers.htm

Advertisements