2.2 Programming Fundamentals Flashcards

(18 cards)

1
Q

What is a constant?

A

Named variable fixed for the duration of the program

Written at the same time the program is written

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

What is an assignment?

A

Storing a value to a variable or constant

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

What is a character?

A

A single letter, number, symbol or control code

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

What are all the arithmetic operators?

A

*
/
MOD or %
DIV or //

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

What is sequence?

A

Instructions executed 1 after another in order

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

What is selection?

A

Branches based on a condition

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

What is nesting?

A

À loop or selection inside another loop or selection

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

What is the pseudo code for totalling?

A

total = 0
count = 0
for i = 0 to 9
num = input( “enter a number” )
total = total + num
count = count + 1
next i
print ( “total: “ + str(total))
print ( “count: “ + str(count))

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

What is the pseudo code for averaging?

A

average = total / num
print (“average: “ + str(average))

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

What is the pseudo code for finding the max or min?

A

max = 0
min = 999
num = input (“enter a number”)
if num > max then
max = num
endif
if num < min then
min = num
endif

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

What is the pseudo code for counting

A

count = 0
for i = 0 to 9
count = count + 1
next i
print (“total items: “ + str(count))

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

Write a function in pseudo code

A

FUNCTION addNumbers (num1, num2)
sum = num1 + num2
RETURN sum
ENDFUNCTION

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

What is pseudo code for?

A

À method of writing up a set of instructions for a program in plain English without worrying about syntax rules

Used for planning a program in plain

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

How to spot an off by one mistake?

A

In a country controlled loop make sure to remember the 2nd number is excluded

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

How to spot wrong operators?

A

= vs ==
< vs <= and > vs >=
/ vs //
and vs or

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

How to spot infinite loops?

A

Make sure there’s a condition that tells it to stop when conditions are full filled

17
Q

What is a trace table?

A

Trace the value of each variable as each line of code is being executed

18
Q

What is a parameter?

A

A named variable that acts a placeholder for the data the function needs to perform a task