Topic 2 Programming Flashcards
Describe a variable.
A named location in the computers memory to store a single value which can change during the execution of a program. Eg radiusOfCircle
Describe a constant.
A named location in the computers memory to store a single value which CANNOT change during the execution of a program. Eg the value of Pi.
What is an identifier?
The NAME of a variable, constant, procedure or function.
What is meant by assignment?
Setting the specific value of a variable. Eg number = 2 means assign the value 2 to the variable called ‘number’.
List the arithmetic operators.
+, -, *, /, MOD, DIV, ^
Describe the arithmetic operator MOD
Modulus division. Returns the remainder after dividing one number by another. Eg 5 MOD 2 = 1
Describe the arithmetic operator DIV
Quotient division. Returns the whole number ignoring any remainder after dividing one number by another. Eg 5 DIV 2 = 2
Describe the the arithmetic operator ^
Exponential or power-of. Eg 3^2 = 9 (3 squared)
Describe the order or operations in arithmetic operators.
BIDMAS - Brackets, Indices, Division, Multiplication, Addition, Subtraction
What are relational operators used for?
To compare different items of data.
List/describe the 6 relational operators
= Equal To <> Not Equal To < Less Than > Greater Than <= Less Then or Equal To >= Greater Than or Equal To
What are logical operators used for?
To combine statements which can be evaluated as TRUE or FALSE.
Name the three logical operators.
AND, OR, NOT
Describe the AND logical operator
The overall statement is true only if ALL of the individual statements are true.
Describe the OR logical operator.
The overall statement is true if ANY of the individual statements are true.