Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python L30 OOP class

Total questions: 9

Worksheet time: 6mins

Name
Class
Date
1.

What is the purpose of the __init__ method in the Snake class?

a)

To destroy the snake

b)

To update the screen

c)

To set up the snake’s initial body segments

d)

To listen to keyboard input

2.

What is the purpose of this loop?

a)

To move the head forward

b)

To delete the last segment

c)

To make each segment follow the one in front

d)

To change the background color

3.

Which of these shows the correct way to create an object from Snake class?

a)

snake1 = Snake()

b)

Snake = snake1()

c)

snake1 = turtle()

d)

class Snake:

4.

In OOP, the self keyword refers to the instance of the class where it is used.

a)

True

b)

False

5.

Fill in the blank with the correct code.

6.

Which of the following best describes a class in Python?

a)

A built-in function

b)

A blueprint for creating objects

c)

A type of loop

d)

A library

7.

Which of the following is a benefit of using OOP?

a)

You must always write longer code

b)

You can reuse and organize your code better

c)

You don’t have to use variables anymore

d)

Python runs faster

8.

What will be printed when the code runs?

a)

Error

b)

my_car

c)

Driving the car!

d)

Car

9.

An object can be created without using a class in Python.

a)

True

b)

False