0% found this document useful (0 votes)
4 views4 pages

Control Structures in Software Engineering

The document outlines basic control structures used in algorithm development, including sequence, selection, and repetition. It details various forms of selection such as binary, multi-way, and nested IF statements, as well as repetition structures like pre-test and post-test loops. Additionally, it covers FOR/NEXT loops as a specific type of repetition, emphasizing the importance of these structures in designing algorithms and writing code.

Uploaded by

aisha.sinead
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Control Structures in Software Engineering

The document outlines basic control structures used in algorithm development, including sequence, selection, and repetition. It details various forms of selection such as binary, multi-way, and nested IF statements, as well as repetition structures like pre-test and post-test loops. Additionally, it covers FOR/NEXT loops as a specific type of repetition, emphasizing the importance of these structures in designing algorithms and writing code.

Uploaded by

aisha.sinead
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Control Structures

Algorithms are developed using the basic control structures of sequence, selection and repetition. Students are
expected to design algorithms and write code incorporating combinations of these control structures.

Sequence
Sequence refers to steps which are to be executed one after the other. The steps are executed in the same
order in which they are written.

Pseudocode Flowchart
process 1

process 2

process n

Selection
Binary selection
In binary selection, if the condition is met then one path is taken, otherwise the second possible path is
followed.
Pseudocode Flowchart
1. IF condition THEN

process 1

ENDIF

2. IF condition THEN

process 2

ELSE

process 1

ENDIF

Note: Arrows coming from a decision symbol should be labelled to remove ambiguity.
Higher School Certificate Course Specifications – Software Engineering, updated November 2024 Page 15 of 32
Multi-way selection
In multi-way selection there can be a number of possible choices, or cases. The path taken is determined by
the evaluation of the expression. Once a relevant path has been determined and executed, execution of this
expression ceases. Only one process is executed as a result of the implementation of the multi-way selection.

Multi-way selection is often referred to as a case structure.

Pseudocode Flowchart
CASEWHERE expression evaluates to

choice a: process a

choice b: process b

OTHERWISE: default process

END CASE

Nested IF

A nested IF allows the testing of multiple conditions with only one process executed.

Pseudocode Flowchart
IF condition A THEN

process 1

ELSEIF condition B THEN

process 2

ELSEIF condition C THEN

process 3

ELSE

process 4

ENDIF

Higher School Certificate Course Specifications – Software Engineering, updated November 2024 Page 16 of 32
Repetition
Pre-test
The pre-test loop tests the condition at the start of the loop to determine whether the body of the loop is
executed. The body of the loop is executed repeatedly while the termination condition is true.

Pseudocode Flowchart
WHILE condition is true

process

ENDWHILE

Post-test

A post-test loop executes the body of the loop before testing the termination condition. The body of the loop is
repeatedly executed until the termination condition is true.

Pseudocode Flowchart
REPEAT

process

UNTIL condition is true

Higher School Certificate Course Specifications – Software Engineering, updated November 2024 Page 17 of 32
FOR / NEXT
FOR / NEXT loops (also known as counted loops) can be regarded as special cases of repetition and,
depending on the language, are implemented as either pre-test or post-test repetitions.

Pseudocode Flowchart
FOR variable = start TO finish STEP increment

statements

NEXT variable

Note: Increment can take either a positive or negative value. The flowchart shows the logic for a positive increment

Higher School Certificate Course Specifications – Software Engineering, updated November 2024 Page 18 of 32

You might also like