Java Operators

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java Interfaces

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Class References

Java Useful Resources

Java Online Quiz



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 - What of the following is the default value of an instance variable?

A - null

B - 0

C - Depends upon the type of variable

D - Not assigned

Answer : C

Explaination

Instance variables are assigned default values based on their types. For example, int variable is assigned 0 and an object type variable is assigned null as default value.

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

Explaination

String is a object.

Answer : B

Explaination

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

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

Explaination

If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.

Answer : B

Explaination

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

Answer : A

Explaination

The garbage collector invokes an object's finalize() method when it detects that the object has become unreachable.

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