In capitals to simplify debugging and
are less likely to generate mistakes as
they don'tchange during runtime
RAM is divided in memory locations with long
hexadecimal (but really binary) addresses
A grid of memory locations (or cells) can hold values
Inputs
Programs would be useless without inputs
as they can't interact with the outside world
and always produce the same results
Selection
Allows a computer to "think" - make decisions
Changes the flow of a program, depending on a set of conditions, it is
used for validation, calculation and making sense of a user's choices
Nested Selection
Sometimes, we can only evaluate a condition if some pre-condition is
met. We would need two selection statements, one inside the other
The "outside" selection is the pre-condition,
while the "inside" selection is the conditon
There is no limit on how many
selection statements we can nest
Iteration
For Counter (Counter-controlled)
The loop for when we know in advance how many times we want to loop back to the start, so we keep
count against the number of repetitions that are required using a counter
While Loop (Condition-controlled)
Loops until the condition is met/changes
Better for user interfaces
Repetition of a process
Operators
Represents the operations that
are performed on the data
Arithmetic Operators
+ - Addition
- -
Subtraction
* -
Multiplication
/ -
Division
MOD - Modulus (Remainder) e.g.12 MOD 5 = 2
DIV - Ouotient e.g. 17 DIV 5 = 3
^ - Exponentiation (To the power of)
Comparison Operators
== - Equal to
!= - Not equal to
< - Less than
> - Greater than
<= - Less than or equal to
>= - Greater than or equal to
Logical Operators (Only
used in Booleans)
AND - Two conditions must be met
for the statement to be true
OR - At least one condition must be
met for the statement to be true
NOT - Inverts the results e.g. NOT(A and B) will
only be false when both A and B are true
String Operators
.upper - UPPERCASE
.lower - lowercase
.length - Number of characters
in a string (including spaces)
.substring (x,y) - Part of a string
Sequencing
Allows a programmer to solve complex
tasks through a number of simple steps
Benefits
Each line follows the next
Create simple programs very quickly
Easy to follow for a small program
Fundamental prinicipal of a prgram
Starts at the top, finishes at the bottom
Disadvantages
Not at all efficient
Becomes very difficult to
follow with large problems
Extremely hard to maintain
SQL (Standard Query Language)
Progranmming languague used to work with databases
Can be run from a special window in a database package
SELECT - SQL Keyword
Accomplishes searching and reading simultaneously,
separates keywords from names and criteria
Nested SELECT
Multi-stage filtering e.g. finding all pupils in a set with the first
select and then just retrieve those who get over 80 in results
Particularly useful in multi-table databases
Arrays
An ordered collection of related data where each element
is accessible by a number, known as an index
Advantages
Good for ease of iterating through an array - allows us to
manipulate multiple times of data with very few lines of
code,replacing may separate variables
Non-sequential nature - can jump between non-neighbouring elements
instantly without having to browse through the whole array
Usually have fixed sizes and occupy a
fixed (static) amount of memory
Begins with 0
Sub Programs
Can be used to save time and simplify the code. Main
types of sub programs are procedures and functions
When you want your program to repeat in different places, you
only need to call the name of the subprogram, saving time &
simplifying the code by avoiding repetition of code
Procedures are sets of instructions stored under one name
(identifier) e.g. Prodecure name () -> 'Coding' -> End Prodecure
Functions are similar to procedures but
always return a value to the main program