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

Answer : C

Explaination

Correct syntax is public static void main(String[] args).

Q 2 - What is the size of long variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : D

Explaination

The long data type is represented by 64-bit two's complement integer.

Minimum value: -263

Maximum value: 263-1

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.

Q 4 - What is the default value of Object variable?

A - undefined

B - 0

C - null

D - not defined

Answer : C

Explaination

Object variable has default value of null if defined as an instance/static variable.

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.

Q 8 - Does garbage collection guarantee that a program will not run out of memory?

A - True.

B - False.

Answer : B

Explaination

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

Answer : B

Explaination

Program throws "NoSuchMethodError" error at runtime.

Q 10 - Which method must be implemented by all threads?

A - wait()

B - start()

C - stop()

D - run()

Answer : D

Explaination

All threads must implement the run() method.


java_questions_answers.htm


Advertisements
E-Books Store