wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python L1 Quiz 8: Designing Programs

Total questions: 10

Worksheet time: 30mins

Name
Class
Date
1.

True or False: We can create a turtle inside a python class

a)

True

b)

False

2.

True or False: Once you draw something with turtle, you can't get user input from the keyboard afterward.

a)

True

b)

False

3.

When creating a flowchart to model a program, a diamond shape usually represents a:

a)

terminator (the start or end of the program)

b)

process

c)

decision

d)

variable

4.

Why are flowcharts useful?

a)

They allow us to visualize the logic of our program

b)

They make it easier to explain your code to others

c)

They help you to understand when to use functions and flow controls when writing the program

d)

All of these are reasons why flowcharts are useful

5.

What is pseudocode?

a)

It means 'false code' and is the name given to code that has errors in it

b)

It is a plan of a program written in words that resemble code

c)

It is an object-oriented language that is easier to read than python

d)

It is a style of writing comments that help the user to understand what is going on in the program

6.

Which is true about python programs?

a)

You can only have one class per python file

b)

Code in a function is not run until the function is called

c)

An object cannot contain another object as a variable

d)

You have to call the __init__ method of an object after it is created

7.

In our adventure game, the state variable tells us:

a)

The player's current progress through the story, like a save point

b)

What region of the game world the player is in

c)

The condition of the player, like health points and status

d)

Whether the player is a solid, liquid, or gas

8.

How can we make sure our program ignores capitalization when comparing text input?

a)

Ask the user to follow the capitalization pattern that you coded

b)

Create if statements to check for every likely capitalization pattern

c)

Ignore text that isn't capitalized the same way as you wrote it

d)

Use .lower() to change the input string to lowercase and then compare

9.

A while loop works well for the main part of our adventure game because:

a)

It will keep repeating the same part of the game code forever

b)

It will repeat the same steps for a set number of rounds of the game

c)

It will repeat the same process until the player wins, loses, or quits the game

d)

It will repeat the same process until one of the players sets a new high score

10.

Creating classes and objects in our adventure game code is helpful because:

a)

We could write a class that holds all the possible user input text and outcomes

b)

We could easily change the map and reuse the map class to make maps for other games

c)

Having classes allowed us to control two turtles in the same program

d)

Creating objects makes the game run faster