Computer Science GCES AQA
-
Representing Algorithms Aqa4 主题
-
Efficiency Of Algorithms Aqa1 主题
-
Searching Algorithms Aqa3 主题
-
Sorting Algorithms Aqa3 主题
-
Data Types Aqa1 主题
-
Programming Concepts Aqa5 主题
-
Arithmetic Relational And Boolean Operations Aqa1 主题
-
Data Structures Aqa3 主题
-
String Manipulation Aqa1 主题
-
Random Number Generation Aqa1 主题
-
Structured Programming Aqa2 主题
-
Robust And Secure Programming Aqa4 主题
-
Number Bases Aqa2 主题
-
Converting Between Number Bases Aqa3 主题
-
Units Of Information Aqa9 主题
-
Hardware And Software Aqa4 主题
-
Boolean Logic Aqa3 主题
-
Programming Languages And Translators Aqa2 主题
-
Cpu Architecture Performance And Embedded Systems Aqa4 主题
-
Memory Aqa2 主题
-
Secondary Storage Aqa3 主题
-
Fundamentals Of Computer Networks Aqa8 主题
-
Fundamentals Of Cyber Security Aqa1 主题
-
Methods Of Preventing Cyber Security Threats Aqa1 主题
-
Relational Databases Aqa2 主题
-
Ethical Legal And Environmental Impacts Aqa2 主题
Iteration Aqa
Exam code:8525
Iteration
What is iteration?
-
Iteration is repeating a line or a block of code using a loop
-
Iteration can be:
-
Definite (count controlled) – this is when the code is repeated a fixed number of times (e.g. using a for loop)
-

-
Indefinite (condition controlled) – this is when the code is repeated until a condition is met (e.g. using a while loop or a do while loop)

Examples
|
Iteration |
Pseudocode |
Python |
|
FOR loop (Definite Iteration) |
|
|
|
This will print the word “Hello” 10 times (0-9 inclusive) |
||
|
|
|
|
|
This will print the even numbers from 2 to 10 inclusive |
||
|
|
|
|
|
This will print the numbers from 10 to 0 inclusive |
||
|
WHILE loop (Indefinite Iteration) |
|
|
|
|
This will loop until the user inputs the colour “Red”. Check condition is carried out before entering loop |
|
|
DO WHILE loop (Indefinite Iteration) |
|
|
|
|
This will loop until the user inputs the colour “Red”. Loop iterates once before a check is carried out |
|
How to identify programming constructs
-
You can identify which programming constructs are used by looking at certain keywords
-
The keywords if, elseif, else, endif indicate that the construct is selection
-
The keywords for, while, do indicate that the construct is iteration
-
If none of these keywords are used, this is a good indication that the construct is sequence
Worked Example
Tick (✓) one box in each row to identify whether each programming construct has or has not been used in the program [3]
total ← 0
for i ← 1 to 5
num ← USERINPUT
total ← total + num
next i
print(total)

How to answer this question
-
Always look for keywords first, if you find any then that construct must have been used
-
Sequence must always be used if the program works
Answer

Nested Iteration
What is nested iteration?
-
Nested means to be ‘stored inside the other‘
-
An example of nested iteration is one loop inside of another loop
-
It is worth noting that selection can be nested as well
Examples of nested programming


Responses