Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Psuedocode iterations

Total questions: 45

Worksheet time: 19mins

Name
Class
Date
1.

Which type of iteration should be used when you know how many times you want to loop?

a)

Count Controlled

b)

Condition Controlled

2.

Which type of iteration should you use if you don't know how many times you need to loop?

a)

Condition Controlled

b)

Count Controlled

3.

What is missing?


____ i <-- 1 To 10

OUTPUT "String"

ENDFOR

a)

FOR

b)

FOUR

c)

WHILE

4.

Fill in the missing blank:


_______ variable <> "Hi"

OUTPUT "Hi to you!"

ENDWHILE

a)

WHILST

b)

WHILE

c)

FOR

d)

IF

5.

Pick the correct answer to match the following:


A loop that will check the condition before the code inside is executed.

a)

FOR

b)

WHILE

c)

REPEAT...UNTIL

6.

Pick the correct answer to match the following:


A loop that will check the condition after the code inside is executed.

a)

WHILE

b)

REPEAT...UNTIL

c)

FOR

7.

Which of the following will run 10 times? (Choose all that apply.)

a)

FOR i = 1 TO 10

OUTPUT: "Number " + i

ENDFOR

b)

FOR i = 0 To 10

OUTPUT: "Number: " + i

ENDFOR

c)

input = 10

count = 1

WHILE count <= input

OUTPUT: count

count = count + 1

ENDWHILE

8.

Complete the blank:


" (a)   is the process of repeating an action multiple times."

9.

Which of these is the correct syntax in pseudocode? (Choose all that apply.)

a)

FOR i <-- 1 TO 10

b)

WHILE i != 10

c)

FOR i <-- 1 <- 10

d)

WHILE i <> 10

10.

How many times will the following loop run?


myString <-- "A word"


FOR i <-- 1 TO LENGTH(myString)

OUTPUT "Do something"

NEXT i

a)

6

b)

5

c)

10

11.

Post-condition loops _______

a)

always have at least one iteration

b)

NO iterations

c)

Multiple

d)

None

12.

What is used to assign values in pseudocode?

a)

:

b)

=

c)

==

d)

<--

13.

Pre-condition loops may have ______

a)

no iterations

b)

always has at least one iteration

c)

may have multiple iterations

d)

None

14.

The number of iterations (print the value of M) is ...................

a)

2

b)

3

c)

4

d)

5

15.

This symbol refers to .......................... in flowcharts

a)

Input/output

b)

Process

c)

Decision

d)

Terminal

16.

The Procedures term refers to: ..........................

a)

properties that describe the object.

b)

Events that can occur to the object.

c)

Commands and instructions that are carried out.

17.

This flowchart used in solving the speed of movement body by measuring the distance “D” and Time “T”.

(1) The condition which is used in preventing user from input number zero as a denominator of the speed law is ...........................

a)

T=0

b)

T>0

c)

T<D

d)

D=0

18.

This flowchart used in solving the speed of movement body by measuring the distance “D” and Time “T”.

(2) ……………………………………….. is the process that calculate a speed of movement body.

a)

T/D

b)

D*T

c)

D/T

d)

D<0

19.

This flowchart used in solving the speed of movement body by measuring the distance “D” and Time “T”.

(3) Which shape is used to define the output of the program ………………………………………………. .

a)

b)

c)

d)

D<0

20.

When a piece of code runs unintentionally forever it is known as

a)

An infinite loop

b)

A long loop

c)

A broken loop

d)

A for loop

21.

A condition is

a)

a statement that is either True or False

b)

a string

c)

an integer

d)

a list

22.

What does the code output?

a)

0

1

2

3

b)

1

2

3

c)

0

1

2

23.

What does the code output?

a)

hi

b)

It won't output anything

c)

It will output an error!

d)

It will output "hi" infinitely

24.

What does the code output?

a)

hi

bye

b)

hi

bye

hi

bye

hi

bye

c)

hi

hi

hi

bye

25.

What does the code output?

a)

3

b)

6

c)

7

d)

4

26.

What does the code output?

a)

hi

hi

b)

hi

c)

hi

hi

hi

d)

hi

hi

hi

hi

27.

What does the code output?

a)

3

4

5

b)

1

2

3

c)

3

4

5

6

d)

3

4

4

28.

What is the value of i after this loop runs?

a)

i = 20

b)

i = 19

c)

i = 10

d)

i = 0

29.

What does this program output?

a)

x is 0

b)

x is 1

c)

x is 3

d)

x is 4

30.

A post condition loop will use the following

a)

REPEAT ... UNTIL

b)

FOR ... NEXT i

c)

WHILE ... ENDWHILE

31.

A pre condition loop use the following

a)

REPEAT ... UNTIL

b)

FOR ... NEXT i

c)

WHILE ... ENDWHILE

32.

A count controlled loop use the following

a)

REPEAT ... UNTIL

b)

FOR ... NEXT i

c)

WHILE ... ENDWHILE

33.

What is a Count-Controlled loop?

a)

for loop

b)

while loop

34.

A count controlled loop will..

a)

Repeat code until a condition is met

b)

Repeat code a specific amount of times

c)

Repeat code a random amount of times

d)

None of the above

35.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

36.

What sort of loop is this?

a)

Count Controlled

b)

Condition Controlled

37.

What will this code print?

a)

Print the word 'letter'.

b)

Print a user input on one line.

c)

Print a user input one letter at a time.

d)

Print an Error.

38.

Which of these is NOT a loop in python?

a)

for loop

b)

while loop

c)

nested loop

d)

if loop

39.

Which of these operators in Python means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

40.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

41.

What does the '#' allow you to do in Python?

a)

Repeat code

b)

Comment on code

c)

Print code

d)

End code

42.

Which of these will allow me to count from 0-20 in steps of 5?

a)

for x in range(0,20):

print(x)

b)

while x = (0,20,5):

print(x)

c)

for x in range(0,21,5):

print(x)

d)

for x in range(0,21,5):

print(y)

43.

If i want to continuously check for a correct answer, what loop would i use?

a)

for loop

b)

while loop

44.

What is the error in this code?

a)

incorrect variable name

b)

incorrect indentation

c)

incorrect speech marks

d)

incorrect loop

45.

A condition controlled loop is...

a)

A while loop

b)

A for loop