Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Algorithms

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.

What is an algorithm?

a)

A set of steps to accomplish something.

b)

A set of variables.

c)

A set of known data.

d)

A set of anti virus code.

2.

What is Pseudocode?

a)

Sketch out the logical steps of a process before using a programming language.

b)

Python sublanguage.

c)

C++ sublanguage.

d)

Sketch out the logical steps of a process before compiling a code.

3.

Get egg carton from the fridge.

______________

Break egg into bowl.

Get flour bag from pantry.

Take flour out of bag.

Pour flour into bowl.

What is missing from this pseudocode?

a)

Take egg out of carton.

b)

Put egg in flour bag.

c)

Put flour back in pantry.

d)

Put egg carton back in fridge.

4.

Describes a test condition.

List some instructions that should run if the test succeeds.

a)

conditional instructions

b)

unconditional instructions

c)

variable instructions

d)

input instructions

5.

Which is a conditional instruction?

a)

if it is dark outside:

turn on the lights

b)

x= x - 1

c)

x= x + 1

d)

input("What is your favorite color")

6.

A “while” instruction continues running until its test ______.

a)

fails

b)

repeats

c)

Decrements to zero.

d)

Increments by the value of i.

7.

Removing which statement will make this an infinite loop?

a)

set countdown to countdown - 1

b)

print a black and white page

c)

while countdown > 0:

d)

set countdown to 3

8.

If there are 4 people in the room, how many times does line 3 execute?

Let N=0

For each pair of people in the room

Set N= N+2

a)

0

b)

1

c)

2

d)

4

9.

If there are 13 people in the room, how many times does line 5 execute?

Let N=0

For each pair of people in the room

Set N= N+2

If 1 person remains then

Set N= N+1

a)

0

b)

1

c)

13

d)

6

10.

If there are 50 people in the room, which line never executes? Why?

Let N=0

For each pair of people in the room

Set N= N+2

If 1 person remains then

Set N= N+1

4 lines