9. Algorithms and Programs Flashcards
What does the operator DIV do?
Finds the whole number of times a divisor can be divided into a number e.g. 11 DIV 2 = 5
What does the operator MOD do?
Finds the remainder when a divisor is divided into a number e.g. 11 DIV 2 = 1
What is an algorithm?
An algorithm is a set of organised steps or rules to solve a given problem
What is a Boolean?
A binary variable that can have two possible values, true or false
What is a string?
A data type used to represent a sequence of characters
What is an integer?
A whole number (positive or negative)
What is a real value?
Numbers including fractions and decimals
What is a character?
A letter, digit, space, punctuation mark or various other symbols
What is selection?
Determines which path a program takes when it is running e.g. if statements
What is a sequence?
The order in which instructions occur and are processed
What is repetition and what are the two types?
The repeated execution of a section of code when a program is running
- count controlled iteration: repeatedly executes a section of code a predetermined fixed amount of times
- condition controlled iteration: repeatedly executes a section of code until a condition is met/no longer met
What is a variable?
A named space in memory that can contain a single piece of data, which can change during the execution of a program.
What is a constant
A named space in memory that always contains the same value during program execution.
What is a variable scope?
It indicates the accessibility of a variable.
What is a local variable and what are its advantages?
A variable that only exists until the subroutine in which it was created ends.
advantages:
- subroutines with local variables can be reused in other programs
- easier to debug
- saves memory as it only takes up space when it is needed