2.2 - programming fundamentals Flashcards
What is a variable
Named memory address that holds a value. This can change as a program is running
What is declaring a variable
Identifying a variable before assigning it a value
What is assignment
Assigning a variable a value
What is a constant
Allows a name to be assigned a value. Cannot be changed whilst program is running
What is a global variable
Variable that can be accessed and changed throughout the program
What is a local variable
Variable confined to a loop or sub program
3 basic programming constructs
Sequence, selection, iteration
What is sequence
Order in which statements are executed
What is selection
The process of making a decision. This decides the path the program will take next. Works by testing a condition
Two types of iteration
Count-controlled, condition-controlled
What is iteration
When a program repeats itself until a certain condition is met or until told otherwise
What is count-controlled iteration
Repeatedly executed a section of code a fixed amount of predetermined times
What is condition-controlled iteration
Repeatedly executes a section of code until a condition is met
Two types of condition controlled iteration
While loops
Repeat loops
3 types of operators
Mathematical
Logical
Comparison
Mathematical operator for addition
+
Mathematical operator for subtraction
-
Mathematical operator for multiplication
*
Mathematical operator for division
/
Mathematical operator for remainder
MOD
Comparison operator for equals
= or ==