Programming Techniques- S11 Flashcards
Algorithm
is a set of rules or a sequence of steps specifying how to solve a problem.
Pseudocode
tool for developing algorithms, and is between English and program statements.
Indentation
Statements shifted to the right that are contained within a block
Initialisation
setting variables to appropriate values at the beginning of a program to ensure there is not a value already assigned to it.
Variables
A name in memory used to store a value with can change during execution.
Constant Variables
a value that cannot be altered by the program during normal execution. E.g pi=3.14159265
Why are Constant Variables used
to make the programs easier to understand, easier to change the value of variable throughout the program and to make sure a programmer doesn’t accidentally change its value.`
Give Data Types
Integer, String, Float, Boolean, Character, Date
Sequences
Two or more statements following each other.
Selection
When there is a condition that needs to be met in order for certain statements to be executed.
Pseudocode for a switch case
switch entry: case “A”: print(“You selected A”) case “B”:1 print(“You selected B”) default: print(“Unrecognised selection”) endswitch
Iteration
An iteration is a repetition so a loop.
Give examples of Iteration
While… End While
For count… Next count
for i… next i
Repeat… until
Subroutines
a named block of code which performs a specific task within the program.
Subroutines are good to use because
Easier to understand Easier to debug Can be reused Each module can be tested independently Work is divided between team, so saves time Each member can work on their expertise
Function
A named subroutine that returns a value, called inline, and performs a specific task.
Procedure
A named subroutine that performs a specific task but does not return a value.