wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python - Chpt 3 - Review

Total questions: 15

Worksheet time: 9mins

Name
Class
Date
1.

A variable that can only have two values, True or False is called a _____.

a)

Boolean

b)

elif

c)

if

d)

else

2.

Which is the correct syntax for keying a Boolean?

a)

has_dog = true

b)

has_dog = "true"

c)

has_dog = True

d)

has_dog = TRUE

3.

This operator means that one value is the same as the other value.

a)

==

b)

!=

c)

>

d)

<

4.

What is the result of this program: (Use attached image)

a)

A: True B: True

b)

A: True B: False

c)

A: False B: False

d)

A: False B: True

5.

What will be the output? (Use the attached image).

a)

A: True B: True

b)

A: True B: False

c)

A: False B: False

d)

A: False B: True

6.

A syntax error means you have an error with your Python grammar or a symbol/operator is incorrectly used.

a)

True

b)

False

7.

Which symbol do we use to add comments to our code?

a)

@

b)

#

c)

+

d)

&

8.

What best defines an IF statement in Python?

a)

An embedded string with a variable

b)

Checks to see if a statement is true or false and then does one of two things depending on the result.

9.

In Python, the data type for a Boolean will display as ___.

a)

float

b)

int

c)

str

d)

bool

10.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

A decision point in a program

c)

The order in which instructions are carried out

d)

Testing a program to make sure it works

11.

The condition for a while loop to continue could include which of the following?

a)

while something equals something

b)

while something is true

c)

while something is greater than something

d)

All of these

12.

while loops are ___.

a)

loops which run an unknown number of times

b)

the same as if statements

c)

loops which run for a specific number of times

d)

not a part of programming

13.

To include the use of functions which are present in the random library we must use the option ____.

a)

import random

b)

import.random

c)

library random

d)

use random

14.

The output of the following code is either 1 or 2.

a)

True

b)

False

c)

Error

15.

Contains functions related to generating random numbers and producing random results.

a)

system module

b)

random module

c)

math module

d)

none of these