Computer Science Igcse Revision Notes
Computer Science Igcse Revision Notes
Number Systems
Binary System
Base 2 number system
It has two possible values only (0 and 1)
0 represents OFF, and 1 represents ON
A point to be noted is that the most left bit is called the MSB (Most
Significant Bit)
Denary System
Base 10 number system
Has values from 0 to 9
Hexadecimal
Base 16 number system
Have values from 0 to 9 followed by A to F
A represents 10, B represents 11 and so on until 15, which is F
12 6 3 1
8 4 2 1
8 4 2 6
1 1 1 0 1 1 1 0
As can be seen it starts from 1 and then goes to 128 from left to
right
Now values with 1 are to be added together, giving the final answer,
as for the example, it is 128 + 64 + 32 + 8 + 4 + 2 = 238
14
2
2
Remainde
2 71 0
r:
Remainde
2 35 1
r:
Remainde
2 17 1
r:
Remainde
2 8 1
r:
Remainde
2 4 0
r:
Remainde
2 2 0
r:
Remainde
2 1 0
r:
0 Remainde 1
14
2
2
r:
Note that when the value itself is not divisible by 2, it is divided by the
previous value of the current number and 1 is added to the remainder
column for that specific number
When you reach 0, the remainder has to be read from bottom to top giving
us the binary value ( as in this case, it is 1 0 0 0 1 1 1 0 )
Note: We move from RHS to LHS, and when adding values, we use the
rules given above. If the bit crosses the limit (overflows), we put the value
in brackets, denoting it is overflow.
Logical Shifts
The logical shift means moving a binary value to the left or the right
When doing a logical shift, keep in mind that the bit being emptied is
going to become 0
Explanation with Example
Shifting 10101010 - 1 place left:
1. The furthest bit in the direction to be logically shifted is removed
( in this case, one at the LHS is removed) - ==(if it were two places,
2 bits would have been removed)==
2. Every bit is moved in given places to the given direction ( every bit
is moved one place to the left in this case, and the leftover bit in the
right is marked 0, so 10101010 would become 01010100)
Two’s Complement (Binary Numbers)
Two’s complement is a method used to represent negative values in
binary. Here, the MSB ( Most Significant Bit) is replaced from 128 to -128;
thus, the range of values in a two’s complement byte is -128 to 127
Converting Binary Values to Two’s Complement
Firstly, write the binary value and locate the first one from the right; e.g.,
1101100 would have the first one at the third position from the right.
Now, switch every value to the left of the first one located above (not
switching the one), e.g., the value in our example becomes 0010100,
which is the two’s complement of itself.
Converting negative values to two complement
Find the binary equivalent of the value ignoring the - sign
Convert the binary value to two’s complement
Make the MSB 1, if not already
Converting Two’s Complement Value to Denary:
We do it the same way as a normal value is converted from binary to
denary; we only replace 128 with -12,8 e.g., for 1011101,0 we do the:
-
6 3 1
12 8 4 2 1
4 2 6
8
1 0 1 1 1 0 1 0
-128 + 32 + 16 + 8 + 2 = -70
Conventional System
Name of memory No. of Equivalent Denary
size Bytes Value
File Types
Musical Instrument Digital Format (MIDI)
o The first byte is the status byte – which informs the MIDI device
different channels)
music)
MP3
s haping
o Removes sounds that the human ear cannot hear properly
o Certain sounds are removed without affecting the quality too much
Use lossy format as the original file is lost following the compression
algorithm
MP4
This format allows the storage of multimedia files rather than just sound
centimetre
JPEG will reduce the raw bitmap image by a factor between 5 and 15
All the data bits from the original file are reconstructed when the file again
is uncompressed.
(spreadsheet)
No data is lost
Run-Length Encoding
colours in an image)
A repeating string is encoded into two values: the first value represents
the number of identical data items (e.g. characters), and the second value
represents the code of the data item (such as ASCII code if it is a keyboard
100.”
One difficulty is that RLE compression isn't perfect for strings like
"cdcdcdcdcd". We use a flag to solve this; e.g. 255 can be made the flag.
Now 255 will be put before every repeating value, e.g. our previous
example becomes 255 05 97 255 04 98 255 02 99 255 05 100 where 255 now
The file compression algorithm eliminates unnecessary data bits like MP3
Data Transmission
Types and Methods of Data Transmission
Data Packets
Packet Structure -
o Header
Contains the IP address of the sender and the receiver
The sequence number of the packet
Size of the packet
o Payload
Contains the actual data
o Trailer
Includes a method of identifying the end of the packet
Error-Checking methods
Packet Switching - Method of data transmission where the data is broken
into multiple packets. Packets are then sent independently from start to
end and reassembled at the receiver’s computer.
Advantages Disadvantages
There is no need to create a
Packets may be lost
single line of communication
Possible to overcome failed or More prone to errors in real-time
busy nodes streaming
Delay at the receiver while the
High data transmission speed
packets are being re-ordered
Easy to expand package usage
Data Transmission
Simplex data transmission is in one direction only (e.g. computer to
printer)
Half-duplex data transmission is in both directions but not at the same
time (e.g., in a phone conversation where only one person speaks)
Full-duplex data transmission is in both directions simultaneously (e.g.
broadband connection on the phone line)
Serial data transmission is when data is sent one bit at a time over a
single wire
Parallel data transmission is when data of several bits (1 byte) are sent
down several wires at the same time.
Advantages Disadvantages
Only fit one way, prevents incorrect Maximum cable length is about 5
connections metres
Backwards compatible
Industry-standard
Type Types -
0 1 0 1 1 0 1 0
found
Even though the parity checks would reveal the errors, the bit(s)
Parity Blocks
Any changes in bits would be identified through the rows and columns
Checksum
Whenever a block of data needs to be sent, the sender would calculate the
Once the data has been sent, The receiver would calculate the checksum
again with the same set of data and the same algorithm used before.
The receiver would then compare the value received and the newly
data.
Echo Check
Once the data has been sent, The receiver will send the data back to the
The sender would compare the received and original data for errors.
The only downside is that we wouldn’t know if the error occurred when
Check digits are calculated from all the other digits in the data (ex-codes).
Uses acknowledgements and timeouts to make sure the user received the
data
The receiver would check the data for any errors; if none are found, a
found, a negative acknowledgement will be sent, and the data will be sent
again.
The sender uses timeouts to wait for a pre-determined amount for the
acknowledgement.
Encryption
Encryption is a process of turning the data into an unreadable form so it
Symmetric Encryption:
o It uses an encryption key for the encryption process; the same key
Asymmetric Encryption:
o Uses a public key and a private key. The public key is available to
o The receiver would have the private key, and they would send the
public key to the sender. The sender can encrypt the message with
the public key, and the data can be decrypted using the private key.
Hardware
Computer Architecture & Von Neumann
Architecture
The central processing unit (CPU) (also known as a microprocessor or
processor) is central to all modern computer systems
The CPU consists of the following architecture:
Processor: The processor contains the Arithmetic and Logic Unit (ALU)
Control Unit: The control unit controls the operation of the memory,
processor and input/output devices
Arithmetic Logic Unit: Carries out the logic system like calculations
System Clock: The system clock is used to produce timing signals on the
control bus
Busses: Carry data through components. The following are its types.
Address bus – unidirectional
Data Bus – bi-directional
Control Bus – bi-directional
Immediate Access Store: Stores the instructions that are to be
processed, which are fetched by the CPU
The following registers also exist in the architecture:
REGIST
ABBREVIATION DEFINITION
ER
CIR
Source: Cambridge IGCSE and O Level Computer Science - Second Edition (Hodder
Education)
0101011
10101010
0
Instruction Set:
An instruction set is a list of all the commands that a CPU can process,
and the commands are machine code
Cores, Cache and Internal Clock
System’s Clock
The clock defines the clock cycle that synchronises all computer
Overclocking
Using a clock speed higher than the computer was designed for.
The wider the data buses, the better the performance of the
computer
Cache
The larger the cache memory size, the better the CPU
performance
Cores
The more cores in the CPU, the better and faster the performance
But if any number of cores are used, it could possibly slow down the
and so do the data cables between each. Which in turn reduces the
You might have heard about quad and dual cores, not septa or octa cores.
Input Devices
Two-dimensional Scanners:
The image is converted into an electronic form which can be stored in the
computer
o A scan head moves across the document until the whole page is
Three-dimensional Scanners
3D scanners can scan solid objects and produce a three-dimensional
image
light)
Make use of (OCR) to produce digital images which represent the passport
pages
image
Key parts of the face are compared (distance between eyes, width of nose)
Barcode readers/scanners
The left and right hand sides of the barcode are separate using guard bars
o Light is reflected back off the barcode; dark areas reflect little light
Advantages of QR codes:
Digital Cameras
Photo is captured when light passes through the lens onto a light sensitive
cell
Keyboards
Each character has an ASCII value and is converted into a digital signal
Slow method
Prone to errors
Pointing devices
Mouse/trackball
Microphones
electric signal
The signal goes to a sound card and is converted into digital values and
stored in a computer
Voice recognition, voice is detected and converted into digital
Touchscreens
on-board microprocessor
Resistive (inexpensive)
o When the top polyester is touched, the top layer and bottom layer
complete a circuit
Sensors
to electric pulses.
environment.
o Humidity - This sensor measures the water vapour in the air or any
sample.
type of object.
sensor
environment.
(Note: You do not need to know the working principle of the sensor. But
o Lamp switched on
Output Devices
Inkjet Printers
5. A sheet of paper is fed; the sensor detects if the paper is available in the
paper tray
6. The print head moves across paper printing text/image, four ink colours
9. Once it is done, the printer sends an interrupt to the processor (request for
Laser Printers
images
2. Printing drum is given a positive charge; as the drum rotates, a the laser
beam is scanned across it, removing the positive charge leaves negatively
3. The drum is then coated with positively charged toner; it only sticks to
5. The toner on the drum now sticks to the paper to produce a copy of the
page
6. Paper finally goes through a fuser (set of heated rollers); heat melts the
ink so it is permanent
7. The discharge lamp removes all electric charge from the drum, ready to
3D Printers
2D and 3D Cutters
Actuators
DAC)
Loudspeakers/Headphones
Sound is produced by passing the digital data through a DAC then through
different frequencies
The front layer of the monitor is made up of Liquid Crystal Display (LCD),
these tiny diodes are grouped together in threes as pixels (LCD doesn’t
LCD monitors are backlit using Light Emitting Diode (LED) because:
o LEDs sharpens image (higher resolution), and CCFL has a yellow tint
CCFL uses two fluorescent tubes behind the LCD screen, which supplies
Light Projectors:
o LCD Projector
screens/interactive whiteboards
Digital Light Projectors (DLP)
the number of micromirrors and the way they are arranged on the DLP
When the micromirrors tilt towards the light source they are on
When the micromirrors tilt away from the light source, they are off
A bright white light source passes through a colour filter on its way to the
DLP chip
LCD Projectors
When the white light hits the mirrors, the reflected light has wavelengths
These three different lights pass through three LCD screens; these screens
When the coloured light passes through the LCD screens, a red, green and
Finally, the image passes through the projector lens onto the screen
Source: Cambridge IGCSE and O Level Computer Science - Second Edition (Hodder
Education)
HDD, SSD, DVD, memory stick, and Blu-ray disc are some examples
Primary Memory:
Features of RAM
can be changed
The larger the size of the RAM, the faster the computer will operate
As RAM becomes full, the processor has to access the continually hard
Source: Cambridge IGCSE and O Level Computer Science - Second Edition (Hodder
Education)
Virtual memory
management; thus, the system has a high chance of crashing. This is why
The virtual memory can be either HDD or SSD (these storages are
discussed below)
o They can be larger than the physical memory provided in the RAM.
changed
Secondary Storage:
(platter)
A number of read/write heads can access all of the surfaces of the disk
Each platter will have two surfaces which can be used to store the data
There are no moving parts, and all data is received at the same time (not
like HDD)
1s and 0s
o Very thin
Off-Line Storage:
CD/DVD Disks
Laser (red) light is used to read and write data on the surface of the disk.
Both systems use a single spiral track that runs from the centre of the disk
to the edge
Blu-ray Disks
The wavelength of laser light is less than CD and DVD (stores up to five
infringement)
Cloud Storage:
remote servers
The same data is stored on more than one server in case of
storage provider
Embedded Systems
Combination of Hardware and Software which is designed to carry out a
single chip
memory
o Input from the user is sent to the microprocessor (ADC needed if the
data is analogue)
update.
Advantages Disadvantages
Dedicated to one task only Increased garbage as they are thrown away
o GPS systems
o Security Systems
o Vending Machines
o Washing Machines
o Oven
o Microwave
Network Hardware
Network Interface Card (NIC)
hexadecimal digits. The first six display the manufacturer’s code, and the
These do not change and are primarily constant for every device
there are two types of MAC addresses: the Universally Administered MAC
The only difference between the two types are that UAA is made
IP Addresses
IP address allocation:
Static IP addresses:
Dynamic IP addresses:
o Assigned automatically by a DHCP (Dynamic Host Configuration
Protocol) server.
network.
192.168.0.1).
(e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
o Address format: IPv4 uses a 32-bit address, while IPv6 uses a 128-
bit address.
stateless autoconfiguration.
Routers
Router functionality:
different networks.
o It determines the most efficient path for data transmission.
packets.
o It uses routing tables to determine the next hop or the next router
o The router forwards the data packet to the appropriate next hop.
connected devices.
network management.
internet.
network.
o The router receives data packets from devices on the local network
o It also receives incoming data packets from the internet and routes
Types of Software
drivers
System Software:
these are a set of programs which control and manage the operations of
hardware
Application Software:
user can execute the software as and when they require and it is mostly
not automatic
ExamplesSystem Software:
program, allowing the use of separately written code modules in the final
program.
Device driver: Software that enables hardware devices to communicate
Application Software:
creating, editing, and formatting text with tools for copying, deleting,
lettered columns and numbered rows, with each cell identified using a
consisting of one or more tables that hold records and fields. It provides
the ability to query and report on data and add, delete, and modify records
in a table.
bitmap and vector images, with bitmap graphics editors changing pixels to
Interrupts
including:
Utility Software
Computer users have access to utility programs as part of system software
software, disk analysis and repair tools, file compression and management
their effectiveness.
Anti-virus software checks files before they are run or loaded and
Heuristic checking is used to identify possible viruses that are not yet on
the database.
Infected files are put into quarantine for automatic deletion or for the user
to decide.
discovered.
Full system scans should be carried out regularly to detect dormant
viruses.
As an HDD becomes full, blocks used for files become scattered all over
the disk surface, making it slower to retrieve data as the HDD read-write
When a file is deleted or extended, new data does not fill the vacant
sectors wherever possible, allowing for faster data access and retrieval.
Backup Software
Backup software is a utility software that helps create and manage backup
Manual backups using memory sticks or portable hard drives are good
Backup utilities allow scheduling backups and only backup files if changes
There could be three file versions for total security: the current version
accounts, and links to other utilities such as virus and spyware checkers.
access.
Access control and user accounts use IDs and passwords to secure user
Screensavers
Screensavers display moving and still images on the monitor screen after
computer inactivity.
burn'.
Screensavers are now mostly used for customizing a device and as a part
They automatically log out of the user after a certain period of inactivity.
Some screensavers activate useful background tasks like virus scans and
Device Drivers
Device drivers translate data into a format that can be understood by the
Without the appropriate device driver, a hardware device cannot work with
product ID (PID) and unique serial number that allow the operating system
Serial numbers must be unique to avoid confusion if two devices with the
Operating Systems
Operating Systems are designed to establish communication
-managing files
– handling interrupts
– providing an interface
– managing memory
– managing multitasking
(Hodder Education)
Memory Management - Manages the RAM and the HDD/SSD during the
execution of programs
more functions
processes
Running of Applications
bootstrap loader.
The BIOS (Basic Input/Output System) tells the computer the
Interrupts
Signal that causes the operating system to stop what it’s doing and
service a task
Assembly Language
Few programmers use assembly language to -
o Make use of special hardware
o Write code that doesn’t take up much space
o Write code that runs very quickly
o Assembly language must be translated into machine code using an
assembler to run.
Translators
Compiler
Translates a program written in a high-level language into machine code
Used without compiler
Executable file of machine code produced
One high-level language translated into several machine code instructions
Used for general use
Interpreter
Executes a high-language program a statement at a time
No executable file of machine code produced
One high-level language program statement may require several machine
code instructions to be executed.
Interpreted programs cannot be used without an interpreter
Used when the program is being developed
Assembler
Translates a low-level language program into machine code
Executable file of machine code produced
One low-level language translated into one machine code instructions
It can be used without an assembler
Used for general use
Translates a low-level
Translates a high-level Executes a high-level
assembly language
language program into language program one
program into machine
machine code. statement at a time.
code.
An assembled
A compiled program is An interpreter is often
program is usually
usually distributed for used when a program is
distributed for
general use. being developed.
general use.
Source: Cambridge IGCSE and O Level Computer Science - Second Edition (Hodder
Education)
Allows the user to communicate with Uses HTTP(S) protocols that are
other users via chat, email, calling written using Hypertext Mark-up
and more Language (HTML)
URLs are used to locate and access web pages. The typical format of URLs
is -
The path would usually become the file directory roots. for
example, https://www.znotes.com/computer-science
HTTP stands for Hypertext Transfer Protocol, and HTTPS stands for
Web Browsers
The browser sends the URL to the domain name server (DNS)
Cookies
They are used to track data about the users and autofill forms or give
suggestions accordingly
Types of Cookies -
Temporary cookies are stored in Remembers the user’s login details so the
the RAM till the browser is user doesn’t have to log in every time
closed. they visit a website
A few examples are Debit/Credit Cards, Apps (Paypal, Apple Pay, Bank
banking systems.
Blockchain Network
Hacking isn’t possible here as transaction details would be sent to all the
computers, and the data can’t be changed without the consent of all the
network members
Every time a transaction takes place, A block is created. The block would
contain
Data - Name of the sender and the receiver, amount of money and more
Previous Hash Value - Hash Value of the previous block in the chain
The first block is called the genesis block as it doesn’t point to any
Cyber Security
Effect:
and more)
To remove risk:
Data Interception:
transmission line
connections illegally
o Packet Sniffing - Uses Packet sniffers to examine packets sent over a
Effect:
To remove risk:
o Accessing websites
Hacking
Effect:
To remove risk:
o Firewalls
Malware
o Spyware - Sends data about all the activities of the user to the
attacker
Phishing
Attackers send legitimate-looking emails to bait the user into giving out
their information.
To remove risk:
Pharming
The attacker installs a malicious code on the computer, which redirects the
Effect:
o The user gives out login details and other personal details
To remove risk:
o Make sure that the green padlock is present in the URL bar
Social Engineering
Attackers create a social situation which leads to victims giving out their
details (For example - Spam calls informing them that their account has
been hacked)
Access Levels - Having Different levels of access for different people (for
Authentication - User proving who they are. The most common methods
Biometric
Benefits Drawbacks
Methods
Most development
Intrusive as used to identify
methods are very easy to
Fingerprint criminals, Can’t be used if the
use and require very low
Scans finger gets dirty or damaged
storage space to store
(e.g. cuts)
the biometric data.
Spelling and Tone - Fake emails tend to have wrong spelling and grammar
(amazonn instead of amazon), and the tone would also seem urgent
o Attacks like DDoS and Hacking attack the proxy server, keeping the
Privacy Settings - Used to limit who can access and see a user’s profile
SSL (Secure Socket Layer) - Set of rules used while communicating with
o Sensors take inputs, and they are sent to the microprocessor. The
Converter (ADC)
o The actions are then executed by the actuators (Motors, wheels and
so on)
Advantages Disadvantages
transport
agriculture
weather
gaming
lighting
science
Robotics
Robotics is the branch of computer science that combines robot design,
Characteristics of a robot -
o Programmable
CHARACTERISTICS
Types of Robots -
o Independent - Have no human intervention; they can completely
replace humans
Advantages Disadvantages
They are less expensive in the long Risk of deskilling as robots replace
run humans in some task
Artificial Intelligence
AI is the branch of computer science that simulates intelligent human
behaviour.
Types of AI -
specific task
tasks
Characteristics of AI -
o Collection of Data and Rules
o Ability to Reason
Types of AI
Advantages Disadvantages
AI Machine Learning
Design
Coding
Testing
Maintenance
Analysis
program.
The analysis stage involves using tools like abstraction and decomposition
Design
tasks to be completed, the methods for performing each task, and how the
language.
Testing
This testing process ensures that all the tasks within the program
Running the program with different test data can identify and
various inputs.
Structure Diagrams
Every computer system is made up of sub-systems, which are in
below.
algorithm
An example of a flowchart is given below from a past paper question in
(1.2) in this case. It then counts until the accepted riders are 8. After they
are 8, it outputs the number of rejected riders and tells the rest that they
Pseudocode
Declaration & Usage of Variables & Constants
Input & Output (READ & PRINT) – Used to receive and display
output commands)
Declaration of variable - A variable/constant can be declared by
the following manner
Conditional Statements:
IF…THEN…ELSE…ENDIF
CASE…OF…OTHERWISE…ENDCASE – Multiple conditions and
corresponding consequences
Loop Structures:
Validation
Validation in computer systems involves automated checks to ensure the
reasonableness of data before accepting it. If the data is invalid, the
system should provide an explanatory message for rejection and allow
another chance to enter the data.
There are many types of it.
Range check
A range check verifies that a numerical value falls within specified upper
and lower limits.
Length check
This can either ensure that data consists of a precise number of
characters.
Presence check
A presence check checks to ensure that some data has been entered and
the value has not been left blank
Format Check
A format check checks that the characters entered conform to a pre-
defined pattern.
Check Digit
A check digit is the final digit included in a code; it is calculated from all
the other digits.
Check digits are used for barcodes, product codes, International Standard
Book Numbers (ISBN), and Vehicle Identification Numbers (VIN).
Verification
Verification is checking that data has been accurately copied from one
source to another
There are 2 methods to verify data during entry ( there are other
methods during data transfer, but they are in paper 1)
1. Double Entry
Data is inputted twice, potentially by different operators.
The computer system compares both entries and if they differ, an error
message is displayed, prompting the data to be reentered.
2. Screen/Visual check
A screen/visual check involves the user manually reviewing the entered
data.
After data entry, the system displays the data on the screen and prompts
the user to confirm its accuracy before proceeding.
The user can compare the displayed data against a paper document used
as an input form or rely on their own knowledge to verify correctness.
Test Data
Test data refers to input values used to evaluate and assess the
It helps identify errors and assess how the program handles different
scenarios
Normal Data
Normal data is the test data which accepts values in acceptible range of
Normal data should be used to work through the solution to find the actual
result(s) and see if they are the same as the expected result(s)
e.g. in a program where only whole number values ranging from 0 to 100
(inclusive) are accepted, normal test data will be : 23, 54, 64 , 2 and 100
Abnormal Data
Test data that would be rejected by the solution as not suitable, if the
data.
e.g. in a program where only whole number values ranging from 0 to 100
(inclusive) are accepted, abnormal data will be: -1, 151, 200, 67.2, “Sixty-
Extreme Data
Extreme data are the largest and smallest values that normal data can
take
e.g. in a program where only whole number values ranging from 0 to 100
Boundary Data
This is used to establish where the largest and smallest values occur
At each boundary two values are required: one value is accepted and the
e.g. in a program where only whole number values ranging from 0 to 100
(inclusive) are accepted, one example of boundary data will be: 100 and
Trace Table
A trace table is utilized to document the outcomes of every step in an
undergoes a change.
A dry run refers to the manual process of systematically executing an
A trace table is set up with a column for each variable and a column for
Test data is employed to execute a dry run of the flowchart and document
Q: The flowchart below inputs the height of children who want to ride on a
rollercoaster. Children under 1.2 metres are rejected. The ride starts when
0 0
1 1.4
2 1.3
1 1.1
3 1.3
2 1.0
4 1.5
3 1.2
Rider Rejec Heigh
OUTPUT
s t t
5 1.3
6 1.4
7 1.3
4 0.9
Ready to go
8 1.5
4
Identifying errors:
Trace tables can be used to trace errors in a program. For example, if the
requirement for the previous question would be to accept riders that are of
height 1.2 too, rather than rejecting them, then the error would have been
1. Make sure that the problem is clearly understood which includes knowing
algorithm.
2. Break the problem into smaller problems (e.g. in a program which outputs
average values, divide the problem into multiple ones i.e. how to count the
4. Decide on how you are going to construct your algorithm, either using a
5. Construct your algorithm, making sure that it can be easily read and
understood by someone else. Take particular care with syntax e.g. when
6. Use several sets of test data (Normal, Abnormal and Boundary) to dry run
your algorithm and check if the expected results are achieved (a trace
table can be used for this purpose) . If error is found, find the point of error
Note: The algorithms that you have looked at so far in these notes were
not designed with readability in mind because you needed to work out
Given a student name array and a 2D student mark array, calculate the
total and average marks, award grades for each student, and output the
number of distinctions, merits, passes, and fails for the whole class.
#Declare the variables constants and arrays, although you need not
Programming
Programming Languages
There are many high-level programming languages to choose
is referred to as IDLE.
capturing screenshots.
Programming Concepts
Constructs of a Program
Operators use arithmetic for calculations and logic and Boolean for
decisions.
for others.
Data Types
appropriately.
Prompting the user with clear instructions for input is necessary for the
Input data in programming languages must match the required data type
By default, inputs are treated as strings, but commands can convert input
program to be useful.
meaning or significance.
separator character.
Basic Concepts
When writing the steps required to solve a problem, the following
Sequence
Selection
Iteration
String handling
Use of operators.
Sequence
order can lead to incorrect results and/or extra steps that are not required
by the task.
Selection
chapters.
Iteration
String Handling
Strings are used to store text and can contain various characters.
spaces.
Function:
When defining procedures and functions, the header is the first statement
in the definition.
The header includes:
o The name of the procedure or function.
o Parameters passed to the procedure or function, along with their
data types.
o The data type of the return value for a function.
Procedure calls are standalone statements.
Function calls are made as part of an expression, typically on the right-
hand side.
Local and Global Variable
Any part of a program can use a global variable – its scope covers
the whole program
A local variable can only be used by the part of the program it is
declared in – its scope is restricted to that part of the program.
Note: Any variables/arrays made in this procedure and functions
will be local and cannot be used out of these. To be made
available all over the program, they must be declared globally in
the following way.
Library Routines
Library routines are pre-tested and ready for use, making programming
tasks easier.
DIV – returns the quotient (i.e. the whole number part) of a division
Examples:
places
Value4 <--- RANDOM() returns a random number between 0 and 1
inclusive
be divided into modules for each task using procedures and functions
feature
Commenting in pseudocode:
Arrays
An array is a data structure containing several elements of the same data
type; these elements can be accessed using the same identifier name.
The position of each element in an array is identified using the array’s
index.
There are two types of arrays
One-Dimensional Array
Explained in the previous chapter in detail
Two-Dimensional Array
A two-dimensional array can be referred to as a table with rows and
columns.
When a two-
dimensional array is declared in pseudocode, the first and last index
values for rows and the first and last index values for columns alongside
the data type are included.
Declaring a 2D Array:
File Handling
Computer programs store data that will be needed again in a file.
Data stored in RAM is volatile and will be lost when the computer is
powered off.
Data saved to a file is stored permanently, allowing it to be accessed by
the same program at a later date or by other programs.
Stored data in a file can be transferred and used on other computers.
The storage of data in files is a commonly used feature in programming.
Writing in a file
Appending a file
Reading a file:
Reading a file till EOF:
Databases
A database is a well-organized compilation of data that enables individuals
numerical values, images, or any other type of digital content that can be
consistency.
All users access and utilize the same set of data, promoting uniformity.
duplication.
type of data e.g. cars. These tables HAVE to be named according to what
These tables also have columns that are knows an fields. These consist of
specific information regarding the entities that are written later in records
primary key for a database table and also be able to read, complete and
Education
Validation in databases
Database management software automatically provides some validation
construction.
date. \n
Basic Data Types
Each field will require a data type to be selected. A data type classifies
how the data is stored, displayed and the operations that can be
Primary Key
Each record in a table represents a unique item, person, or event.
key is necessary.
The primary key is a unique field that distinguishes each item within the
data.
In order to serve as a primary key, a field must have values that are never
In cases where all existing fields may contain repeated data, an additional
For instance, someone visiting a patient may only require the ward
number and bed number to locate them in the hospital, while a consultant
may need a list of the names of all the patients under their care. This can
SQL Scripts
Select Statements:
required!
Operators
Just like pseudocode, the operators used there can also be used here for
NOT Gate
AND Gate
OR Gate
NAND Gate
NOR Gate
XOR Gate
Outpu
A
t
0 1
1 0
AND gate: multiplication
Outpu
A B
t
0 0 0
0 1 0
1 0 0
1 1 1
OR gate: addition
Outpu
A B
t
0 0 0
0 1 1
1 0 1
1 1 1
Outpu
A B
t
0 0 1
Outpu
A B
t
0 1 1
1 0 1
1 1 0
Outpu
A B
t
0 0 1
0 1 0
1 0 0
1 1 0
Outpu
A B
t
0 0 0
Outpu
A B
t
0 1 1
1 0 1
1 1 0
logic circuit.
2. Go from the one output that is being given towards the input
3. Write the last gate ( the first gate you walk through ) in the middle and
then, for each of the value coming into the gate, leave space at the side
4. If the value coming into the gate is coming from another gate, use a
5. Repeat process 3-4 till you are able to reach the input values fully
2. Go from the logic of any 2 inputs at the start, and then keep on going until
you are able to reach the final gate which gives the output
3. When writing the statement, make sure you show the logic statement
combination
2. Run through the circuit with the inputs and get the output that will be
Example
This is the example of a truth table of a logic circuit
The circuit:
1, 2, 4, 5, 6, 7)
2. Create a logic expression from these rows (example, row 1 will be (NOT A
3. Create logic expressions for all the rows with output 1 and connect them
with OR gate
Exam-Style Question
1. The Conditions are given so make logic statements using the conditions