wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Test 3 Review

Total questions: 25

Worksheet time: 26mins

Name
Class
Date
1.

What is an if-then statement used for in a program?

a)

To allow programs to make decisions.

b)

To allow programs to repeat

c)

To allow programs to do nothing

d)

To allow programs to perform a number calculation.

2.

What is the output?

a)

TRUE

b)

FALSE

c)

TRUEFALSE

d)

FALSETRUE

3.

It should be rewritten as:

a)

if (90 < = x <= 100):

b)

if (90 < = x and x <= 100):

c)

Nothing, the if statement is correct

4.

When do you use an else statement?

a)

Else statement has no purpose.

b)

When you need something to happen every time.

c)

When you need something to happen when the if condition is true.

d)

To tell what will happen when an if-statement is false.

5.

Write the code to test if num1 and num2 are NOT the same.

a)

if (num1 != num2 )

b)

if (num1 == num2 )

c)

if (num1 = num2)

d)

if (num1 < num2 )

6.

The symbol != means

a)

Both conditions must be true

b)

One or both conditions must be true.

c)

Equal

d)

Not equal to.

7.

The symbol < means

a)

Less than

b)

Greater than

c)

Equal

d)

Not equal to

8.

The symbol <= means

a)

Less than

b)

Greater than

c)

Less than equal

d)

Not equal to

9.

The symbol == means

a)

Less than

b)

Greater than

c)

Equal

d)

Not equal to

10.

The symbol and means

a)

Both conditions must be true.

b)

One or both conditions must be true.

c)

Equal

d)

Not equal to

11.

The symbol or means

a)

Both conditions must be true.

b)

One or both conditions must be true.

c)

Equal

d)

Not equal to

12.

The symbol not means

a)

Both conditions must be true.

b)

One or both conditions must be true.

c)

Equal

d)

Not equal to

13.

What is the output?

a)

1

b)

2

c)

3

d)

4

14.

What is the output?

a)

1

b)

2

c)

3

d)

4

15.

How would you write the code: "If the variable letter holds h."

a)

if ( letter == "h"):

b)

if ( letter == h):

c)

if ( letter = "h"):

d)

if ( letter != "h"):

16.

How would you write the code: "If value is not less than 13.6"

a)

if (value > 13.6):

b)

if (value <= 13.6):

c)

if (value >= "13.6"):

d)

if (value >= 13.6):

17.

Which of the following is NOT true about algorithms?

a)

have clear instructions

b)

stop in a finite amount of time

c)

do number calculations

d)

have an order

18.

The following code could be rewritten using:

if (x > 12):

if ( x < 34):

a)

not

b)

or

c)

and

d)

none of the others

19.

Which of the following are true about algorithms? (You may select more than one)

a)

must output a string

b)

produce a result

c)

can be done by a computer

d)

can perform logical operations

20.

What are the two reasons we analyze algorithms?

a)

Ease of coding

b)

Predict performance

c)

Make decisions about what algorithm to use

d)

Sorting Data

21.

Select all the mistakes (there may be more than one) in the following:

a)

The = should be ==

b)

elseif should be elif

c)

there is no end if

d)

The else should have a :

22.

When should you use an ELIF statement?

a)

To repeat sections of code

b)

To make a follow-up True/ False decision

c)

To count user actions

d)

To get user input

23.

What best defines an algorithm?

a)

Code that does an action

b)

A set of precise steps used to perform a task, typically on a computer

c)

Steps used to complete a goal

d)

Using IF and ELSE statements in order to gather input and print outputs

24.

For if statements to work in Python you must ____________.

a)

add an else to them

b)

make decisions about them

c)

indent their code block

d)

use them with input commands

25.

Which of the following is used to show not equals?

a)

==

b)

!=

c)

!!

d)

=!