Paper II: Var's, Const's and Operators Flashcards
Difference between variables and constants?
variables can change while the program is running but constants must not change.
What is an identifier?
The name to a variable or constant
Usefulness of short identifier?
Easier to spell correctly
Usefulness of long identifier?
More descriptive
What is assignment?
When the value of a variable/constant is assigned
How is assignment statement made for variables and constants?
With SET … TO or =
CONST
How can you name identifiers?
Camel case
Have first word lower case
Snake case
Program to recieve variable from user and display as output?
RECIEVE varOne FROM KEYBOARD
SEND varOne TO DISPLAY
Area of a rectangle program?
RECIEVE width FROM KEYBOARD
RECIEVE length FROM KEYBOARD
SET area to width * length
SEND area TO DISPLAY
What are all arithmetic operators?
\+ for addition - for subtraction * for multiplication / for division MOD for Modulus DIV for quotient ^ for exponential powers of e.g 3^2 = 9 which is 3²
What is order of operations?
BIDMAS Brackes Indices Division Multiplication Addition Subtraction
What are all the relational operators?
= for equals to <> for not equal to < for less than > for more than <= for less than or equal to >= for more than or equal to
How are strings compared with relational operators?
Strings are compared alphabetically
e.g.
David is greater than Catherine
‘Db’ is greater than ‘Da’
What are the three main logical operators?
AND
OR
NOT
What does AND operator do?
Ensures that the overall statement is true if individual statements are all true.