Structure of Procedural Programs Flashcards

1
Q

State and describe the three main consturucts of procedural programming.

A

Itteration - Repeating the execution of code multiple times.

Selection- Only executing code based if certain conditions are true.

Sequence- executing instruction in order.

By - Liam Bradshaw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define recursion.

A

Recursion is when a fuction will call itself with updated parameters until the fuctions job is done.

By - Liam Bradshaw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

State the most common error that newer programers encounter when using recursion.

A

The mistake that many encounter is to not update the paramters (correctly) causing an infinte loop to occur where it will call itself over and over.

By - Liam Bradshaw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe what a while loop and a repeat until loop is?

A

While loop - A while loop is a form of iteration in which the code iterates while a certain condition is being met e.g. while x<5.

Repeat Until loop - A repeat until loop is a form of iteration in which the computer iterates the code until a condition is met e.g. Repeat until x=5.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

State 1 difference between a While loop and a Repeat Until loop.

A

When using a While loop the condition is evaluated first, and if the condition is true, the code within the block is executed, whereas when using a repeat until loop the code is executed first and then the condition is evaluated, if the condition is true the code is executed again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly