Save
GCSE OCR Computer studies PROGRAMMING / COMPUTERS
algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Mia <3
Visit profile
Cards (32)
What is an algorithm?
A set of
rules
/
instructions
to complete a task.
How does Abstraction relate to Programming?
Abstraction helps program by
hiding
technical details,
simplifying
complex problems, and focusing on
essential features.
Three basic control structures used in programming
Sequence
Selection
Iteration
View source
Three operators used in Boolean expressions
AND
OR
NOT
View source
Selection
An
IF
statement is a selection statement. The next statement to be executed depends on whether the
condition
being tested is
True
or
False.
View source
Comparison expressions
The condition average >= 80 is a Boolean expression. The outcome will always evaluate to
TRUE
or
FALSE.
View source
Comparison
operators
==
!=
>=
<=
View source
= is not used to mean
equal
to, as a single = is used for
assignment
View source
If
statements
If statements allow different
branches
to be executed based on the result of a
Boolean
expression.
View source
Complex Boolean expressions
Boolean expressions can include the Boolean operators
AND
,
OR
and
NOT
View source
Switch/case statement
This statement may be used when a
selection
is to be made from several alternatives, for example when choosing from a menu.
View source
Arithmetic operators
+
-
*
/
^
MOD
DIV
View source
Variables
Containers that store data
values
View source
Data
types of variables
Integer
Boolean
Real / Floating point number
Character
String
View source
Constants
Values that cannot be changed during program execution
View source
Constants are typically shown in
uppercase
with words separated by an
underscore
View source
Why declare a constant instead of a variable?
Prevents the value from being changed accidentally
Shows the programmer the value should stay the
same
View source
A constant cannot be changed when the program is running, but can be changed by a programmer
before
the program is compiled or
translated
View source
Input and output statements
1. Accept
data
from the user
2. Process the data
3.
Output
the result
View source
INPUT statement
Displays a prompt for the user and waits for their
response
, which is then assigned to a
variable
View source
DIV
Integer
division
, also known as quotient
View source
MOD
Remainder when
dividing
one integer by another
View source
BIDMAS
Order of precedence:
Brackets
,
Indices
,
Division
,
Multiplication
,
Addition
,
Subtraction
View source
Strings
and
integers
are represented differently in binary
View source
Conversions and casting
Functions used to convert
data
types (int(), float(), str(), bool(), ASC(), CHR())
View source
Inputs from the user are
strings
, so they need to be
converted
before use in calculations
View source
Concatenating strings
Joining strings together using the
+
operator
View source
String handling functions
length
substring
left
right
View source
ASC() and CHR()
Convert
characters
to/from their
ASCII
values
View source
Uppercase
and
lowercase
Converting strings to all uppercase or all lowercase using
.upper
() and
.lower
()
View source
Comments are used to describe the
purpose
,
author
, and
explain
the code
View source
Comments
are ignored when the program is
translated
to
machine code
and
executed
View source