Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Code 3- PLTW AC

Total questions: 25

Worksheet time: 20mins

Name
Class
Date
1.

Match the definition with the word.

2.
A variable that can only have two values, True or False.
a)
Boolean
b)
If
c)
elif
d)
else
3.
Which is the correct syntax?
a)
has_dog = true
b)
has_dog = True
c)
has_dog = Treu
d)
HAS_DOG = tRue
4.
An if statement must evaluate to:
a)
Right or Wrong
b)
True
c)
True or False
d)
False
5.
This operator means that one value is the same as the other value
a)
==
b)
!=
c)

>=

d)

<=

6.

This operator means that one value is the greater than or equal to the other value.

a)
==
b)
!=
c)

>=

d)

<=

7.

This operator means that one value is the less than or equal to the other value.

a)
==
b)
!=
c)

>=

d)

<=

8.
This operator means that one value is not equal to another value
a)
==
b)
<=
c)
>=
d)
!=
9.

Boolean data is either ​ (a)   if it is correct or ​ (b)   if it is incorrect. The first letter ​ (c)   be capitalized.

Choose from the below words
True
False
must
true
can be
false
10.

Boolean values are ​ (a)   strings. 

That is, they are ​not enclosed by ​ (b)   marks.

Choose from the below words
not
quotation
always
paranthesis
11.

A while loop can be used in which of the following situations?

a)

Repeat a set of statements till a condition remains True.

b)

Repeat a set of statements a finite or an infinite number of times.

c)

Iterate through a string, list, and tuple.

d)

All of the above

12.

What will be the output?

name = "Sailor"

print (name)

a)

name

b)

Dave

c)

sailor

d)

Sailor

13.

A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly

a)

True

b)

False

14.

Which statement correctly assigns the string "Tanner" to the variable name?

a)

name  = print( "Tanner")

b)

input("Tanner")

c)

name= "Tanner"

d)

name = input("Tanner")

15.

Which statement correctly assigns the string "Kimbrough" to the variable name?

a)

name  = print( "Kimbrough")

b)

input("Kimbrough")

c)

name= "Kimbrough"

d)

name = input("Kimbrough")

16.

What is the output from the following code?

print ("hello world")

a)

hello world

b)

Hello world!

c)

Hello World

d)

"HELLO WORLD"

17.

What will be the output?

name = "Dave"

print ("name")

a)

Dave

b)

name

c)

"name"

d)

"Dave"

18.

Loop that runs as long as the condition is true

a)

list

b)

while

c)

for

d)

if

19.

In Python, the two types of loops are _____ and _______

a)

while

b)

for

c)

list

d)

if

e)

loop

20.

What symbol do you use to make a comment in Python?

a)

+

b)

//

c)

$

d)

#

21.

Label the parts of the code.

22.

Write a loop that collects all of the coins.

a)

move down

move right

move down

move right

b)

while true loop

move down

move right

c)

while there are coins

move down

move right

d)

move down(2)

move right(2)

23.

What is a control structure?

a)

boolean control structure

b)

object in a method call statement

c)

makes the ball hop up and down stairs

d)

coding that allow you to specify the flow of execution in your code

24.

Which psudocode is not a loop?

a)

while knowing is less than grade 12

keep learning

then graduate

b)

while vegetables are present

keep eating

then burp

c)

while gems are present

find gem

pick up gem

shout yay!

d)

while true

keep breathing

e)

sleep as long as I am tired

25.

Which psudocode is an infinite loop?

a)

while knowing is less than grade 12

keep learning

then graduate

b)

while vegetables are present

keep eating

then burp

c)

while gems are present

find gem

pick up gem

shout yay!

d)

while true

keep breathing

e)

sleep as long as I am tired