1.2.3b - structured programming (y12) Flashcards

1
Q

What is structured programming?

A

A programming style that uses sequence, selection, iteration, and procedures.

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

What is sequence?

A

Code runs in a set order, line by line.

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

What is selection?

A

Code chooses between options using conditions (e.g. IF statements).

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

What is iteration?

A

Repeating code using loops (e.g. FOR, WHILE).

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

What is a procedure?

A

A named block of reusable code that performs a task.

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

What is a function?

A

Like a procedure, but it returns a value.

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

Why use procedures/functions?

A

To make code modular, reusable, and easier to debug.

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

What does modular programming mean?

A

Breaking code into separate, independent modules.

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

Why is modular code better?

A

Easier to test, debug, and reuse.

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

What is a parameter?

A

A variable passed into a procedure or function.

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

What is a local variable?

A

A variable declared inside a procedure – used only there.

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

What is a global variable?

A

A variable declared outside procedures – accessible everywhere.

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

Why avoid global variables?

A

They can cause bugs and make code harder to maintain.

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

What is a subroutine?

A

Another term for a procedure or function.

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

What does “top-down design” mean?

A

Breaking a big problem into smaller subproblems.

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

What are advantages of structured programming?

A

Makes code readable, easier to maintain, and less error-prone.

17
Q

What is code indentation?

A

Spacing used to show structure – essential for clarity.

18
Q

Why is structured programming good for teams?

A

Clear logic and modular code make collaboration easier.

19
Q

What is spaghetti code?

A

Unstructured, messy code that’s hard to read and debug.

20
Q

What are built-in functions?

A

Pre-made functions provided by the language (e.g. len()).

21
Q

What is recursion?

A

A function calling itself – used carefully in structured design.

22
Q

When is structured programming taught?

A

Often as a foundation in learning to code.

23
Q

What language features support structured programming?

A

IF/ELSE, WHILE, FOR, PROCEDURE, FUNCTION.

24
Q

How does structured programming improve testing?

A

Individual modules can be tested separately.