Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Variables and Turtle Module Quiz

Total questions: 100

Worksheet time: 50mins

Name
Class
Date
1.

What is a variable in Python?

a)

A variable is a place to store data that can be used and changed in a program.

b)

A variable is a type of computer hardware.

c)

A variable is a type of error in Python.

d)

A variable is a command to print text.

2.

Which Python code will draw a hexagon using the turtle module?

a)

import turtle sides = 6 for i in range(0, sides): turtle.forward(50) turtle.right(360/sides)

b)

import turtle sides = 4 for i in range(0, sides): turtle.forward(50) turtle.right(90)

c)

import turtle sides = 3 for i in range(0, sides): turtle.forward(50) turtle.right(120)

d)

import turtle sides = 8 for i in range(0, sides): turtle.forward(50) turtle.right(45)

3.

What does the following code do? import turtle sides = 6 for i in range(0, sides): turtle.forward(50) turtle.right(360/sides)

a)

Draws a hexagon (six-sided shape)

b)

Draws a triangle (three-sided shape)

c)

Draws a square (four-sided shape)

d)

Draws a circle

4.

Which of the following is a keyword related to Python programming?

a)

variable

b)

triangle

c)

circle

d)

octagon

5.

If you want to change the number of sides in the shape drawn by the turtle, which part of the code should you modify?

a)

The value assigned to the variable 'sides'

b)

The value inside turtle.forward()

c)

The word 'import'

d)

The word 'turtle'

6.

What is the main purpose of the Tracker Booklet mentioned in the learning material?

a)

To use the learning objectives and track your progress

b)

To write essays about computing

c)

To draw pictures of computers

d)

To record attendance in class

7.

According to the learning objectives, what should you be able to do at the Bronze level?

a)

Write Python code that will be output to the user

b)

Understand what a variable is and use it to store data

c)

Combine the use of outputs and variables for a given scenario

d)

Create a website using HTML

8.

At the start of the lesson, what are you expected to do in the lesson box?

a)

RAG what you think you know so far

b)

Write a summary of the previous lesson

c)

Draw a diagram of a computer

d)

List all the keywords for the lesson

9.

Which of the following is a keyword mentioned in the learning material?

a)

input

b)

database

c)

algorithm

d)

encryption

10.

What does the Gold learning objective require you to do?

a)

Combine the use of outputs and variables for a given scenario

b)

Write Python code that will be output to the user

c)

Understand what a variable is and use it to store data

d)

Draw a computer system

11.

Why is it important to RAG what you think you know at the start of the lesson?

a)

To reflect on your prior understanding and track your progress

b)

To finish the lesson early

c)

To avoid doing homework

d)

To get a higher grade automatically

12.

Which of the following is NOT listed as a keyword in the material?

a)

encryption

b)

output

c)

variable

d)

syntax

13.

What does the Silver learning objective focus on?

a)

Understanding what a variable is and using it to store data to output to the user

b)

Writing a story about computers

c)

Drawing a diagram of a computer

d)

Learning about computer history

14.

What is the purpose of the "Start" box in the lesson tracker?

a)

To RAG what you think you know so far

b)

To write your name

c)

To draw a picture

d)

To list your favorite subject

15.

What is a variable in programming?

a)

A value that can be changed and holds data

b)

A type of computer hardware

c)

A fixed value that never changes

d)

A programming language

16.

In the given Python code example, which word is used as a variable?

a)

sides

b)

import

c)

turtle

d)

forward

17.

Which of the following is NOT a keyword related to the topic discussed in the material?

a)

output

b)

variable

c)

syntax

d)

hardware

18.

Why are variables important in programming? (Choose the best answer)

a)

They allow data to be stored and recalled when needed

b)

They make the computer run faster

c)

They are used to draw shapes only

d)

They are only used in Python

19.

Suppose you want to change the number of sides in the example code from 6 to 8. What should you do?

a)

Change the value of the variable 'sides' to 8

b)

Delete the variable 'sides'

c)

Change 'import turtle' to 'import sides'

d)

Remove the for loop

20.

What value does the variable "sides" hold in the given Python code?

a)

6

b)

4

c)

8

d)

10

21.

In the provided Python code, what is the purpose of the variable "sides"?

a)

It stores the number of sides for the shape being drawn.

b)

It stores the length of each side.

c)

It stores the color of the shape.

d)

It stores the name of the shape.

22.

How is the variable "sides" used in the loop within the Python code?

a)

It determines how many times the loop runs and helps calculate the angle for turning.

b)

It sets the color of the turtle.

c)

It changes the speed of the turtle.

d)

It prints the value to the screen.

23.

Why is it useful to use a variable like "sides" in a program that draws shapes?

a)

It allows you to easily change the number of sides without rewriting the code.

b)

It makes the program run faster.

c)

It changes the color of the shape.

d)

It makes the computer use less memory.

24.

What is the first step to open Python using IDLE on a Windows computer?

a)

Click on either the windows or magnifying glass symbols in the bottom left

b)

Search for “IDLE”

c)

Click on IDLE (Python)

d)

Open the command prompt

25.

Which of the following keywords is NOT listed as important for learning Python in the provided material?

a)

output

b)

syntax

c)

loop

d)

variable

26.

After searching for "IDLE" and clicking on it, what should you expect to see?

a)

A Python shell window with a prompt (>>>)

b)

A web browser window

c)

A file explorer window

d)

A command prompt window

27.

Why is it important to understand what a variable is when learning Python?

a)

Because variables are used to store data to output to the user

b)

Because variables make the code run faster

c)

Because variables are only used for decoration

d)

Because variables are not needed in Python

28.

If you want to combine the use of outputs and variables for a given scenario in Python, which level of learning are you aiming for according to the material?

a)

Gold

b)

Bronze

c)

Silver

d)

Platinum

29.

What is the name of the first window that appears when you open Python?

a)

Editor

b)

Shell

c)

Console

d)

Terminal

30.

Where should you write your Python code?

a)

In the shell window

b)

In the editor window

c)

In the command prompt

d)

In the browser

31.

What should you do to run your Python code after writing it in the editor?

a)

Click Save

b)

Select RUN and then RUN module

c)

Close the editor

d)

Type 'run' in the shell

32.

Why is it important to know the difference between the shell and the editor in Python?

a)

Because you can only save files in the shell

b)

Because you write and run code in different windows

c)

Because the shell is used for drawing shapes

d)

Because the editor cannot display errors

33.

Which Python turtle command is used to lift the pen up so you can move the turtle without drawing?

a)

turtle.penup()

b)

turtle.pendown()

c)

turtle.right()

d)

turtle.begin_fill()

34.

What does the command turtle.fillcolor("Brown") do in Python turtle?

a)

Changes the fill colour to brown (or other colour)

b)

Changes the pen colour to red

c)

Moves the turtle forward

d)

Ends the filling sequence

35.

Which command would you use to make the turtle turn left?

a)

turtle.left()

b)

turtle.right()

c)

turtle.backward()

d)

turtle.penup()

36.

If you want to begin filling a shape with color in Python turtle, which command should you use?

a)

turtle.begin_fill()

b)

turtle.end_fill()

c)

turtle.pendown()

d)

turtle.penup()

37.

What is the purpose of the variable 'sides' in the provided Python code snippet?

a)

It stores the number of sides for the shape to be drawn

b)

It stores the color of the pen

c)

It stores the length of each side

d)

It stores the fill color

38.

In the code snippet, what does the loop 'for i in range(0, sides):' accomplish?

a)

It repeats the drawing commands for each side of the shape

b)

It changes the pen color each time

c)

It fills the shape with color

d)

It lifts the pen up after each side

39.

Suppose you want to draw a square using the turtle module. What value should you assign to the variable 'sides'?

a)

4

b)

3

c)

6

d)

8

40.

Why is spelling important when writing Python code, especially with turtle commands?

a)

Incorrect spelling can cause errors and the code may not run

b)

It makes the code look nicer

c)

It helps the turtle move faster

d)

It changes the color of the turtle

41.

How would you change the pen color to blue using a turtle command?

a)

turtle.pencolor("Blue")

b)

turtle.fillcolor("Blue")

c)

turtle.penup()

d)

turtle.backward()

42.

What shape will the turtle draw if the variable 'sides' is set to 6 in the provided code snippet?

a)

Hexagon

b)

Square

c)

Triangle

d)

Octagon

43.

Which Python module is imported in the code example for drawing a rectangle?

a)

turtle

b)

math

c)

random

d)

os

44.

What is the value assigned to the variable 'sides' in the rectangle drawing code?

a)

4

b)

2

c)

3

d)

6

45.

In the provided code, what does the command 'turtle.forward(50)' do?

a)

Moves the turtle forward by 50 units

b)

Turns the turtle right by 50 degrees

c)

Moves the turtle backward by 50 units

d)

Draws a circle with radius 50

46.

Why is the angle '360/sides' used in the turtle.right() function in the code?

a)

To ensure the turtle turns the correct angle for each corner of the rectangle

b)

To make the turtle move in a straight line

c)

To change the color of the turtle

d)

To increase the speed of the turtle

47.

If you wanted to draw a triangle instead of a rectangle using the same code structure, what value should you assign to the variable 'sides'?

a)

3

b)

4

c)

5

d)

6

48.

What is the purpose of using a variable like 'sides' in the code?

a)

To store the number of sides of the shape being drawn

b)

To change the color of the turtle

c)

To print text to the screen

d)

To import a module

49.

How could you modify the code to make the rectangle longer on one side?

a)

Change the value in turtle.forward(100) to a larger number

b)

Change the value of 'sides' to 5

c)

Remove the turtle.right() commands

d)

Change the value in turtle.forward(50) to 0

50.

Which of the following can variables represent in a computer program?

a)

Only numbers

b)

Only memory addresses

c)

Numeric values, characters, character strings, or memory addresses

d)

Only character strings

51.

Why do variables allow you to write more flexible programs?

a)

They make the program run faster

b)

They allow you to write flexible programs instead of entering data directly into a program

c)

They increase the size of the program

d)

They make the program look better

52.

What is one benefit of using variables in your program?

a)

Your program can only be used once

b)

Your program can be used for multiple purposes

c)

Your program will use more memory

d)

Your program will be harder to understand

53.

Which of the following best describes a variable in programming?

a)

A fixed value that never changes

b)

A way to store and represent different types of data

c)

A type of computer hardware

d)

A programming error

54.

Imagine you are writing a program that needs to store a user's name and age. What should you use to store this information?

a)

Only print statements

b)

Only comments

c)

Variables

d)

Loops

55.

What does "user input" mean in computing?

a)

Information provided by the user to the computer

b)

Information displayed by the computer to the user

c)

The process of saving files on a computer

d)

The way a computer prints documents

56.

Which of the following is a keyword related to user input in Python?

a)

input

b)

delete

c)

copy

d)

close

57.

What is the purpose of a variable in Python?

a)

To store data that can be used later in the program

b)

To delete files from the computer

c)

To print documents

d)

To restart the computer

58.

Which of the following best describes the "output" in a computer program?

a)

The information shown to the user by the computer

b)

The information typed by the user

c)

The process of turning off the computer

d)

The way a computer connects to the internet

59.

If you want to combine the use of outputs and variables in a Python program, what should you do?

a)

Store user input in a variable and then display it using output

b)

Only use variables without any output

c)

Only use output statements without variables

d)

Ignore both variables and outputs

60.

What is user input in a computer program?

a)

When the program displays information to the user

b)

When the user of the program enters data to be used by the program

c)

When the program saves data to a file

d)

When the program runs without any user interaction

61.

Which of the following is an example of user input in a program?

a)

The program printing "Hello, World!"

b)

The user typing "Year 7" in response to "What year are you in?"

c)

The program saving a file automatically

d)

The computer turning on

62.

Why is user input important in computer programs? (Choose the best answer)

a)

It allows the program to display graphics

b)

It lets the user enter data that the program can use

c)

It makes the program run faster

d)

It helps the computer use less memory

63.

Imagine you are writing a Python program that asks the user for their name and then prints a greeting. Which of the following steps would you need to include?

a)

Only print a greeting

b)

Only ask for the user's name

c)

Ask for the user's name and then use it to print a greeting

d)

Do nothing

64.

What does the following line of Python code do? sides = input("How many sides do you want your shape to have?")

a)

It prints the number of sides of a shape

b)

It creates a prompt asking the user for the number of sides and stores the answer in a variable

c)

It draws a shape with the given number of sides

d)

It calculates the area of a shape

65.

What is the purpose of the variable "sides" in the code example?

a)

To store the user's answer about the number of sides

b)

To display the shape on the screen

c)

To calculate the perimeter of the shape

d)

To print a message to the user

66.

After the user enters their answer, what does the program do next?

a)

It ends the program

b)

It stores the value in the variable "sides" and continues running

c)

It prints the value to the screen and stops

d)

It ignores the user's input

67.

Why is it important to use variables like "sides" when writing a program that takes user input?

a)

Variables help store and use the user's input later in the program

b)

Variables make the program run faster

c)

Variables are only used for decoration

d)

Variables are not needed in any program

68.

Suppose you want to ask the user for the color of their shape instead of the number of sides. Which line of code would you use?

a)

color = input("What color do you want your shape to be?")

b)

print("What color do you want your shape to be?")

c)

color = "blue"

d)

input = color("What color do you want your shape to be?")

69.

What is the purpose of the "input" function in the provided Python code?

a)

To ask the user for information

b)

To display a message on the screen

c)

To perform a calculation

d)

To import a module

70.

Which Python module is imported at the beginning of the code?

a)

turtle

b)

math

c)

random

d)

os

71.

What does the line "turtle.right(360/sides)" do in the code?

a)

Turns the turtle by an angle so that a regular polygon is drawn

b)

Moves the turtle forward by 360 units

c)

Turns the turtle left by 360 degrees

d)

Ends the drawing

72.

If a user enters "4" when asked "How many sides do you want your shape to have?", what shape will the turtle draw?

a)

A square

b)

A triangle

c)

A pentagon

d)

A circle

73.

Why is the value 360 divided by the number of sides in the code?

a)

To calculate the angle needed to turn and complete a regular polygon

b)

To find the length of each side

c)

To determine the number of times the loop runs

d)

To set the speed of the turtle

74.

How does the code use a variable to store user input?

a)

It assigns the user's answer to the variable "sides"

b)

It prints the user's answer

c)

It ignores the user's answer

d)

It uses the variable "turtle"

75.

What would happen if you changed "turtle.forward(50)" to "turtle.forward(100)" in the code?

a)

The sides of the shape would be longer

b)

The shape would have more sides

c)

The turtle would turn faster

d)

The code would not run

76.

Which of the following keywords is NOT mentioned as a keyword at the bottom of the page?

a)

loop

b)

input

c)

output

d)

variable

77.

What does the error message "TypeError: 'str' object cannot be interpreted as an integer" mean in Python?

a)

You are trying to use a string where an integer is expected.

b)

You are trying to use an integer where a string is expected.

c)

You are trying to use a float where a string is expected.

d)

You are trying to use a boolean where an integer is expected.

78.

Which of the following is a way to fix the error "TypeError: 'str' object cannot be interpreted as an integer" in Python?

a)

Convert the string to an integer using int().

b)

Convert the integer to a string using str().

c)

Use a float instead of a string.

d)

Ignore the error and run the code again.

79.

What is a variable used for in Python programming?

a)

To store data that can be used later in the program.

b)

To display images on the screen.

c)

To create sound effects.

d)

To change the color of the text.

80.

Which of the following keywords is NOT related to the topic discussed in the material?

a)

Python

b)

variable

c)

syntax

d)

biology

81.

How can you combine the use of outputs and variables in a Python program for a given scenario?

a)

By storing user input in a variable and then printing it as output.

b)

By only using print statements without variables.

c)

By only using variables without any output.

d)

By ignoring user input and output.

82.

What does "str" mean in Python?

a)

String

b)

Structure

c)

Storage

d)

Start

83.

Which of the following is an example of an integer?

a)

3.5

b)

"hello"

c)

0

d)

True

84.

Why is it important to use an integer when asking for the number of sides in a shape?

a)

Because integers are always positive

b)

Because the number of sides must be a whole number

c)

Because strings cannot be used in Python

d)

Because decimals are easier to use

85.

Which of the following is NOT an integer?

a)

-50

b)

1

c)

0

d)

2.5

86.

If you want to store the number of sides of a shape in a variable, which data type should you use?

a)

String

b)

Integer

c)

Boolean

d)

List

87.

What is the purpose of adding "int(" before the input function in Python?

a)

To make sure the user input is an integer.

b)

To print the user input.

c)

To store the user input as a string.

d)

To display an error message.

88.

Which of the following lines of code will store the user's input as an integer in Python?

a)

sides = int(input("How many sides do you want your shape to have?"))

b)

sides = input("How many sides do you want your shape to have?")

c)

sides = str(input("How many sides do you want your shape to have?"))

d)

sides = print(input("How many sides do you want your shape to have?"))

89.

Why is it important to use int() when asking for a number input in Python?

a)

It ensures the input is treated as a number for calculations.

b)

It makes the code run faster.

c)

It changes the color of the text.

d)

It saves the input to a file.

90.

If you use input() without int(), what type of data will be stored in the variable?

a)

String

b)

Integer

c)

Boolean

d)

Float

91.

Suppose you want to ask the user for the number of sides of a shape and use that number in a calculation. Which code should you use and why? (DoK Level 3)

a)

sides = int(input("How many sides do you want your shape to have?")) because it converts the input to an integer.

b)

sides = input("How many sides do you want your shape to have?") because it is easier to write.

c)

sides = str(input("How many sides do you want your shape to have?")) because calculations need strings.

d)

sides = print(input("How many sides do you want your shape to have?")) because print stores the value.

92.

What is the main goal of the Bronze level in this lesson?

a)

Be able to write python code that will be output to the user

b)

Understand what a variable is and use it to store data to output to the user

c)

Combine the use of outputs and variables for a given scenario

d)

Correct your code

93.

Which of the following best describes the Silver level objective?

a)

Combine the use of outputs and variables for a given scenario

b)

Understand what a variable is and use it to store data to output to the user

c)

Correct your code

d)

Be able to write python code that will be output to the user

94.

What is the Gold level task for students in this lesson?

a)

Combine the use of outputs and variables for a given scenario

b)

Correct your code

c)

Understand what a variable is and use it to store data to output to the user

d)

Be able to write python code that will be output to the user

95.

Which of the following keywords is NOT listed as important for this lesson?

a)

loop

b)

input

c)

output

d)

variable

96.

If you are feeling confident, what are you encouraged to do in Lesson 3 Activity 3?

a)

Try the challenge

b)

Skip the activity

c)

Ask for help

d)

Review the previous lesson

97.

What is the main purpose of a variable in Python programming?

a)

To store data that can be used and changed in a program

b)

To display images on the screen

c)

To connect to the internet

d)

To print documents

98.

Which of the following is an example of output in Python?

a)

print("Hello, World!")

b)

input("Enter your name: ")

c)

variable = 5

d)

def function():

99.

What should you do at the end of a lesson according to the workbook plenary?

a)

Write down what went well and what could be improved

b)

Leave the classroom immediately

c)

Start a new lesson

d)

Ignore the lesson summary

100.

If you have combined the use of outputs and variables for a given scenario, which medal have you achieved according to the lesson objectives?

a)

Gold

b)

Silver

c)

Bronze

d)

Platinum