Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Topic 2 APP Quiz

Total questions: 8

Worksheet time: 5mins

Name
Class
Date
1.

What is encapsulation in Object-Oriented Programming (OOP)

a)

Grouping related methods and variables in a single unit

b)

Allowing access to methods and variables from anywhere in the program

c)

Hiding the internal details of an object and exposing only what is necessary

d)

A technique to define multiple methods with the same name

2.

Which access modifier is typically used to achieve encapsulation?

a)

public

b)

private

c)

protected

d)

final

3.

What is the main purpose of inheritance in OOP?

a)

To create private variables

b)

To reuse existing code in new classes

c)

To make variables accessible everywhere

d)

To declare methods with the same name

4.

Encapsulation helps in improving the maintainability and flexibility of code

a)

True

b)

False

5.

A subclass automatically inherits private fields from its superclass

a)

True

b)

False

6.

In inheritance, the class that inherits from another class is called the (a)   .

7.

Encapsulation is achieved using ___________ fields and providing ______________ methods to access them.

(a)  

8.

You are developing a banking application. Which OOP concepts are best suited to restrict direct access to account balance and provide controlled access through methods?

a)

Polymorphism

b)

Inheritance

c)

Encapsulation

d)

Abstraction