Control Structures Flashcards
1
Q
Name the 5 Control Structures
A
- Sequence
- Binary Selection
- Casewhere
- Pre Test Loop
- Post Test Loop
2
Q
What is Sequence?
A
Sequence is one event after another
3
Q
What is Repetition?
A
There are 2 types of Repetition: - Pre Test Loop
- Post Test Loop
4
Q
What is the Syntax for a Pre-test loop
A
WHILE (Test Condition) is TRUE
DO (Process1)
ENDWHILE
5
Q
What is the Syntax for a Post-test loop
A
(Statement Before Loop)
REPEAT (Process)
UNTIL (Test Condition) is TRUE
(Statement after loop)
6
Q
What is the Pseudocode for Sequence
A
BEGIN
(Process1)
(Process2)
END
7
Q
What is the Pseudocode for Binary Selection
A
IF (Test Condition) = TRUE THEN DO (Process1) ELSE DO (Process2) ENDIF
8
Q
What is the Pseudocode for Casewhere?
A
CASEWHERE (Expression E.g. Cereal, Book, Movie) -Choice1: (Process1) -Choice2: (Process2) -Otherwise: (Default Process) END CASE
9
Q
What is Repetition used for?
A
Used to loop a number of steps until some condition is satisfied