1.2.3 Intro to Programming [OUT OF SERVICE] Flashcards
Programming construct: Sequence
Code is executed line-by-line from top to bottom
Programming construct: Selection
Certain block of code is run if a specific condition is met, using IF, ELSE IF and ELSE statements
Programming construct: Iteration
A block of code is executed a certain number of times or while a condition is met, using FOR, WHILE or DO UNTIL loops
What is a variable?
A name used to refer to a particular memory location used to store data.
What operator is this: =
Assignment
What is the difference between constants and variables?
Value of a constant cannot be edited by the program during execution.
What might we use a constant for?
Values that don’t need changing.
EG: VAT, Pi
Programming construct: Subroutine
Named blocks of code that perform a specific task.
How many values can a function return?
One.
What are parameters?
Values passed into a subroutine.
Arithmetic operator: **
Exponentiation (raising a number to a power)
Arithmetic operator: DIV or //
Integer division
Whole number of times a number goes into another
Arithmetic operator: MOD
Remainder when a number is divided by another
What are arithmetic and relational operators used for?
Arithmetic: Carrying out mathematical functions
Relational: Making comparison between 2 values
Boolean operator: AND
Returns true when both values true
Boolean operator: OR
Returns true when at least one value is true