wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Object-Oriented Programming Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What does a class represent in Python?

a)

A function

b)

A blueprint for objects

c)

A variable

d)

A module

2.

What is an object in Python?

a)

A block of code

b)

An instance of a class

c)

A data type

d)

A loop

3.

Which method is called automatically when an object is created?

a)

__start__

b)

__create__

c)

__init__

d)

__object__

4.

What does self refer to in a Python class method?

a)

The class itself.

b)

The current instance of the class.

c)

A global variable.

d)

A static variable.

5.

How do you create an object (instance) of a class named MyClass?

a)

obj = MyClass()

b)

obj = new MyClass

c)

MyClass.create_object()

d)

instance = MyClass.object

6.

What is an instance variable in a Python class?

a)

A variable shared among all instances of a class.

b)

A variable defined outside the class.

c)

A variable specific to an instance of a class.

d)

A variable used for method overloading.

7.

Which of the following core principle of Object-Oriented Programming (OOP) that involves bundling data and methods that operate on that data into a single unit (class)?

a)

Inheritance

b)

Polymorphism

c)

Encapsulation

d)

Abstraction

8.

What is the process of creating a new class based on an existing class called?

a)

Polymorphism

b)

Encapsulation

c)

Inheritance

d)

Abstraction

9.

Which of the following best describes how Python handles "private" attributes within a class?

a)

It uses the private keyword to declare them.

b)

It uses a single underscore prefix (_) to make them truly inaccessible.

c)

It uses a double underscore prefix (__) as a naming convention to indicate intended privacy and trigger name mangling.

d)

Python does not support private attributes; all members are public

10.

Which of the following does not correctly create an object instance?

a)

my_dog=Dog("Lego")

b)

puppy= MyDog()

c)

jammie = His-Dog()

d)

dog=Her_Dog()