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 int variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : C

Explaination

The int data type is represented by 32-bit signed two's complement integer,

Minimum value: -231

Maximum value: 231-1

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

A - 0.0

B - 0

C - null

D - not defined

Answer : B

Explaination

short variable has default value of 0 if defined as an instance/static variable.

Answer : C

Explaination

By default, variables, methods and constructors can be accessed by any class lying in the same package.

Answer : C

Explaination

An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

Q 6 - Can be constructor be made final?

A - True.

B - False.

Answer : B

Explaination

No, this is not possible.

Answer : A

Explaination

If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

Answer : A

Explaination

When a task invokes its yield() method, it returns to the ready state.

Q 9 - Is it necessary that each try block must be followed by a catch block?

A - True.

B - False.

Answer : B

Explaination

It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.

java_questions_answers.htm
Advertisements