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

Java Miscellaneous

Advanced Java

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 - Static functions can be accessed using null reference.

A - True

B - False

Answer : A

Explaination

True, Static functions can be accessed via class name or via null reference.

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

A - 0

B - 0.0

C - null

D - not defined

Answer : A

Explaination

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

Answer : C

Explaination

String is a object.

Q 5 - Inheritance represents

A - HAS-A relationship.

B - IS-A relationship.

Answer : B

Explaination

Inheritance represets IS-A relationship providing code reusablity . Consider the following statement: Circle is a Shape. Here Shape is super class and Circle is a child class extends the super class Shape.

Q 6 - Can be constructor be made private?

A - True.

B - False.

Answer : A

Explaination

Yes, class with private constructor can not instantiated using new keyword.

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

When a task invokes its sleep() method, it returns to the waiting state.

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 - Which of the following is a marker interface?

A - serializable

B - comparable

C - cloneable

D - none of the above.

Answer : A

Explaination

serializable is a marker interface.

java_questions_answers.htm
Advertisements