Programming Flashcards
What are the 3 basic programming constructs?
Sequence - the order of instructions
Selection - an instruction is only carried out if a condition is met (if, elif, else)
Iteration - looped section of code
What are the 2 types of iteration?
Definite iteration - count controlled (for)
Indefinite iteration - condition controlled (while, repeat until)
What is nested iteration?
When a loop is included inside another loop
What is nested selection?
When more than one decision needs to be made when carrying out a task
What is nesting?
The process of including one programming construct within another
What is a variable?
A named piece of memory which contains a value that can change.
What is an identifier?
The name of a variable?
What is declaration?
Giving a variable a name or giving a value to a constant
What is assignment?
Giving a variable a value
What is a constant?
A named piece of memory which holds a value that cannot change.
What is scope?
Refers to where a variable, constant, function or procedure can be used - it can be either local (within a subroutine) or global (the whole program)
What are the 5 data types?
Integer - number
String - text
Boolean - true/false
Character - a singular letter/number
Float/ float - decimal
What is casting?
The process of changing the data type of a variable e.g. int(‘54’) returns 54
What are the arithmetic operators?
*
/
DIV (//)
MOD (%)
What are the relational operators?
Used for assignment and comparison:
= - assignment
== - equivalence
< - less than
<= - less than or equal to
> - greater than
>= greater than or equal to
!= - not equal to