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 multiple classes in same java file?

A - True

B - False

Answer : A

Explaination

True, a java file can contain one public class and many other non-public classes.

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

A - 0

B - 0.0

C - 0L

D - not defined

Answer : C

Explaination

long variable has default value of 0L 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 : A

Explaination

Static binding occurs during Compile time.

Answer : B

Explaination

Serialization is the process of writing the state of an object to a byte stream.

Q 9 - Can try statements be nested?

A - True.

B - False.

Answer : A

Explaination

Yes, try statements be nested.

Q 10 - Which of the following is a thread safe?

A - StringBuilder

B - StringBuffer

C - Both of the above

D - none of the above

Answer : B

Explaination

StringBuffer is thread safe.


java_questions_answers.htm

Advertisements