JAVA > Programming Basic
Set 2 - OOP Concept
--:--
Submit Test
Question 1 of 15
Clear
Which of the following is NOT one of the four main pillars of Object-Oriented Programming (OOP) in Java?
A
Encapsulation
B
Inheritance
C
Compilation
D
Polymorphism
Question 2 of 15
Clear
Which OOP concept wraps data (variables) and code (methods) together into a single unit and restricts direct access?
A
Inheritance
B
Encapsulation
C
Abstraction
D
Overloading
Question 3 of 15
Clear
Which keyword is used in Java to inherit properties and methods from a superclass?
A
implements
B
inherits
C
extends
D
super
Question 4 of 15
Clear
What is it called when a class defines multiple methods with the same name but different parameter lists?
A
Method Overriding
B
Method Overloading
C
Method Hiding
D
Dynamic Binding
Question 5 of 15
Clear
Which OOP principle allows a subclass to provide a specific implementation of a method already defined in its parent class?
A
Method Overloading
B
Encapsulation
C
Method Overriding
D
Constructor Chaining
Question 6 of 15
Clear
Which keyword is used inside a subclass to refer directly to its immediate parent class object or constructor?
A
this
B
parent
C
super
D
base
Question 7 of 15
Clear
Which keyword is used by a Java class to inherit an interface?
A
extends
B
implements
C
inherits
D
uses
Question 8 of 15
Clear
Can you create an object directly from an abstract class using the 'new' keyword in Java?
A
Yes, always
B
No, abstract classes cannot be instantiated directly
C
Yes, if it has a main method
D
Only inside the same package
Question 9 of 15
Clear
Which access modifier restricts the visibility of a class member strictly within the same class?
A
public
B
protected
C
default
D
private
Question 10 of 15
Clear
What is the primary purpose of a constructor in Java?
A
To destroy unused objects
B
To initialize newly created objects
C
To return a value to the caller
D
To inherit static methods
Question 11 of 15
Clear
Which type of inheritance is NOT directly supported through classes in Java to avoid the Diamond Problem?
A
Single Inheritance
B
Multilevel Inheritance
C
Hierarchical Inheritance
D
Multiple Inheritance
Question 12 of 15
Clear
Which keyword refers to the current object instance inside a method or constructor?
A
super
B
self
C
this
D
current
Question 13 of 15
Clear
What type of polymorphism is achieved through Method Overriding in Java?
A
Compile-time Polymorphism
B
Runtime Polymorphism
C
Static Polymorphism
D
Parametric Polymorphism
Question 14 of 15
Clear
Which keyword prevents a class from being subclassed (inherited) by any other class?
A
static
B
abstract
C
final
D
private
Question 15 of 15
Clear
In Java, which class is the root superclass of all classes by default?
A
System
B
Main
C
Object
D
Class
Finish & Submit Exam
Question Palette
0 / 15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Answered
Not Answered
Submit Final Answers
Privacy Policy