An identifier refers to a location in memory where the data item will be stored.
1) They type of data that will be stored at the memory location (therefore the operations that can be performed on this data item).
2) How much space will be needed for that data item.
2 or 4 bytes.
4 or 8 bytes.
1 byte.
1 bytes per character in string.
1 byte.
Num1 <- 5
CONST Num1 <- 5
To set starting values for variables at the beginning of a program.
At the start of the program.
1) When its value changes, you only have to edit it in one place rather than looking for every place in the program where you uses that number.
2) The code will be easier to read and understand because the constant's identifier will be used instead of a number.
An array is a group of data items of the same data type which is stored under one identifier (name) in contiguous (one after another) memory locations.
1) Code is easier to follow and therefore easier to debug and maintain.
2) A group of data can be easily processed using a loop.
1) Assign values to them.
2) Read values into them from the keyboard or a file.
3) Write the values stored in a box to the screen of a file.
REPEAT
.
.
.
UNTIL (continue = "N") or (continue = "n")
Sequence is writing the steps down in the order they need to happen.
IF...THEN...ELSE allows you to choose between two options. By nesting these or having several in a row you can choose between several options but this is more efficiently achieved by the CASE statement.
Using multiple IF statements.
Using multiple nested IF statements. Only executes the IF statement until it finds one that is true.
Using a CASE statement. Much clearer than the first or second method of a selection (construct).
There are three basic iteration (loop) constructs that you will learn when you program, including FOR, REPEAT and WHILE.
The FOR loop allows you to execute a group of steps 1 or more time, for a specific amount of times.
A REPEAT loop is controlled by a condition at the end of the loop. Therefore it will always execute the following steps at least once.
A WHILE loop is controlled by a condition at the start of the loop. Therefore it will execute the following steps zero or more times.
It will always finish and return an answer or perform the task it was supposed to.
1) Different people can work on different sections at the same time.
2) Some parts may be used several times in a system.
3) Modules can be tested on their own before being put together in the whole system. Makes it easier to debug.
4) A modular system is much easier to understand and maintain later on.
1) The diagram should start with a box at the top that represents the whole program.
2) The whole program can then be broken down into smaller components eg. Getting players name, playing the game in turns etc..
3) Keep on breaking the boxes down into the smallest chunk you can make.
A WHILE loop is controlled by a condition at the start of the loop. Therefore it will execute the following steps zero or more times.