Java Tutorial

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 List Interface

Java Queue Interface

Java Map Interface

Java Set Interface

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

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 - What is the size of char variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : B

Explaination

The char data type is represented by single 16-bit Unicode character.

Minimum value: '\u0000' (or 0)

Maximum value: '\uffff' (or 65,535)

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

Explaination

String object is immutable so that once it is created a String object cannot be changed. Since String is immutable it can safely be shared between many threads which are considered very important for multithreaded programming.

Answer : A

Explaination

It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.

Answer : A

Explaination

Method Overloading is example of static binding.

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 - Deletion is faster in LinkedList than ArrayList.

A - True.

B - False.

Answer : A

Explaination

Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.

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