3.2.2 - Programming concepts Flashcards

(10 cards)

1
Q

What are the three basic programming constructs?

A

Sequence
Selection
Iteration

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

Variable

A

A named memory location that stores a value that can change.

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

Constant

A

A value that does not change during program execution.

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

Selection

A

Using a condition to control program flow.

if age >= 18:
print(“Adult”)
else:
print(“Child”)

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

Iteration

A

Repeating a set of instructions using loops (e.g., FOR, WHILE) until a condition is met.

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

Count-controlled iteration

A

for i in range(5): print(i)

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

Condition-controlled iteration

A

while not_done: do_task()

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

Assignment

A

Setting or updating the value stored in a variable.

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

Nested iteration

A

Using one loop inside another loop to repeat code in multiple layers.

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

Nested selection

A

A selection statement placed inside another selection statement to make decisions based on multiple conditions.

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