# Algorithm specification test questions

### 1

What is the purpose of an input validation algorithm?

### 2

Which of the following is an example of a pre-test conditional loop often used as part of input validation algorithms?

### 3

Which of the following is an example of a post-test conditional loop, sometimes used as part of input validation algorithms?

### 4

The algorithm shown below will keep a running total. Which line shows the start of a fixed loop?

Line 1 DECLARE total INITIALLY 0

Line 2 DECLARE numberlist INITIALLY [3, 45, 17, 21, 26]

Line 3 FOR EACH number FROM numberlist DO

Line 4 SET total TO total + number

Line 5 END FOR EACH

### 5

The algorithm shown below is an example of which of the three algorithms that must be understood at this level?

Line 1 DECLARE total INITIALLY 0

Line 2 FOR loop FROM 0 TO 4 DO

Line 3 RECEIVE number FROM (INTEGER) KEYBOARD

Line 4 SET total TO total + number

Line 5 END FOR

### 6

Which of the following describes ‘traversing an array’