4.1.1.2 Programming concepts Flashcards

1
Q

What is a keyword?

A

A word in a programming language that is already defined and can’t be used as an identifier name, e.g print

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

What is a statement?

A

A single step within the algorithm

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

What is iteration?

A

A section of code executed repeatedly for a given number of times or until a construct is met. It is a basic construct of procedural programming which helps save memory.

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

What is recursion?

A

When a function calls itself until it reaches a stopping condition, dividing the program into smaller problems.

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

Advantages of using iteration instead of recursion

A

Uses only one set of variables, so it uses less space and is more efficient

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

Disadvantages of using iteration over recursion

A

The algorithm is more difficult to follow due to reusing the same variables. You have to ensure the conditions of the loop are right.

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

What is selection?

A

A condition that determines whether a section of code will be executed, a basic construct of procedural programming languages

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

What is nesting?

A

When a construct is written and completely contained within another construct, e.g a nested loop.

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

What is an identifier, why are they used?

A

A symbolic name given to a subroutine / variable which is clear and meaningful.
Required for the program to store values that can change, make the program easier to understand

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

What are the three combining principles of imperative programming languages?

A

Sequence, iteration (loops), selection (if)

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

What is the difference between definite and indefinite iteration?

A

Definite iteration - e.g for loops, the loop iterates for a specified number of times
Indefinite - e.g white loops, the loop runs until the condition has been met

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

What features can make high level language programs easier to understand?

A

Use of indentation to separate out statement blocks;
Use of comments to annotate the program code;
Use of procedures / functions / sub-routines;
Use of constants
use of meaningful identifier names

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

What are parameters used for in the context of procedures and functions

A

To pass data/value within programs / to pass data/value in and out of procedures/functions;

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