2.2.1 Programming fundamentals Flashcards

1
Q

What is a variable?

A

Value in your program that can change when program is running

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

What is a constant?

A

Value in your program that cannot change when program is running

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

What is a construct?

A

The building blocks of a program?

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

What are the 3 constructs?

A

Sequence
Selection (if statement)
Iteration (loop)

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

What is a sequence?

A

When code can run in the order that is written

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

What is an example of a sequence code?

A

1) A=5
2) B=6
3) Ans = A+B
4) print(Ans)

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

What is selection?

A

(if statement)
When code can jump to a different section based on location

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

What is an example of a selection code?

A

1) A=5
2) B=6
3) if A>B
4) print(A)
5) else
6) print(B)

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

What is iteration?

A

(loop)
When code repeats until condition is met

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

What are the two types of iteration loops?

A

Count controlled loop (for loop)
Condition controlled loop (while loop)

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

What is a count controlled loop?

A

(for loop)
Set a counter and you iterate that many times

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

What is an example of a count controlled loop?

A

for (i) in range (0,10) or (10)
print (name)
print(str(i)+name)

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

How can you count in twos in a count controlled loop?

A

for (i) in range (0,51,2):
print(i)

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

How can you count down in twos in a count controlled loop?

A

for (i) in range (50,-2,-2)
print(i)

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

How can you make your print go across the page in a count controlled loop?

A

for (i) in range (0,51)
print(1 , end = “ “)

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

What is a condition controlled loop?

A

(while loop)
Repeat a task while a condition is not met

17
Q

What is an example of a condition controlled loop?

A

count = 0
while count != 10:
print(count)
count = count + 1

18
Q

What does == mean?

A

Equal to

19
Q

What does != mean?

A

Not equal to

20
Q

What does < mean?

A

Less than

21
Q

What does <= mean?

A

Less than and equal to

22
Q

What does > mean?

A

Greater than

23
Q

What does >= mean?

A

Greater than and equal to

24
Q

What does + mean?

A

Addition

25
Q

What does - mean?

A

Subtraction

26
Q

What does * mean?

A

Multiplication

27
Q

What does / mean?

A

Division

28
Q

What does MOD mean?

A

Modulo

29
Q

What does DIV mean?

A

Quotient

30
Q

What does ^ mean?

A

Exponentiation (to the power)