Selection, Iteration & Nesting Flashcards

All 7 cards in this deck

What is nested iteration?

e.g. a loop of 4 stars inside a loop of 3 rows

A loop placed inside another loop; the inner loop runs fully on every pass of the outer loop (here, 12 stars).

Name the three basic programming constructs.

Sequence, selection (choice) and iteration (repetition).

Which construct do the pseudo-code keywords IF, ELSE IF and ELSE belong to?

Selection.

Which construct do the pseudo-code keywords FOR, WHILE and REPEAT … UNTIL belong to?

Iteration.

How is a selection with more than two outcomes written in AQA pseudo-code?

e.g. grade A if score is 80+, B if 60+, otherwise C

  1. Test the first condition: IF score ≥ 80 THEN OUTPUT 'A'
  2. Add further tests: ELSE IF score ≥ 60 THEN OUTPUT 'B'
  3. Catch the rest and close: ELSE OUTPUT 'C' then ENDIF

What is nested selection?

An IF statement written inside the IF branch or the ELSE branch of another IF statement, so the inner check is only reached when the outer one gives that result, e.g. only checking the password once the username is correct.

In programming, what is sequence?

Carrying out statements one after another, in the order they are written, e.g. input a value, then calculate with it, then output the result.