wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 3 Test review

Total questions: 11

Worksheet time: 8mins

Name
Class
Date
1.

When do you use an else statement?

a)

When you need to increment a counter.

b)

When you need to convert integers to strings.

c)

When two conditions are mutually exclusive.

d)

When you need to decide if something is false.

2.

Write the code to test if total1 and total2 are the same.

a)

if (total1 = total2)

b)

if (total1 < total2)

c)

if (total1 == total2)

d)

if (total1 != total2)

3.

Select all the lines that have mistakes in the code:

a)

Line 1

b)

Line 2

c)

Line 5

d)

Line 8

e)

Line 11

4.

Which of the following is true about algorithms?

a)

steps for algorithms can be in any order

b)

algorithms must have clear instructions

c)

the code for algorithms can run infinitely

d)

algorithmic code can do only number calculations

5.

Which if the following is equivalent to the code above?

a)

if (count > 25) and (count < 50):

b)

if not(count > 25):

. if not(count < 50):

c)

if (count > 25) or (count < 50):

d)

all of these

e)

none of these

6.

Which operator should you use to check if a is greater than b?

(a)  

7.

What is the output?

a)

too hot

b)

too cold

c)

just right

d)

nothing

e)

syntax error

8.

(Extra Credit) Suppose isPrime is a boolean variable, which of the following is the CORRECT AND BEST statement for testing if isPrime is true.

a)

if isPrime = True:

b)

if isPrime == True:

c)

if isPrime:

d)

if not isPrime = False:

e)

if not isPrime == False:

9.

What is printed?

a)

1

b)

2

c)

3

d)

4

10.

What is printed?

a)

1

b)

2

c)

3

d)

4

11.

Which of the following evaluate to 2? (There may be more than one)

a)

12 % 9

b)

int(2.8)

c)

float('2.3')

d)

int('2.0')