Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Exploring Basic OOP Concepts

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What does OOP stand for?

a)

Object-Optimized Programming

b)

Object-Oriented Process

c)

Optimized Object Programming

d)

Object-Oriented Programming

2.

Name the four main principles of OOP.

a)

Encapsulation, Polymorphism, Composition, Generalization

b)

Composition, Aggregation, Inheritance, Encapsulation

c)

Abstraction, Inheritance, Composition, Polymorphism

d)

Encapsulation, Inheritance, Polymorphism, Abstraction

3.

What is a class in OOP?

a)

A class is a type of variable in OOP.

b)

A class is a function that returns objects.

c)

A class is a method for data manipulation in OOP.

d)

A class is a blueprint for creating objects in OOP.

4.

Define an object in the context of OOP.

a)

An object is a collection of unrelated functions.

b)

An object is a blueprint for creating classes.

c)

An object is a static representation of data.

d)

An object is an instance of a class that contains data and methods.

5.

What is encapsulation?

a)

Encapsulation is the bundling of data and methods that operate on that data within a single unit, restricting access to some of the object's components.

b)

Encapsulation is the process of separating data from methods in programming.

c)

Encapsulation is the practice of using multiple classes to manage data.

d)

Encapsulation refers to the visibility of all components in an object.

6.

Explain inheritance in OOP.

a)

Inheritance allows classes to operate independently without any relationship.

b)

Inheritance is a process where classes are created without any shared features.

c)

Inheritance is a mechanism in OOP where a class derives properties and behaviors from another class, enabling code reuse and establishing a parent-child relationship.

d)

Inheritance is a method to eliminate all properties from a class entirely.

7.

What is polymorphism?

a)

Polymorphism is the ability of different classes to be treated as instances of the same class through a common interface.

b)

Polymorphism is the process of combining multiple classes into one single class.

c)

Polymorphism refers to the ability of a class to inherit properties from multiple parent classes.

d)

Polymorphism is the technique of creating multiple instances of the same class in different contexts.

8.

How does abstraction differ from encapsulation?

a)

Abstraction hides complexity; encapsulation restricts access.

b)

Abstraction simplifies design; encapsulation enhances performance.

c)

Abstraction defines behavior; encapsulation manages state.

d)

Abstraction combines data; encapsulation separates functions.

9.

What is a constructor?

a)

A constructor is a function that returns a string value.

b)

A constructor is a special method used to initialize objects in a class.

c)

A constructor is a method that deletes objects from memory.

d)

A constructor is a type of variable used in programming.

10.

What is a destructor?

a)

A destructor is a tool that enhances an object's performance while it is in use.

b)

A destructor is a function that allocates memory for an object during its lifetime.

c)

A destructor is a method that initializes an object's properties upon creation.

d)

A destructor is a function that cleans up an object's resources before it is removed from memory.

11.

What is the purpose of an interface in OOP?

a)

To enforce strict data types for class attributes.

b)

To create a blueprint for data structures without behavior.

c)

To provide a way for classes to inherit properties directly.

d)

To define a contract for classes to implement, ensuring consistent behavior and promoting code reusability.

12.

What is method overloading?

a)

Method overloading allows multiple methods in a class to have the same name but different parameter lists.

b)

Method overloading allows methods to have the same name with identical parameters.

c)

Method overloading is when methods in different classes share the same name.

d)

Method overloading requires methods to have unique names in a class.

13.

What is method overriding?

a)

Method overriding is a process of deleting methods from a subclass.

b)

Method overriding is a feature in object-oriented programming where a subclass redefines a method from its superclass.

c)

Method overriding is a technique to create new methods in a class.

d)

Method overriding allows a superclass to change its own methods.

14.

Explain the concept of a superclass and subclass.

a)

A superclass is a specific class, while a subclass is a general class.

b)

A superclass and subclass are unrelated classes in programming.

c)

A superclass is a general class, while a subclass is a specialized class that inherits from the superclass.

d)

A superclass is a subclass that cannot inherit properties.

15.

What is a static method?

a)

A static method is a type of variable that holds class data only.

b)

A static method is a method that can only be used in abstract classes.

c)

A static method is a class-level method that does not require an instance to be called.

d)

A static method is an instance-level method that requires an object to be called.

16.

What is a virtual method?

a)

A virtual method is a static method that cannot be overridden.

b)

A virtual method is a method in a base class that can be overridden in derived classes.

c)

A virtual method is a method that is only defined in derived classes.

d)

A virtual method is a method that cannot be called from the base class.

17.

What is the difference between an abstract class and an interface?

a)

An abstract class can implement multiple interfaces, while an interface can implement only one abstract class.

b)

An abstract class can only be instantiated, while an interface cannot be instantiated at all.

c)

An abstract class can have implemented methods and state, while an interface cannot have implemented methods (except default methods) and cannot maintain state.

d)

An abstract class cannot have any methods, while an interface can have multiple methods.

18.

What role do access modifiers play in OOP?

a)

Access modifiers control the execution speed of class methods, influencing performance.

b)

Access modifiers define the accessibility of class members, enhancing encapsulation and protecting object integrity.

c)

Access modifiers are used to optimize memory usage in object-oriented programming.

d)

Access modifiers determine the color of class members, affecting visual representation.

19.

What is a namespace in OOP?

a)

A namespace is a type of variable used to store data in OOP.

b)

A namespace is a container for identifiers that helps organize code and prevent naming conflicts in object-oriented programming.

c)

A namespace is a method for executing code in parallel in OOP.

d)

A namespace is a design pattern that enhances code readability in OOP.

20.

How does OOP improve code reusability?

a)

OOP enhances code reusability by using inheritance, polymorphism, and encapsulation.

b)

OOP improves performance through faster execution times.

c)

OOP limits code access with strict data types.

d)

OOP reduces code complexity by using static typing.