Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

5MM OOP Classes

Total questions: 12

Worksheet time: 7mins

Name
Class
Date
1.

What is a Python class?

a)

A function to create an object.

b)

A template (blueprint) for creating objects.

c)

A procedure related to an object.

d)

A process that repeats are directed.

2.

What is the keyword to create a class?

a)

import

b)

__int__

c)

class

d)

def

3.

Identify the initialization method for a Car class.

a)

class init(self, make, model):

b)

class__init__:

c)

def __init__(self, make, model):

d)

def __init__(self, make, model):

4.

What are class variables?

a)

Variables with a sense of style

b)

Variables that apply to all instances of the class

c)

Variables that change with every instance of the class

d)

Integers

5.

Do you think a variable to store a car's value would be a class or instance variable?

a)

Class

b)

Instance

6.

What does __init__ do?

a)

Constructs the instance

b)

Initialize the instance values

c)

Calls the Super class

d)

Creates a circle

7.

Given this code, what will print?

a)

The shark is being awesome.

b)

The shark is swimming.

The shark is being awesome.

c)

The shark is swimming.

d)

ERROR

8.

Given this class, how would you make jaws swim?

a)

jaws.swim()

b)

jaws.swim

c)

swim.jaws

d)

jaws(swim)

e)

swim(jaws)

9.

Given this code, how many attributes are in the class?

a)

1

b)

2

c)

3

d)

4

e)

0

10.

Given this code, what is the class name?

a)

Shark

b)

jaws

c)

Bruce

d)

swim

e)

self

11.

Given this code, what is the attribute?

a)

name

b)

self

c)

__init__

d)

swim

e)

be_awesome

12.

Who would win a battle between, Darth Vader vs. Capt. James T. Kirk

a)

Darth Vader

b)

Capt. James T. Kirk