Skip to content
Marlbridge

Flashcards · 9626 · AS Topic 4

Algorithms and flowcharts (AS Level) flashcards

9 cards on AS Topic 4. Pick a subtopic or study them all.

Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.

All 9 cards

For a quick read-through or printing. Cover the right-hand side to test yourself.

Topic 4: Algorithms and flowcharts

What is a rogue value?
A value that marks the end of the data, such as -1 or 0, and is not processed.
WHILE ... ENDWHILE vs REPEAT ... UNTIL
WHILE tests at the start and continues while the condition is true, so it may run 0 times. REPEAT tests at the end and continues until the condition is true, so it always runs at least once.
Which loop would you use to re-ask for a PIN until it is valid, and why?
REPEAT ... UNTIL, because the PIN must be asked for at least once and the test comes after the input.
What values does FOR K ← 2 TO 20 STEP 6 produce?
2, 8, 14 and 20: four passes.
IF vs CASE
IF tests any condition. CASE matches the value of one variable against a list of values, with OTHERWISE catching anything not listed.
What is a nested loop? How many times does the inner body run for an outer loop of 5 and inner of 3?
A loop inside another loop; the inner loop runs fully on every pass of the outer one. 5 × 3 = 15 times.
Which flowchart symbols are used for a subroutine and a connector?
Subroutine: a rectangle with double vertical lines at the sides, holding the procedure's name. Connector: a small circle with a letter, linking two parts of a chart.
How do you process data ending in a rogue value with a WHILE loop?
INPUT the first value before the loop; loop WHILE the value is not the rogue value; process it, then INPUT the next value as the last line of the loop body.
What is a trace table?
A table that records the value of each variable after each step, used to test an algorithm.