Slr 1 Flashcards
Define program
A program is a series of statements
What are the three programming constructs?
Sequence
Selection
Iteration
Define sequence
Executing one instruction after another
Define selection
Allows a program to branch and follows a different direction depending on the outcome of a condition
E.g. if statement
Define iteration
Repeating sections of code
E.g. for loop, while loop, do until
Define nesting
Process of putting one statement inside another
Is for loop condition or count
Count controlled loop
Is while loop condition or count
Condition controlled loop
Define variable
A value that can change while the program is running. It is a (named) address in memory
Define constant
Value that remains fixed, as it does not change while the program is running. It must be set when the program is first written
Define assignment
Supply a value to a variable or constant. Performed with a =
Define Subroutine
Block of code given a unique, identifiable name within a program
Why use subroutines
To break down a larger problem into a series of smaller, more manageable problems, making them easier to:
Code
Debug
Reuse
Define procedures
Are blocks of code that carry out a set task
Define function
Blocks of code that carry out a set task and returns a value
What do procedures do?
Carry out a task
Provide structure to code
What do functions do?
Carry out a task
Returns a value
Create reusable program components
Advantages of subroutines
Programs are easier to write
Programs are easier to debug
Creates re useable components
Functions can be grouped in a library for easy reuse access across multiple programs
Programs are easier to test
Sign for addition
+
Sign for subtraction
-
Sign for multiplication
*
Sign for division (d.p)
/
Sign for exponential
Or **
Sign for modulus
//
Sign for equal to
==
Sign for not equal to
!=
Sign for less than
<
Sign for less than or equal to
<=
Sign for greater than
>
Sign for greater than or equal to
> =
Where are Boolean operators used
In Boolean expressions- present in selection and iteration statements
What are the Boolean operators.
Not
And
Or
Define string manipulation
Act of manipulating, extracting or changing the characters in a string variable