wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python All

Total questions: 53

Worksheet time: 37mins

Name
Class
Date
1.
a line of text that Python won't try to run as code
a)
comment
b)
modulo
c)
variable
d)
boolean
2.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
3.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
4.
Used to make comments
a)
#
b)
%
c)
**
d)
()
5.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
6.

Which of the following defined variables is a string?

a)

cool_variable_1

b)

cool_variable_2

c)

cool_variable_3

d)

cool_variable_4

7.

Which function outputs text to the terminal?

a)

print()

b)

write()

c)

type()

d)

output()

8.

Which of the following will produce a SyntaxError?

a)
b)
c)
9.

What is the output of the following code?

a)

210

b)

42

c)

cool_number

10.

What happens when you call report?

a)

Two Strings are printed: "The current time is " and "The mood is "

b)

One String is printed: "The current time is 3pm"

c)

Two Strings are printed: "The current time is 3pm" and "The mood is good"

d)

Three Strings are printed: "The current time is 3pm", "The mood is good", and "End of report"

11.

How do you call a function called setup with no arguments?

a)

setup()

b)

setup(None)

c)

def setup():

d)

setup

12.

How do you call update with a new_value of 20?

a)

def update(20)

b)

update(20)

c)

update

d)

update()

13.

Which of the following variables contains a Boolean value?

a)
b)
c)
d)
14.

Determine the truth value of the following expressions:

a)

A: False

B: True

b)

A: False

B: False

c)

A: True

B: True

d)

A: True

B: False

15.

Guess the output:

i = 4

while i < 9:

print(i)

i = i+2

a)

5, 7, 9

b)

4, 6, 8

c)

4, 7, 9

d)

Error

16.

Improper tab placement will prevent a block of code from running properly.

a)

True

b)

False

17.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
18.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
19.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
20.

Improper tab placement will prevent a block of code from running properly.

a)

True

b)

False

21.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
22.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
23.

What is a input?

a)

A function that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

24.

What is a output?

a)

A piece of data that is shown on the screen.

b)

Data that the user enters

c)

An output

d)

A orange

25.

What syntax would you use to create a name variable?

a)

name=input()

b)

input=name

c)

name=input{}

d)

name=INPUT

26.

What is the proper syntax for Python comments?

a)

<!-- Python comment -->

b)

<comment> Python comment <comment>

c)

# Python Comment

d)

/* Python Comment */

27.

If Python were to get into a fight with JavaScript, who would win?

a)

Python

b)

JavaScript

28.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
29.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
30.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
31.
Python is an example of a....
a)
Text-based programming language
b)

A foreign language

c)
language written in java script
d)
Visual-based programming language
32.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
33.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

34.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
35.

Which of these is true?

a)

A syntax error will stop a program running

b)

A logic error will stop a program running

c)

A syntax error will let the program run but may have unexpected outcomes

d)

The program will always show an error message for a logic error

36.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
37.

Which of these is true?

a)

A syntax error will stop a program running

b)

A logic error will stop a program running

c)

A syntax error will let the program run but may have unexpected outcomes

d)

The program will always show an error message for a logic error

38.

age = input()

Fill in the blank to correctly output the sentence:

print("You are " + ________ + " years old")

a)

age

b)

str(age)

c)

int(age)

d)

"age"

39.

What is the syntax error?

a)

No parentheses around age <=18

b)

else should say elif

c)

else is missing a colon :

d)

else should be indented

40.

What symbol is used to join strings together?

a)

%

b)

+

c)

*

41.

What function do you use to to find the length of the string?

a)

len()

b)

float()

c)

.upper()

d)

.lower()

42.

What is a Count-Controlled loop?

a)

for loop

b)

while loop

43.

How many lines will this code print?

x = 10

while x > 0:

print(x)

x = x - 3

a)

5

b)

2

c)

3

d)

4

44.

integers are...

a)

algebra

b)

your age

c)

whole numbers including negatives

d)

imaginary

45.

in Python the subtraction sign is...

a)

-

b)

:

c)

/

d)

>

46.

In Python the multiplication sign is...

a)

*

b)

%

c)

.

d)

'

47.

Syntax is...

a)

an error

b)

a coding language that explains Python what to do

c)

rules we follow in building sentences

d)

ways to express yourself

48.

How do you define(assign) variables?

a)

var="String"

b)

func==Hello

c)

var : 123

d)

word= Hello

49.

Division by zero is an example of what type of error?

a)

Syntax Error

b)

Run-time Error

c)

Semantic Error

50.

Improper indentation is an example of what type of error?

a)

Syntax Error

b)

Run-time Error

c)

Semantic Error

51.

The following is an example of what type of error?


print("Here is some text")

print(1/0)

a)

Syntax Error

b)

Run-time Error

c)

Semantic Error

52.

What does print("hello) display?

a)

hello

b)

gives you an error

c)

"hello"

d)

"hello

53.

A string does not have to be enclosed with quotation marks.

a)

True

b)

False