0% found this document useful (0 votes)
240 views34 pages

O-Level Computing Theory

This document provides an overview of computing theory based on the Singapore-Cambridge GCE “O” Level Computing Syllabus. It covers topics such as data representation using different numbering systems like binary and hexadecimal. It also discusses data types in spreadsheets and functions in Excel. Additionally, it defines key terms related to safe and responsible computer use like unauthorized access and software licensing. Networking concepts such as IP addresses, MAC addresses, and RGB color codes are also introduced. The document is meant to complement the textbook by providing additional context for learning computing theory.

Uploaded by

danahisokay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views34 pages

O-Level Computing Theory

This document provides an overview of computing theory based on the Singapore-Cambridge GCE “O” Level Computing Syllabus. It covers topics such as data representation using different numbering systems like binary and hexadecimal. It also discusses data types in spreadsheets and functions in Excel. Additionally, it defines key terms related to safe and responsible computer use like unauthorized access and software licensing. Networking concepts such as IP addresses, MAC addresses, and RGB color codes are also introduced. The document is meant to complement the textbook by providing additional context for learning computing theory.

Uploaded by

danahisokay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Computing Theory!

as per the Singapore-Cambridge GCE “O” Level Computing Syllabus (7155)


Version 2 Revision 4, 1 October 2022

This document follows the structure of the Singapore–Cambridge General Certificate of Education Ordinary Level (2022)
Syllabus coded 7155 using content from the Third Version Textbook.

This document is neither standalone nor a replacement for the textbook but is complementary alongside it. Please refer to
the textbook for a thorough breakdown and teaching of a topic.

Table of Contents
By Module By Chapter

Module Page Chapter Module Page

1 Data and Information 3 1 Computer Internals 2 13

2 Systems and Communication 13 2 Algorithms 3 22

3 Abstraction and Algorithms 22 3 Flowcharts and Psuedo-code 3 23

4 Programming 25 4 Writing Programs 4 26

- Additional Materials 29 5 Problem Solving with Programs 4 26

6 Ensuring a Program Works as Intended 4 27

7 Safe and Responsible Computer Use 1 5

8 Number Systems 1 3

9 Logic Circuits 2 15

10 Spreadsheets 1 29

11 Networking 2 16
Anki Flashcards are available!
(alongside these notes)

https://github.com/markjoshwel/compcards
Module 1 – Data and Information
Module 1 Data Management Example:

Data and Information Excel Types and Functions Overview 102 (100) 101 (10) 100 (1)
This module is about the handling and processing of data in See the “Additional Materials” Unit at the back of
computer systems, and the need to be ethical when dealing these notes for the cheat sheet! 4 2 0
with data. Students should be able to identify di erent
types of data, understand and explain what the data is for, 400 20 0
and explain how the data is represented or organised for Data Representation
processing and output with reference to a given problem. 420
Students will be more aware of ethical issues with respect Definitions
to data, including the privacy of data. 1. Denary Number System
Used for:
Number system that is made up of 10 unique digits
1. IPv4 Addresses
2. Binary Number System 2. ASCII Codes
Number system that is made up of 2 unique digits

Data Management 3 The Binary Number System (Base 2)


3. Hexadecimal Number System
Excel Types and Functions Overview 3 There are 2 unique digits in this number system.
Number system that is made up of 16 unique digits
Data Representation 3
Definitions 3 4. Leading Zero 0 1
Number Systems 3 Zero digit (0) that is to the left of the first non-zero
The Denary Number System (Base 10) 3 digit in a number
Used for:
The Denary Number System (Base 2) 3 Example: 00101001
The Hexadecimal Number System (Base 16) 3 1. ASCII/Unicode Codes
Applications of Number Systems 4 5. Internet Protocol (IP) Address
IPv4 Addresses 4 Sequence of bytes that is used to identify a Example:
IPv6 Addresses 4 computer or device on the Internet
MAC Addresses 4
25 (32) 24 (16) 23 (8) 22 (4) 21 (2) 20 (1)
RGB Colour Codes 4 6. Media Access Control (MAC) Address
ASCII and Unicode 4 Sequence of bytes (usually permanent) that is 1 0 1 0 1 0
used to identify a particular network interface
Safe and Responsible Computer Use 5 controller 32 0 8 0 2 0
Definitions 5
Unauthorised Access 6 42
Social Networking/Social Media Sites 7
Number Systems
Preventing Unauthorised Access 7
Comparing Software Licences 8 The Denary Number System (Base 10) The Hexadecimal Number System (Base 16)
Causes of and Measures Against Data Corruption and There are 10 unique digits in this number system. There are 16 unique digits in this number system.
Loss 8
Types of and Measures Against Privacy and Security
Threats 8
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F
Ethical, Social and Economical Issues 10
3
Module 1 – Data and Information
Example: IPv4 Addresses 20:17:0B:AD:C0:DE
In IPv4, an IP address is made up of 4 bytes or 32
162 (256) 161 (16) 160 (1) bits, represented as a sequence of four denary Manufacturer's Identity Number: 20:17:0B
numbers separated by dots/periods. Device’s Serial Number: AD:C0:DE
1 A 4

10.133.16.165 RGB Colour Codes


256 160 4
RGB Colour Codes are made up of three colour
420 IPv6 Addresses components represented by two hexadecimal digits.
They are prefixed with a number/pound/hashtag
IPv6 is a long-term solution to the shortage of IPv4
symbol.
Uses in Computing/Computer Science: addresses and is made up of 16 bytes or 128 bits,
represented as a sequence of eight groups of four
1. IPv6 Addresses hexadecimal digits separated by a colon. Red Blue Green
2. MAC Addresses
3. HTML/RGB Colour Codes # 00 → FF 00 → FF 00 → FF
2001:0db8:0000:0000:0020:0017:0bad:c0de
4. Memory Dumps
IPv6 Addresses can be simplified by: The higher the component's value, the brighter its
Applications of Number Systems colour is. Thus:
Quick Reference Table: 1. Removing all leading zeros
Example: - #FF0000 → Pure red
- 2001:0db8:0000:0000:0020:0017:0bad:c0de - #00FF00 → Pure blue
Name Format Note - 2001:db8:0:0:20:17:bad:c0de - #0000FF → Pure green
IPv4 4 denary numbers Used to - #800080 → Purple
separated by a period identify 2. Omit only one set of consecutive zeros
devices on Example:
ASCII and Unicode
the internet - 2001:db8:0:0:20:17:bad:c0de
- 2001:db8::20:17:bad:c0de The ASCII standard, abbreviated from American
IPv6 8 groups of 4 hexadecimal Long-term Standard Code for Information Interchange, has 128
digits separated by a colon solution to MAC Addresses representable characters, and both denary and
IPv4 hexadecimal are used to represent ASCII code points
A more permanent way to locate or identify a (referred to as “codes” in the syllabus, and here on
MAC 6 groups of 2 hexadecimal Used to particular computer or device is using its Media out).
digits separated by a identify a Access Control (MAC) address. MAC Addresses are
colon, first three groups particular NIC only used to direct data between devices in a Local
represent the Unicode is an extension of ASCII and has 1,114,112
Area Network (LAN). maximum possible codes, and thus requires
manufacturer’s identity
number and the last three hexadecimal characters to represent a Unicode code.
groups representing the It is made up of 6 bytes or 48 bits, represented as
serial number six groups of two hexadecimal digits separated by a
colon. The first three groups represent the
manufacturer's identity number and the last three
represent the device’s serial number.

4
Module 1 – Data and Information

Safe and Responsible Computer Use 9. Two-factor Authentication 18. Intranet


Type of authentication that uses evidence from Private network that only authorised users within
Definitions both something the user knows and something the an organisation can access
1. Data Corruption user owns
When data is made unusable by errors or 19. Application
alterations 10. Biometrics Software designed for users to perform specific
Type of authentication based on the measurement tasks
2. Data Loss of human physical characteristics
When data is destroyed and cannot be recovered 20. Encryption
11. Identity Theft Process of encoding a message so that a secret
3. Backup Impersonation of another person to steal personal key is needed to decode the data
Copy of data that is made in case the original is details such as name and identity number for
damaged or lost fraudulent purposes 21. Malicious Software/Malware
Software that is intentionally used to damage,
4. Uninterruptible Power Supply (UPS) 12. Authorisation/Access Control disrupt or gain unauthorised access to a computer
Device that provides enough emergency power for Ability of a computer to control a user’s access to system
a computer to properly shut down in case of a data and resources
power failure 22. Spamming
13. Permissions Mass distribution of unwanted messages or
5. Authentication Settings to control the ability of users to view or advertising to email addresses which are collected
Process of verifying the identity of a user make changes to the contents of a file or folder from sources such as public mailing lists, social
networking sites, company websites and personal
6. Authentication Factor 14. Administrator blogs
Category of evidence used for authentication, and Special user who can override the permissions for
is something the user knows (e.g., a password), almost any file or folder 23. Anti-spyware/Anti-virus
something the user owns (e.g., a phone), or Software to detect, remove and stop
something that is measured from a physical part of 15. Administrator Rights spyware/viruses and other malware from running
the user (e.g., fingerprint) Ability of a user to perform tasks related to
authentication and authorisation, such as creating 24. Operating System
7. Unauthorised Access and removing user accounts, resetting passwords Software designed to support a computer’s basic
Situation where data owned by someone is used and overriding file permissions functions
by someone else, such as an intruder, without
permission 16. Firewall 25. Signature (malware)
Device or computer program that prevents Unique evidence that is used to detect a known
8. Security Token unauthorised access to or from a private network version of some malicious software
Device that is used specifically for authentication
purposes 17. Tra c 26. Copyright
Transmission of data over a network The legal right of owners to control the use and
distribution of their intellectual property

5
Module 1 – Data and Information
27. Intellectual Property 36. Proprietary Software 44. Virus
Creations of the mind that have value but can exist Commercial software for which most of the legal A computer program that attaches itself to a
purely as data with no physical form protections under copyright are retained normally harmless program and modifies it. When
the modified program is run by a user, the virus
28. Copyright Infringement 37. Shareware attaches copies of itself to any other programs it
Use or distribution of copyrighted work without the Demonstration software that is distributed for free can find, thus “infecting” them
permission of the copyright owner but for a specific evaluation period only
45. Worm
29. Plagiarism 38. Crack A computer program that runs automatically and
Passing o someone else’s original work as one’s Program that modifies proprietary software so that attempts to spread by sending copies of itself to
own the software cannot detect that it is being used other computers. Unlike a virus, a worm does not
illegally need to attach itself to an existing program
30. Licence
O cial description of activities that are authorised 39. Cookie Further information about aforementioned privacy
or forbidden by the owner of intellectual property A small file used by websites to store personal and security threats are listed in the “Types of and
information on a user’s web browser Measures Against Privacy and Security Threats”
31. Software piracy sub-unit of this unit.
Crime of copying, distributing and/or using 40. Pharming
proprietary software in a manner that is not The interception of requests sent from a computer Unauthorised Access
permitted by its licence to a legitimate website and redirection to a fake Situation where data owned by someone is used by
website to steal personal data or credit card someone else, such as an intruder, without
32. Free and Open-Source Software (FOSS) details permission
Software where users are given freedom to change,
copy, study and share the software and its source 41. Phishing Can occur due to:
code The use of emails and fake websites that appear to
be from reputable companies in order to steal 1. Poor authentication
33. Public Domain Software personal information such as passwords and credit 2. Poor access control or authorisation
Software where the legal protections that are card numbers from users 3. Poor understanding of privacy policies
typically granted to intellectual property have
either expired, been surrendered or are simply 42. Spyware May result in:
inapplicable A hidden program that secretly collects personal - Stolen passwords or bank account
information about its users and transmits this information used to steal money and commit
34. Freeware information to attackers without the users’ fraud
Proprietary software that is available for use at no knowledge - Intruders publicising private information
cost leading to unwanted attention or bullying
43. Trojan horse
35. Open Courseware A computer program that pretends to be a
Higher-education course materials such as videos harmless file or useful application
and notes created by universities and distributed
for free on the Internet

6
Module 1 – Data and Information

Social Networking/Social Media Sites Authentication Authorisation/Access Control


Social Networking/Social Media pose dangers for a
users' privacy as: unique passwords for each computer
or online account. → Configure the firewall to block
1. Many users are also unaware that the privacy tra c from certain well-known
policies for some social networking sites do → Update passwords regularly – at harmful programs.
not guarantee that their personal data will be least once every 90 days.
Encryption → Keep secret keys private and safe.
deleted from the site completely or
Security → Keep the security token stored in a
immediately even after they close their
Tokens secure location at all times. → Use encryption in combination
account or remove the personal data from
with file permissions.
their account.
→ Report a missing security token as
2. Once any data is digitised and uploaded to a
soon as possible. → Verify that a website’s address
public network such as the Internet, it can
starts with “https://” and a padlock
potentially remain there forever. This is Biometrics → Choose an appropriate biometric icon appears next to its address on
because the digital data is easily copied and measurement that is di cult to a web browser before sending
may be republished in ways that are no longer replicate (e.g., fingerprint). confidential customer data such as
under the control of the original uploader.
credit card information
Personal data is sensitive and should not be shared Authorisation/Access Control
publicly. Some companies may decide not to hire Understanding of Privacy Policies
candidates after reviewing the information and Type Preventative Measures
photographs posted on their social networking Type Preventative Measures
accounts, even if this information was posted while File → Take care not to accidentally grant
they were still students in school. Permissions file access or administrative rights Social → Read and fully understand the
to unauthorised users. Networking privacy policy of the social
Preventing Unauthorised Access Sites networking site.
→ Make authentication for the
Authentication administrator especially strong (such → Set your sharing settings to
as by using two-factor “private” so that only people you
Type Preventative Measures authentication) to avoid having an know in real life can read your posts.
intruder successfully claim to be the
Passwords → Keep passwords secret and safe. administrator and bypass file → Think twice before posting any
permissions entirely. personal photographs or information
→ Avoid obvious password choices that you may feel uncomfortable
such as birthdates and surnames. → Use file permissions in sharing.
combination with encryption
→ Use passwords that are a mixture → Accept friend requests wisely.
of lower-case letters, upper-case Firewalls → Configure the firewall properly to Make sure you know everyone on
letters, numbers and symbols. block tra c between any your friends list.
unauthorised senders and/or
→ Avoid reusing passwords and use receivers.

7
Module 1 – Data and Information

Comparing Software Licences collaborating with data as a way of → Avoid opening


multiple users to attacking the computer. email/chat attachments
Can copy,
prevent them from or files from unknown
Copyright? Free? modify and
writing to the same file sources.
distribute?
at the same time.
Public Domain 🗙 ✓ ✓ → Install and configure a
firewall to prevent them
FOSS ✓ (See 1) 🗙 Power Failure from spreading through
a network.
Proprietary ✓ 🗙 🗙 Explanation Preventative Measures
→ Install anti-virus and
Freeware ✓ ✓ 🗙
If the power supply to a
computer fails, data
→ Make regular backups
of data.
anti-spyware software,
as well as perform
Shareware ✓ 🗙 🗙 that is in the process of
being written to a → Set up a backup
regular scans and
updates.
storage device may power supply or
Notes: become corrupted and uninterruptible power
data that is stored in supply (UPS) so storage Types of and Measures Against Privacy
1. The “free” in “free software” refers to the volatile memory but not devices can complete
freedom to use and not the price.
and Security Threats
yet written to a storage any write operations in
device will be lost. case of a power failure. Type Preventative Measure(s)
Causes of and Measures Against Data
Corruption and Loss Cookie → Manage Cookies
Hardware Failure or Damage
- Human Error Pharming → Identify Pharming
- Power Failure Explanation Preventative Measures
- Hardware Failure or Damage Phishing → Identify Phishing
- Malicious Software or Viruses All magnetic, optical → Make regular backups
and solid-state storage of data. Spamming → Manage Spam
devices can fail, either
Human Error due to overuse, → Check storage devices Spyware → Anti-virus/Anti-Spyware
manufacturing defects regularly and replace → Update Software Regularly
Explanations Preventative Measures
or age. them when signs of
Trojan horse → Anti-virus/Anti-Spyware
Storage devices may be → Make regular backups failure are detected.
→ Update Software Regularly
accidentally damaged of data.
during transport. Unauthorised (See “Preventing Unauthorised
Malicious Software or Viruses
→ Use adequate Access Access” sub-unit)
Multiple users working protection when Explanation Preventative Measures
on the same file may transporting storage Virus → Anti-virus/Anti-Spyware
accidentally overwrite devices. Some malicious → Make regular backups → Update Software Regularly
each other’s data. software may purposely of data.
→ Set up rules when Worm → Anti-virus/Anti-Spyware
damage and corrupt
8
Module 1 – Data and Information
Definitions for the threats are provided in the Most anti-virus and anti-spyware programs rely on a
Identify Pharming
“Definitions” sub-unit of this Unit. list of signatures and update the list regularly using
the internet.
Further Information Not In Definitions Unlike phishing, it can be di cult to spot pharming
attacks as everything seems to be normal while the
Update Software Regularly
- Collected/stolen data from can then be used attack is taking place. Nevertheless, some measures
for unauthorised access to even more of the can be taken to protect against pharming:
victim's data (Applicable to Pharming, Worms run automatically through exploiting bugs or
Phishing and Spyware) unintended behaviour in otherwise legitimate - Ensure that a website uses encryption when
programs. Regular software updates avoid such submitting credit card or other sensitive
- Cookies are not malicious in nature, but are situations as bugs discovered since the last update information via the Internet.
sometimes misused to collect personal can be fixed.
information about users - Regularly check bank, debit/credit card and
other statements to ensure all transactions
Identify Phishing
- Pharming is more di cult to detect than are legitimate.
phishing as the fake website uses the same
address as the real website - The email claims to be from a company or - Regularly update web browsers and the
bank and asks for personal data or software running on network hardware so
- Once a Trojan horse is run, it does something confidential information. Most companies or that all known bugs are fixed
harmful such as giving intruders unauthorised banks will never ask for such information via
access to the computer instead email. - Make sure that two-factor authentication is
enabled for all bank transactions. This
- Unauthorised access to passwords or private - The email uses a generic greeting such as ensures that no unauthorised transactions
information can lead to identity theft, stolen “Dear Customer” or “Dear User”. This is a sign can take place as the attacker would not be
money or public embarrassment that the email was sent automatically and not able to provide the required OTP.
by a person.
Manage Spam
- The email has inaccurate logos or
Install Anti-virus/Anti-spyware Programs
grammatical and spelling errors that suggest
it is not from a legitimate source. - Avoid giving your email address to unfamiliar
Anti-virus and anti-spyware programs: contacts or untrusted websites.
- The email seems to come from a fake sender
- detect when malware is about to be run and or from an address or contact that does not - Read and understand the privacy policy of any
stop it from running; match the supposed source of the email. website, trusted or untrusted, that requests
- detect malware that is already running and an email address before providing it.
try to stop it; or - The tone of the email or chat is excessively
- scan the user’s storage and email to detect urgent or threatening. Phishers often use such - Look out for options to turn o email
and remove malware; scare tactics to make victims act before they updates or participation in mailing lists when
- if a program has been infected by a virus, it can think through their actions properly signing up for or changing the settings of an
may also try to restore the original program. online account. (Many sites leave such
options turned on by default)

9
Module 1 – Data and Information
- Most email services have a filter feature that social networking sites to promote content the classroom. The open sharing of
allows users to block specific senders or to that the reader is likely to be interested in information on the Internet has made
only allow emails from specific senders since most sites promote content based on education accessible to all, even learners
through. how much they can elicit responses and not from disadvantaged backgrounds. AI has also
by their level of accuracy. made it possible to provide personalised
learning and testing for thousands of
Manage Cookies
Economic Impact students without the need for excessive
manual e ort.
- Delete cookies - The rise of smartphones has led to an
- Prevent cookies from being created by increased focus on mobile devices and mobile - On the negative side, technology has made it
untrusted websites applications in the computing industry. more challenging for educators as students’
- Disable cookies attention spans are getting shorter due to the
- Allow only selected websites to use cookies - The rise of social media has led to the technology and social media that they are
increased use of social media for marketing used to today.
Ethical, Social and Economical Issues purposes and has helped businesses to better
understand buying habits and consumer Economic Impact
- Communication needs by analysing social media posts.
- Education - The rise of open courseware has led to a
- Finance - Improvements in communications technology large number of for-profit and non-profit
- Healthcare have also reduced business costs through the organisations that o er customised lessons
- Transportation use of cheap and e ective video conferencing on a variety of topics for self-study online.
- Entertainment calls in place of face-to-face meetings.
- Many educational institutions have also
Ethical Issues invested heavily in the materials and
Communication
infrastructure needed to conduct lessons
- Should some kinds of false information on over the Internet.
Social Impact the Internet be blocked or would this be
taking censorship too far? - Some traditional educators find that they
- On the positive side, the Internet has enabled need to retrain and pick up new skills to
diverse cultures to interact and share ideas - Is it right to collect and analyse social media better utilise these new technologies for
with each other. Social networking sites have posts in ways that the original authors may education.
also allowed users to remain connected with not have intended?
friends, family and colleagues even over long Ethical Issues
distances. AI has also made it possible for
Education
anyone to automatically transcribe and - Should students be allowed to use mobile
translate speech into di erent languages with phones in school?
remarkable speed and accuracy. Social Impact
- Can education technology ever be more
- On the negative side, some people use the - On the positive side, technology has provided e ective than a good teacher?
Internet to reinforce their existing opinions or better videos, simulations and collaboration
to spread rumours and misinformation. This is tools for lessons to be more engaging and
worsened by the use of AI by some news and relevant to students, both inside and outside

10
Module 1 – Data and Information
microseconds. This has led to the rise of healthcare impersonal and mistrust the
Finance
algorithmic trading, which is the study and ability of machines to provide proper
refinement of algorithms to make trading healthcare. Other patients may misuse
Social Impact decisions at speeds not possible by a normal information from the Internet and make
human being. potentially dangerous decisions based on
- On the positive side, the rise of financial incorrect diagnoses. Patients may also be
technology has enabled consumers to spend, - Many banks also use AI to analyse transaction uncomfortable with the collection of medical
borrow, invest and save money through data and automatically identify unusual data necessary to improve the performance
low-cost and easy-to-use mobile and web spending patterns or money transfers. This of healthcare-related AI.
applications. There is no longer a need to helps them to automatically detect and
perform such transactions in person. prevent instances of financial fraud without Economic Impact
Individuals have also become better-educated the need for manual intervention.
on how to make smart financial decisions - Technology has created new areas of growth
using information that is freely available on Ethical Issues in the healthcare industry, such as the
the Internet. In retail, many consumers also provision of telemedicine solutions to existing
enjoy the convenience of making payments - Should financial technology be limited to healthcare businesses. In particular, many of
via biometric authentication (e.g., face or protect more vulnerable users? these solutions provide a way for patients to
fingerprint recognition) which is only possible securely transfer potentially sensitive medical
with the use of AI. - Is it safe or acceptable to have financial information over the Internet.
markets controlled by secret algorithms
- On the negative side, threats to the privacy instead of humans? - There is also an increased focus on
and security of data as well as the ease of automating healthcare processes through the
obtaining false information on the Internet use of robots to dispense medicine and other
Healthcare
have made some people more vulnerable to more menial tasks. This may in turn cause
financial scams and other get-rich-quick such jobs to disappear from the job market.
schemes. Social Impact
- The rise of 3D-printing technology has also
Economic Impact - On the positive side, technology has enabled opened up new opportunities in the building
telemedicine, which is the use of video and customisation of prosthetic limbs,
- Financial technology is currently an area of conferencing and other technology, for hearing aids and dental fixtures.
growth in the financial industry. Numerous doctors to provide medical consultations and
companies have started to make financial diagnoses over the Internet or applications on Ethical Issues
services more e cient for both individuals mobile devices. This gives patients who are
and businesses. These companies typically located in remote places or have limited - Is it acceptable for robots to replace humans
use technology and software to reduce the mobility better access to healthcare. By in providing certain kinds of healthcare?
time, cost and e ort needed for payments, analysing medical data, AI can automatically
investments, fundraising, trading, and/or data identify warning signs of possible health - Is it acceptable to transfer private medical
analytics for both businesses and individuals. problems and provide doctors with more information over the Internet?
accurate diagnoses.
- With the evolution of technology, the time
needed to perform a financial trade has - On the negative side, some patients find the
decreased from seconds down to mere use of robots and other technology in

11
Module 1 – Data and Information
- Multiple new companies o er on-demand concern that such technology is causing
Transportation
rides via mobile applications. These people to become deficient in real-life social
developments have led to sweeping changes skills or abandon their responsibilities. AI has
Social Impact in the taxi service industry as well as also made it possible for anyone to create
employment opportunities for taxi drivers. doctored images and videos that appear
- On the positive side, transport has become remarkably convincing to the average viewer.
less stressful and more predictable for - Mapping technology is also another area of While such images and videos have been used
travellers due to the availability of detailed growth with an increased focus on making 3D mostly for entertainment, they can also be
maps as well as real-time information on bus maps and geospatial data more accessible used to cause public alarm or spread
frequencies, tra c congestion levels and damaging falsehoods.
and useful to travellers.
street-level photographs of neighbourhoods
around the world. All this information is also Economic Impact
Ethical Issues
available at a low cost through popular
mobile devices. Location data from such - Games, animation and media are areas of
- Is it acceptable for mapping companies to
mobile devices may also be collected by AI to strong growth in the entertainment industry
drive through neighbourhoods and take
improve the accuracy and relevance of any with new opportunities being opened up by
pictures to put them online?
map or tra c data that is displayed. the rise of high-quality virtual reality,
augmented reality and motion-tracking
- Is the sharing of personal transport
- On the negative side, some people are technology.
preferences worth the conveniences o ered
uncomfortable with how pictures and by AI?
information about themselves or their home - Many businesses are also using monitoring
may be used by mapping companies without technology and strategies from game design
their permission in order to build more Entertainment to provide rewards and incentives for
accurate maps for travellers. This is especially work-related achievements.
true with regards to the collection of location Social Impact
data from mobile devices as this data can Ethical Issues
reveal personal details such as home and - On the positive side, technology has enabled
work addresses that users may wish to keep more exciting and engaging forms of - Is it right for game companies to make money
private. entertainment. Many computer games have o addicted players?
active online communities and mobile games
Economic Impact have even managed to bring participants - Is it right for businesses to use technology to
together in the real world through in-game monitor employees more extensively?
- The rise of self-driving vehicles with the use incentives to meet or team up. AI has also
of AI to recognise and adapt to road made it possible to provide more accurate
recommendations for consumers based on
conditions is likely to open new areas of
collected data on their previous choices of
growth in the travel industry. Singapore is one
entertainment.
of the first countries where self-driving cars
are being tested, and if successful, the
- On the negative side, some people may be
technology will likely revolutionise the motor
addicted to computer games or social
industry. networking sites. There is an increasing

12
Module 2 – Systems and Communication
Module 2 Computer Architecture 9. Execute

Systems and Definitions


To follow or perform an instruction

Communication 1. Computer 10. Software


Set of instructions to perform specific tasks on a
Device that can receive data, process the data
This module is about systems involving computer according to a set of instructions and produce the computer
technology and computing devices. Students will learn the
processed data as a result
inter-relationships between parts and whole of a system; as 11. Address
well as the functions of parts of systems in enabling Number that is used to locate a byte in memory
communications between human and computing device 2. Computer Architecture
(machine), machine and machine, and within a machine. How a computer is designed and built to function,
including how the parts of the computer are 12. Memory
designed, organised and connected Device that is used to store data for immediate
use in a computer
3. Processor/Computer Processor
Processes data and follows instructions; consists 13. Hard disk (or hard drive)
of an arithmetic logic unit and a control unit Secondary storage where data is stored on rigid
rotating disks coated with a magnetic material
Computer Architecture 13 4. Data (singular: datum)
Definitions 13 Information that is used in a computer program 14. Volatile
Units of Data 14 Lost when the power supply is interrupted
Storage Media 14 5. Bit
Types of Storage Media 14 Binary digit which can take on the value of either 0 15. Processor registers
Comparing Storage Mediums 15 or 1 Extremely fast but small data storage spaces are
Logic Gates 15 used directly by the ALU and control unit. The
6. Byte number and size of processor registers cannot be
Data Communications 16 changed without changing the processor.
Network Hardware, Organisation and Topologies 16
Binary number made up of eight bits
Definitions 16 16. Random Access Memory (RAM)/Main Memory
7. Arithmetic Logic Unit (ALU)
Advantages and Disadvantages of a Computer Where data and instructions are stored temporarily
Network 17 Part of the processor that processes data by
performing basic mathematical and logical so that they can be quickly accessed by the
Comparing Area Networks
(LAN vs WAN vs MAN) 17 operations such as addition, subtraction, processor when needed. Data stored on RAM is
Comparing Network Organisations multiplication and division. easily changed and is volatile.
(Client-Server vs Peer-to-Peer) 18
Comparing Transmission Mediums 8. Control Unit 17. Read-only memory (ROM)
(Wired vs Wireless) 19 Where data and instructions that rarely need to
Part of the processor that follows instructions and
Components of a Simple Home Network 19 change or would be needed for a computer to
decides when data should be stored, received or
Modulation 19 start up are stored. Data stored on ROM cannot be
transmitted by di erent parts of the computer
Network Topologies 19 easily changed and is non-volatile.
making sure that data is transported to where it
Error-Checking Methods 20
needs to be, and that it is processed in the correct
Parity Check 21
order.
Checksum 21
13
Module 2 – Systems and Communication
18. Bus 28. Secondary Storage Units of Data
Collection of wires for transporting data from one Way of storing large amounts of data that will not
part of a computer to another be lost when power supply is interrupted Name Symbol Power of 1000/1024

19. Bi-directional 29. Magnetic Storage Media Kilo/Kibi kB/KiB 1


Able to work in two directions, to and fro Data is stored on a magnetic material that can be Mega/Mebi MB/MiB 2
read or written by a magnetic “head”
20. Uni-directional Giga/Gibi GB/GiB 3
Able to work in one direction only 30. Optical Storage Media
Tera/Tebi TB/TiB 4
Data is stored as very small pits or indentations
21. Data bus that can be read or written by a laser
Bi-directional bus that is used to transport data Example:
between memory and the processor 31. Solid-state Storage Media
Data is stored in electronic circuits called “flash - 1 Megabyte (MB) = 10002 = 1000000 bytes
22. Address bus memory” that have no moving parts - 1 Mebibyte (MiB) = 10242 = 1048567 bytes
Uni-directional bus that is used to transport
required memory location from processor to 32. Truth Table Storage Media
memory Table that shows the resulting output for every Types of Storage Media
possible combination of inputs
23. Input (computer architecture) - Magnetic
Data or instructions that the computer receives for 33. Logic Gate Examples: Hard Drive/Hard Disk Drive (HDD)
processing An electrical circuit that performs logical
- Optical
Example: Mouse, keyboard, webcam, touch screen, operations based on one or more inputs and
Examples: Digital Versatile Disc (DVD), Blu-ray
microphone, scanner produces a single output
Disc

24. Output (computer architecture) 34. Logical Operation


- Solid-state
Intermediate or final results produced by the An operation that acts on binary inputs to produce
Examples: Flash Drive, Secure Digital (SD)
computer in the form of processed data an output according to the laws of Boolean logic Card, Memory Card, Solid-state Drive (SSD)
Example: Printer, speakers, display/monitor
35. Logic Circuit
25. Hardware A circuit that consists of only one logic gate or
Physical part of a computer multiple logic gates connected together Magnetic

Advantages Disadvantages
26. Input device 36. Logic Circuit Diagram
Hardware device that allows users to enter data Visual representation using symbols to show how Large storage capacity Easily damaged and will
and instructions into a computer the component logic gates are connected together of up to terabytes (TB) eventually break over
in a logic circuit of data time
27. Output device
Hardware device used to display, project or print
processed data from a computer

14
Module 2 – Systems and Communication

Optical Magnetic Optical Solid-state Logic Gates


- OR
Advantages Disadvantages Faster than Slower than Much faster
- AND
optical, slower magnetic and than magnetic
Large storage capacity Data can only be written than solid-state or optical - NOT
of up to gigabytes (GB) once for some solid-state storage media storage media - NOR
of data non-rewritable formats media - NAND

OR Gate AND Gate


Solid-state Portability

Advantages Disadvantages Magnetic Optical Solid-state

Large storage capacity Much more expensive Least portable, More portable Most portable
of up to terabytes (TB) than magnetic or optical due to spinning than magnetic, due to no Q = 1 If A OR B Q = 1 If A AND B
of data storage media components less portable moving parts
prone to than solid state A B Q
A B Q
mechanical storage media
Other Advantages and Disadvantages are seen in the
failure and due to 0 0 0 0 0 0
“Comparing Storage Mediums” Sub-unit of this Unit. damage scratches or
fingerprints 0 1 1 0 1 0
Comparing Storage Mediums
1 0 0 1 0 0
When deciding on the best type of storage media to
Durability
use, these factors should be considered: 1 1 1
1 1 1
Magnetic Optical Solid-state
- Capacity
- Speed Easily damaged Vulnerable to Not as NOT Gate NOR Gate
- Portability and will scratches and vulnerable to
- Durability eventually fingerprints drops,
- Cost break over mechanical
time shocks,
scratches or
Capacity fingerprints Q = 1 If NOT A Q = 1 if A NOR B
Q = 1 if NOT (A OR B)
Magnetic Optical Solid-state
Cost A Q A B Q
Large storage Large storage Large storage
capacity of up capacity of up capacity of up Magnetic Optical Solid-state 0 1 0 0 1
to terabytes to gigabytes to terabytes
(TB) of data (GB) of data (TB) of data Relatively More expensive Much more 0 1 0 1 0
cheaper than than magnetic, expensive than
optical and cheaper than magnetic or 1 0 1 0 0
solid-state solid-state optical storage
Speed storage media storage media media 1 0 1 1 0

15
Module 2 – Systems and Communication
4. Metropolitan Area Network (MAN) 13. Bandwidth
NAND Gate
Network of computing devices typically spanning The average number of bits of data that can be
across two or more buildings within the same transmitted from a source to a destination over
town or city the network in one second; is usually measured in
megabits per second (Mbps) or gigabits per second
5. Wide Area Network (WAN) (Gbps)
Q = 1 If A NAND B
Network of computing devices typically covering a
Q = 1 If NOT (A AND B)
large-scale geographical area, typically across 14. Port Number
multiple geographical locations Number that is used together with an IP address to
A B Q
uniquely identify a program that is running on a
0 0 1 6. Ethernet network
Most commonly used wired network protocol for
0 1 1 local and metropolitan area networks 15. Service Set Identifier (SSID)
A 32-byte string that identifies a wireless access
1 0 1 7. Network Protocol point (WAP) and all devices connected to it
Set of standards and rules that govern how two or
1 1 0
more devices communicate over a network 16. Packet (computing)
A unit of broken-up data containing a header with
Data Communications 8. Wired Network information about the source and destination
Network of devices connected by a physical addresses that are needed for transmission
Network Hardware, Organisation and medium, such as cables
Topologies 17. Network Interface Controller/Card (NIC)
9. Wireless Network A network interface controller/card (NIC) provides
Definitions Network of devices in which signals are the hardware interface to enable the transfer of
1. Computer Network transmitted without the use of a physical medium data between a device and a network. A NIC may
System of two or more computers that are connect to a network physically or wirelessly. Most
connected together by a transmission medium for 10. Client devices are equipped with a built-in NIC.
the exchange of data. Computer that initiates a connection to a server to
request for resources and services to perform 18. Hub/Network Hub
2. Transmission Medium operations Device that transmits received packets to all
Means of connecting two or more computers connected devices. Likewise, when a device
together, such as using copper cables, radio waves 11. Server responds, the response is sent to every device that
or light pulses, so that they may exchange data Computer that shares resources with and is connected to the hub.
and interact with each other responds to requests from devices and other
servers on the network
3. Local Area Network (LAN) 19. Switch/Network Switch
Network of computing devices connected within a 12. Wireless Access Point (WAP) Device that constructs a single network by
small geographical area, typically within the same Network hardware that provides a connection connecting multiple similar networks together. A
building, such as a home, school or o ce between wireless devices up to 100 metres away switch uses MAC addresses to keep track of the
and can connect to wired networks devices that are connected to it. This lets the

16
Module 2 – Systems and Communication
switch intelligently decide whether it should drop Advantages and Disadvantages of a - Maintenance Costs
or forward the packets that it receives. Computer Network There are also subsequent costs associated
Note: A switch that connects exactly two networks with administering and maintaining the
together is also called a network bridge. Advantages Disadvantages network.

20. Router - Shared Resources - Initial Costs - Security Risks


- Shared Internet Access - Maintenance Costs As files are shared through a network, there
Device that forwards packets between separate
- Shared Software - Security Risks is the risk of virus or worm attacks spreading
networks, keeping the connected networks (which - Shared Storage - Risk of Data Loss
may use fundamentally di erent protocols) throughout the network even with just one
- Communication - Server Outage
infected computer.
separate and forwards packets between them
using Internet protocols.
Advantages - Risk of Data Loss
Data may become lost due to hardware
21. Demodulation - Shared Resource failures or errors. Using a network means
Conversion of transmitted signals into digital data A network allows a group of computers to regular data backups are needed.
make use of shared resources such as
22. Modem (short for “modulator-demodulator”) printers or files. - Server Outage
Device responsible for modulation and If the server fails, the network will not be
demodulation - Shared Internet Access able to function, thus a ecting work
Depending on the network’s configuration, processes.
23. Modulation every user who logs on to the network may
Conversion of digital data into a form suitable for have access to the Internet. Comparing Area Networks
transmission
(LAN vs WAN vs MAN)
- Shared Software
24. Parity Bit Software can be stored on the central server In order of increasing size:
Additional bit, which can either be 0 or 1 of a network and deployed to other
depending on whether an odd or even parity computers over the network. 1. Land Area Network
Examples: Home, O ce, School Campus
system is used, appended or prepended to a string
- Shared Storage Properties:
of binary data before transmission
Data files can be stored on a central server - Typically faster than MANs and WANs
for ease of access and backup purposes. due to closer proximity of devices
25. Parity Check
Error-checking technique which uses a parity bit to
- Communication 2. Metropolitan Area Network
detect errors Examples: Town, City
Computers in the same network are often
able to share instant messages and emails for Properties:
26. Checksum communication. - Usually owned and operated by a large
Calculated value used to determine the integrity of organisation such as a business or
transmitted data Disadvantages government body

- Initial Costs
Installing a network could be costly due to
the high setup and equipment costs.

17
Module 2 – Systems and Communication
3. Wide Area Network
Advantages Disadvantages client or server server
Examples: Country, The Internet
Properties: Client- - Centralised - Higher initial cost Hard- Each client is Each computer in
- Can be either private or public Server control of data and due to the need for ware connected to one the network can
- Can span long distances via resources a server Organi- or more dedicated serve as a client
long-range transmission media such sation servers and server at the
as telephone lines, fibre optic cables - Easy to schedule - Administrative same time
or satellite links. backups of all costs needed for
shared files at the maintenance of Band- Typically high but Varies depending
- Uses more expensive and high-speed
regular intervals server and clients width limited by the on how
technology than a LAN capability of the data needs to be
- Security may be server transmitted. The
Definitions for the networks are provided in the enhanced with the more computers
“Definitions” sub-unit of this Unit. use of specialised needed to handle
software or the request, the
Comparing Network Organisations operating system larger the
features that are bandwidth.
(Client-Server vs Peer-to-Peer) designed for
A client is a computer that initiates a connection to servers
Secu- High as access Low as security is
a server to request for resources and services to
Peer- - Cheaper to set - More e ort is rity rights can be handled by each
perform operations.
To- up as there is no required to access controlled centrally computer and not
Peer cost related to and back up at a server by a central server
A server is a computer that shares resources and dedicated servers resources as they
responds to requests from devices and other servers are stored locally
on the network. - Easy to set up as within each Setup High as the use of Low as basic
no specialised computer instead Cost specialised computers can act
Server-Provided Resources and Services: software or of centrally in a high-performance as servers to share
operating system server servers would resources
features are be needed
- Providing central storage of files
- Sharing hardware such as printers needed - Security is an
issue as access
- Controlling logins and network access Stor- Centralised and Decentralised and
rights are not
administered by a age carried out only at can be carried out
Client-Server Peer-to-Peer central server the server; usually by individual users
managed by a at each computer
network
administrator
Client-Server Peer-to-Peer

Func- Data and resources Data and resources Appli- Found in Found in homes or
tion are shared using are shared directly cation businesses or small businesses
one or more between organisations with where there are
dedicated servers; computers; each a large number of fewer users
each computer has computer acts as users
a distinct role: both a client and
18
Module 2 – Systems and Communication

Comparing Transmission Mediums and hacking


Hence, it becomes necessary to convert digital data
(Wired vs Wireless) into a form suitable for the transmission medium
Mobi- Lower as network Higher as users before it can be transmitted.
Most Common Network Protocol for: lity connections are can move about
fixed at specific freely within the The process of converting digital data into a form
- Wired: Ethernet spots and users range of the suitable for transmission is known as modulation.
- Wireless: Wi-Fi cannot move to wireless network The reverse process is known as demodulation. On
other locations either end of the transmission, the device
Wired Wireless responsible for modulation and demodulation is
Scala- More cumbersome Easier to add new
bility to add new devices to the known as a modem, short for
Cost Initially cheaper Initially expensive devices to the network as the “modulator-demodulator”.
but becomes due to the cost of network as router can be
more expensive as wireless physical easily configured Network Topologies
network grows in networking constraints and
size due to the equipment but the running of 1. Bus
cost of cables becomes more cables need to be 2. Ring
cost-e ective as considered 3. Star
network grows in
size Organi- Tends to look More organised
sation more disorganised without cables
Speed Faster and higher Generally slower due to cables
bandwidth as and lower running across
cables provide bandwidth due to floors
dedicated possible
connection interference from
radio waves or Components of a Simple Home Network
microwaves;
varies according In order of connection,
to user location in
relation to 1. Modem
network 2. Router
3. Switch
Relia- More reliable as Less reliable due 4. Hub
bility data transmission to potential 5. Network Interface Card (NIC)
is una ected by interference from
interference radio waves and
Definitions for the components are provided in the
microwaves or
blockage from “Definitions” sub-unit of this Unit.
physical
obstructions Modulation
Secu- More secure as Less secure due Long-range transmission media, however, are
rity the network is to possible typically not designed for transferring digital data
less susceptible intrusion by (i.e., 0 and 1 bits) that are used by computers. For
to interception hackers instance, telephone lines are designed for
transmitting analogue sounds and not digital data.
19
Module 2 – Systems and Communication

Bus Topology Ring Topology Star Topology

A common cable or backbone known as the bus


connects all the devices. It also allows the devices
to communicate with the server, with each other
and with devices such as a shared printer.
Each computer is connected to two other Network hardware such as a hub or switch is at
During communication, a sender will transmit data computers in a ring formation. All the data is the centre of the network with connections to all
along the bus and all the devices connected to the passed around in the same direction. If a failure the other computers. The computers will send
bus can detect that data is being transmitted. occurs in the cable or if a computer breaks down, data to the central network hardware and the
However, only the intended recipient will accept the entire network will fail to function. hardware forwards the data to the intended
and process the data. destination.

Advantages Disadvantages Advantages Disadvantages Advantages Disadvantages

- Easy and cheap to - A break anywhere - Can operate over - If a computer or cable - The load on each - Uses more cabling
install as it uses less along the bus may larger distances and in the network fails, the section of cabling is than other topologies
cabling than other disable the entire handle more data than a entire network may fail reduced as each and hence costs more
network designs network bus topology as the data cannot be computer uses a
passed on separate cable from the - If the central network
- Scalable as new - The size of the - Data packets that are rest hardware fails, the
computers can be easily network is limited by sent between two - Adding a new entire network fails
added the capacity and length computers will pass computer to the ring - If a fault occurs at a
of the bus through intermediate network would mean computer or cable, it is
- Can continue to computers, hence a that the whole easy to isolate the fault
operate even when one - A single bus is central server is not communication ring and do a replacement
of the computers breaks unsuitable for networks required to manage the needs to be temporarily without a ecting the
down with many computers; network interrupted rest of the network
performance slows
- Works well for small down as the number of
networks computers increases

20
Module 2 – Systems and Communication

Error-Checking Methods Limitations:

Data can become lost or corrupted during - It is able to detect that an error has occurred
transmission. Data is seldom sent in a single stream but cannot determine where the error
but is instead broken up and sent in smaller packets. occurred.
This allows us to focus on detecting transmission
errors one packet at a time. - It is able to detect when an odd number of
bits have been corrupted but not an even
There are two basic error-checking methods to number of bits have been corrupted.
ensure that the data received at the destination is or
the same as that at the source: It is not able to detect bit transposition.

1. Parity check
Checksum
2. Checksum
A checksum is a calculated value that is used to
Parity Check determine the integrity of transmitted data. A
checksum serves as a unique identifier for the data
In parity check, an additional bit is either appended and is sent together with the data.
or prepended to a string of binary data for
transmission. 1. Before transmission, a checksum is
calculated.
This parity bit can be either 0 or 1, depending on
whether an odd or even parity system is used. Parity 2. The data and the checksum is sent together.
bits are the simplest method of error detection.
3. At the destination, the checksum is
In the odd parity system, the total number of 1 bits calculated and compared to the sent
in each packet (including the parity bit) should be checksum value.
odd.
4. If the checksums match, the data was
In the even parity system, the total number of 1 bits transmitted correctly. Else, an error has
in each packet (including the parity bit) should be occurred.
even.
Method to calculate a one byte checksum:
Odd Parity 010 1101 → 1010 1101
- If the sum of all bytes in the data is less than
Even Parity 010 1101 → 0010 1101 or equal to 255, the checksum is this value.

- If the sum is greater than 255, the checksum


is the modulus of 256. (e.g., sum = 1350 %
256 = 70)

21
Module 3 – Abstraction and Algorithms
Module 3 Definitions 11. Trace table

Abstraction and 1. Algorithm


Tabulation of the change in variables as well as the
output of an algorithm
Set of step-by-step instructions for solving a
Algorithms problem 12. Pseudo-code
This module is about problem-solving and how a problem Description of an algorithm using natural language
may be solved by breaking it into smaller, manageable 2. Input (algorithms) mixed with sequence, selection and iteration
parts and solving all the smaller parts. An algorithm Data used by an algorithm that can a ect what is constructs
describes a solution for the problem that is independent of required for correct output
a programming language and may be presented in
pseudo-code (where program structures will be more 3. Output (algorithms)
Problem Analysis and Algorithm
pronounced) or diagrammatically (flowchart). Students
Results produced by an algorithm Design
should be able to know the di erence between
pseudo-code and flowchart. Problem Solving Techniques
4. Solution
Algorithm that always gives correct outputs when Decomposition
provided with valid inputs
Decomposition is a technique of breaking down a
complex problem or process into smaller parts
5. Sub-problem (known as sub-problems) such that each part is
A problem whose solution contributes to the more manageable and easier to understand. The
solution of a bigger problem parts are evaluated separately and the solutions to
these parts are then combined to solve the original
6. Decomposition problem.
Breaking down a complex problem into smaller
and more manageable parts Problem Decomposition Approaches

7. Pattern Recognition - Incremental approach


Identifying similarities among two or more items - Modular approach

8. Generalisation Incremental Approach


Technique of replacing two or more similar
problems or solutions with a single, more general
Identify quantitative features of the input or output
problem or solution
that are causing the problem to be too large to
Definitions 22 handle. Sometimes, the solution to a small version of
9. Dry run
the problem with one or more of these features
Problem Analysis and Algorithm Design 22 Process of running through a set of steps manually
reduced can be found and gradually extended to
Problem Solving Techniques 22 larger versions of the problem. Each gradual
Decomposition 22 10. Test data extension of the solution is a separate sub-problem.
Pattern recognition 23 Input data that is used to perform a dry run
Generalisation 23
Pseudo-code Constructs 23
Flowchart Constructs 23
22
Module 3 – Abstraction and Algorithms

Modular Approach Generalisation Selection


Generalisation is a technique of replacing two or
more similar items with a single, more general item. Syntax
Solve simple examples of the problem manually and
identify tasks that are of di erent natures. Usually, This can be done with both problems and solutions.
If <condition> THEN
these tasks can be separated from each other to In particular, a general solution is extremely useful
<code>
become distinct (and sometimes unrelated) because it allows us to solve a large number of
ELSE
sub-problems. This usually results in sub-problems problems with just a single solution.
<code>
that are di erent from each other. ENDIF
Pseudo-code Constructs
Pattern recognition - Input/Output Example
Pattern recognition is the technique of identifying - Selection
- Iteration IF age < 18 THEN
similarities among two or more items. In
OUTPUT “Underage!”
problem-solving and algorithm design, it is usually
ENDIF
used in three ways: Input/Output

1. Identifying patterns among two or more Syntax Iteration


problems.
These patterns are clues that the solutions to INPUT <variable> Syntax
these problems will most likely be similar,
and that a solution for one problem can be OUTPUT <variable> WHILE <condition>
modified to solve other similarly patterned <code>
problems. Example ENDWHILE

2. Identifying patterns among two or more INPUT year FOR <variable> = <x> to <y>
solutions. INPUT age <code>
These patterns are clues that the solution can born = year - age NEXT <x>
be generalised to a single solution to solve OUTPUT born
multiple problems. Example

3. Identifying patterns among two or more steps WHILE text != “secret”


in a solution. INPUT text
These patterns indicate that the solution can ENDWHILE
be simplified or shortened further. OUTPUT “You found it out!”

FOR count = 1 to 100


OUTPUT count
NEXT count

23
Module 3 – Abstraction and Algorithms

Flowchart Constructs Data (Input/Output)


- Terminator
- Decision
- Data (Input/Output)
- Process

Terminator

Parallelogram-shaped symbol; with either the


“INPUT” or “OUTPUT” commands.

Process

Pill-shaped symbol with the “START” or “STOP”


command.

Decision

Rectangular symbol; with a step or steps involving


an action or operation.

Diamond-shaped symbol with the format “Is


<condition>?”.

24
Module 4 – Programming
Module 4 Definitions 10. Concatenation

Programming 1. Instruction Set


Joining two sequences to make a longer sequence

Set of basic commands or instructions that a 11. Control Flow Statement


This module is about application and development of
logical thinking and reasoning, as well as problem-solving processor can understand directly, represented in Programming instruction that changes the order in
skills through the design and development of software byte form which other instructions are run
solutions using programming language(s). An algorithm Example: Python if-elif-else statement
describes a solution independent of a programming 2. Machine Code
language while a programming language depicts the Instructions that can run directly on a computer’s
solution that is workable on a computing device.
12. Test Case
processor A set of inputs and the corresponding set of
expected outputs for a particular program used to
3. Program verify whether the program works as intended
Set of instructions written to perform specific
tasks on a computer 13. Testing
Process by which defects in a program can be
4. Programming Language detected
Language designed for humans to communicate
instructions to computers 14. Module
Collection of variables and functions that need to
5. Source Code be loaded before they can be used
Instructions written in a programming language
that both humans and computers can understand 15. Character
A unit of information for strings, usually a symbol,
6. Syntax letter or digit.
Rules that determine how the words and symbols
in a valid instruction are arranged 16. Check Digit
Digit or letter that is added to a sequence of digits
7. Compiler to detect errors in manual input
Code translator program that translates source
Definitions 25 code into machine code completely before running 17. Data Validation
the compiled program Process of ensuring that the input data supplied to
Development 26
Stages of Program Development 26 a system satisfies a set of rules such that it is
8. Interpreter sensible, complete and within acceptable
Data Validation Techniques 27
Code translator program that translates source boundaries.
Debugging/Testing 27 code into machine code while the interpreted
Test Cases 27 program is running 18. Length Check
Debugging Techniques 27 Process of ensuring that input data is not too short
Types of Program Errors 27 9. Type Casting or too long
Process of converting a value from one data type
Translators (Compiler vs Interpreter) 28
to another
Python 3.5 Cheatsheet 28
25
Module 4 – Programming
19. Range Check 29. Error Conditions (programming)
Plan solutions
Process of ensuring that input data is within the Situations where input data would normally be
required range of values rejected by the program
Tasks that may be done at this stage:
20. Presence Check 30. Bug
- Manually solving di erent simplified examples
Process of ensuring that all the required inputs are Defect in a program that causes it to behave in an
of the problem and generalising the steps
provided unintended manner
needed to produce the required output
21. Format Check 31. Debugging
- Trying di erent ways to break down the
Process of ensuring that input data matches a Process of identifying and removing defects from a
problem into smaller parts such that the
required arrangement or pattern program intended output of each part gets closer and
closer to what is needed to solve the problem
22. Crash Development
Sudden stop of a program due to an error - Comparing the problem (or its smaller parts)
Stages of Program Development to other problems that have been solved
23. Hang 1. Gather requirements before and identifying which algorithms can
Unresponsiveness of a program due to an error 2. Plan solutions be used
3. Write code
24. Run-time Error 4. Test and refine code - Estimating the amount of e ort needed to
Error that occurs while the program is running 5. Deploy code write the code or the time needed to
complete the algorithm before making a
25. Logic Error definite choice
Gather Requirements
Error that causes the output of a program to be
di erent from what is expected - Writing possible algorithms using either
Tasks that may be done at this stage: flowcharts or pseudo-code
26. Syntax Error
Result of incorrect source code that does not - Interviewing the intended audience of the
Write code
follow the rules of the language program to understand the nature of the
problem or their expectations
The goal of this stage is to write code that
27. Normal Conditions (programming) performs the algorithm as planned in the previous
- Specifying the complete set of inputs that is
Situations where input data follows what is stage as e ciently as possible.
necessary for the problem and how the
expected during normal use of the program
inputs can be supplied to the program being
developed
28. Boundary Conditions (programming)
Situations where input data is at the limit of what - Specifying the complete set of outputs that is
the program is designed to cope with or where necessary for the problem and the format for
special handling is required the output

26
Module 4 – Programming

Test and refine code Data Validation Techniques Debugging Techniques


1. Length check 1. Use intermittent print statements
After the initial code is written, the resulting program Example: Ensure length of string is 8 One simple yet e ective debugging technique
is likely to require further refinement. Some possible characters is to keep track of how variables change as
reasons for this: the program runs using the print() function.
2. Range check
- The programmer may have made mistakes in Example: Ensure integer is a whole positive By adding a print statement that outputs the
translating the planned algorithm into code or number between 0 to 100 inclusive value of important variables inside a loop, we
may have forgotten to consider exceptional are able to get valuable information of how
cases where the input would need to be 3. Presence check the variables change over time, just like what
treated specially. Example: End loop if string is empty we were able to do with trace tables for
Example: Syntax error, other minor errors 4. Format check flowcharts.
Example: Check if string can be type casted
- The solution-planning stage may not have to an integer using str.isdigit() 2. Testing the program in parts or chunks
been performed properly, resulting in an Decomposing the program into smaller parts
unsuitable or incomplete algorithm. Definitions for the techniques are provided in the and test the parts one at a time. This allows
It may be possible to keep most of the “Definitions” sub-unit of this Unit. us to narrow down the possible locations of
written code after refinements. any bugs and reduce the amount of code that
Debugging/Testing we need to study at any one time.
- The requirement-gathering stage may have
been incomplete, resulting in code that does Test Cases See Module 3 Item “Decomposition” for
not actually solve the problem. decomposition approaches.
To detect run-time errors and logic errors, it is
This may result in the inability to reuse most
important to run the programs that we write
of the written code.
through multiple test cases. The test cases should
cover three types of conditions:
Deploy code
For the provided examples, let’s say we have an
algorithm that only accepts whole numbers from 1 to
Tasks that may be done at this stage:
100 inclusive. (0 ≤ x ≤ 100)
- Training users to use the program
1. Normal conditions
Example: 50 (Within 1-100 range)
- Transitioning from an old program or system
to the new program
2. Error conditions
Example: 101 (Outside of 1-100 range)
- Evaluating the e ectiveness of the program in
solving the problem and considering any
3. Boundary conditions
changes that might increase its usability or
Example: 1 (Lower boundary of 1-100 range)
e ectiveness

Definitions for the conditions are provided in the


“Definitions” sub-unit of this Unit.
27
Module 4 – Programming

Types of Program Errors Translators (Compiler vs Interpreter) Compiler


1. Syntax errors When we use a programming language, the source
Advantages Disadvantages
2. Run-time errors code must be translated into machine code before it
3. Logic errors can be run. - The resulting program - Any changes to the
runs at a faster speed source code require
Syntax Errors because all the recompilation before
translation has been taking e ect.
When are they detected? What causes them? done beforehand.
- Compilers usually do
When the compiler or Spelling mistakes or the - The compiler is not not o er an interactive
interpreter tries to incorrect sequence of needed to run the mode.
translate the source symbols in source code program after
There are two ways by which source code is compilation is complete.
code to machine code
translated:
- Syntax errors are
Run-time Errors 1. Compiler detected before the
A code translator program, called a compiler, program is even run.
When are they detected? What causes them? reads the source code, performs the
translation once, and then stores the
While the program is Incorrect use of translated machine code in the computer Interpreter
being run commands, input data
that has not been Advantages Disadvantages
2. Interpreter
properly validated or
A code translator program, called an - Changes to the source - The resulting program
conditions occurring
outside of the program’s interpreter, runs every time the program code take e ect runs at a slower speed
control (such as running starts. The interpreter reads the source code immediately. because translation
out of memory) while the program is running and either occurs while the
performs on-the-spot translation or - Interpreters usually program is running.
determines which part of its own machine o er an interactive
Logic Errors code to run. mode, which facilitates - The interpreter needs
learning and to be run every time the
When are they detected? What causes them? experimentation. program is started.

While the program is Use of an incorrect or - Syntax errors may


being run incomplete algorithm interrupt the running of
a program.

Python 3.5 Cheatsheet


See the “Additional Materials” Unit at the back of
these notes for the cheat sheet!

28
O-Level Computing Theory! – Additional Materials

Additional Materials

Excel Types and Functions Overview


Type Overview

Type Overview Example

General Used for data with no specific type or data is not known ahead of time ABC
123

Number Used for numbers 210.11


2996

Currency Used for money, typically displayed with a currency symbol or two decimal places $420.00

Date Used for dates 22/9/2022

Time Used for times and durations 11:56:58

Percentage Used for rates, ratios and proportions 99%

Text Used for textual information Hello!

Logical Value Used for Boolean data TRUE


FALSE

Function Overview
Area Function Example

Date and Time TODAY() TODAY() → 29/8/2022

Text LEN(text) LEN(“abc”) → 3

LEFT(text, [num_chars]) LEFT(“abcdef”) → “a”


LEFT(“abcdef”, 3) → “abc”

MID(text, start_num, num_chars) MID(“abcdef”, 3, 2) → “cd”

RIGHT() RIGHT(“abcdef”, 3) → “def”

Logical AND(...) AND(TRUE, FALSE) → FALSE

29
O-Level Computing Theory! – Additional Materials

IF(x, y, z) IF(9>10, “Yes”, “No”) → “Yes”

NOT(...) NOT(TRUE) → FALSE

OR(...) OR(FALSE, FALSE, TRUE) → TRUE

Lookup HLOOKUP(value, range, row, [approx]) [see external references]

VLOOKUP(value, range, column, [approx]) [see external references]

Mathematical CEILING.MATH(number, [significance], [mode]) CEILING.MATH(1.1) → 2

FLOOR.MATH(number, [significance], [mode]) FLOOR.MATH(1.9) → 1

SQRT, POWER, MOD, QUOTIENT [self explanatory]

RAND RAND() → 1.54389746113231648134…

RANDBETWEEN(bottom, top) RANDBETWEEN(1, 10) → 10

SUM(range, [range, …]) SUM(A1:B20) → 420

SUMIF(range, condition, [range, condition, …]) SUMIF(A1:A20, “<10”) → 69

Statistical AVERAGE, MEDIAN, MODE.SNGL, MAX, MIN [self explanatory]

LARGE(array, k) [returns kth largest value in array]

SMALL(array, k) [returns kth smallest value in array]

COUNT(value1, [value2, …]) [count all numeric values]

COUNTA(value1, [value2, …]) [count all non-empty values]

COUNTBLANK(value1, [value2, …]) [count all empty values]

COUNTIF(range, condition) [count in range if condition is met]

30
O-Level Computing Theory! – Additional Materials

Additional Materials For Loop (Iteration)


4. String Methods
Python 3.5 Cheatsheet for <variable> in range(...):
<code> .format(...)
1. Absolute Basics
2. Data Types See Section 8, “Useful Built-in Functions”, for more Replaces {} in text with given argument(s)
3. Operators information about the range() function.
4. String Methods s = "{} McSpicy"
5. List Operators and Methods print(s.format("Double")) # ‘Double McSpicy’
2. Data Types
6. List Indexing and Slicing
7. String Indexing and Slicing .isalnum()
8. Useful Built-in Functions Examples
9. random Module Returns True if all characters are part of the
this_is_a_boolean = True # bool() alphabet (A-Z) or is numeric (0-9)
10. math Module this_is_a_boolean = False # bool()
this_is_a_integer = 9 # int()
"hello1234!".isalnum() # False (!)
1. Absolute Basics this_is_a_float = 4.2 # float()
"hello1234".isalnum() # True
this_is_a_string = "Oreo McFlurry" # str()
this_is_a_list = [1, True, "3"] # list()
Python Script/Source Code File (.py) .isalpha()
Type Casting
Python script files are plain text files that end Returns True if all characters are part of the
with “.py”. Lines of code are executed/run from Type casting is the conversion of a value from one alphabet (A-Z)
the first line to the last. (top-down) type to another.
"hello1234".isalpha() # False (1234)
Comments "hello".isalpha() # True
two = int("1") + int(1.0)
msg = "You scored " + str(10) + " points!"
Comments are parts of code that are not .isdigit()
executed/run by Python and are ignored, this is
useful for notes. 3. Operators Returns True if all characters are digits (0-9)

# this is a comment as it starts with a “#” "hello".isdigit() # False (hello)


print(2 ** 3) # 8 - exponent "1234".isdigit() # True
If-Elif-Else Statements (Selection) print(22 % 8) # 6 - modulus/remainder
print(22 // 8) # 2 - integer division
.lower()
if <condition 1>: print(22 / 8) # 2.75 - division
<condition 1 code> print(3 * 3) # 9 - multiplication
Returns string with all lowercase characters
elif <condition 2>: print(5 - 2) # 3 - subtraction
<condition 2 code> print(2 + 2) # 4 - addition
s = "AAAAA!!"
else:
print(s.lower()) # ‘aaaaa!!’
<fallback code>

While Loop (Iteration)

while <condition>:
<code>

31
O-Level Computing Theory! – Additional Materials

.upper() .pop(index) Format: “[start:stop:step]”.

Returns string with all uppercase characters Removes element at index index from the list. Unused/unspecified values can be skipped, but
you must keep the colon!
s = "aaaaa!!" list = [1, 2, 3]
print(s.upper()) # ‘AAAAA!!’ list.pop(0) my_list[0:2] # ["someone", "in"]
print(list) # [2, 3] my_list[0:5:2] # ["someone", "early"]
.split(separator) my_list[::-1] # ["20s", "early", "in",
.count(element) "someone"]
Advanced – split a string using the separator.
separator defaults to an empty string, returning Counts total number of element in the list.
7. String Indexing and Slicing
a list of each character. If the separator
argument is given, the string will be split with the list = ["banana", "banana", "apple", "banana"]
given separator. list.count("banana") # 3 Indexing and slicing operations on strings are
identical to those on lists. A good way to visualise
s = "abcde" this is to see strings as a list of one-character
6. List Indexing and Slicing
s.split() # ["a", "b", "c", "d", "e"]
strings. (e.g. "hi" == ["h", "i"])
s.split("c") # ["ab", "de"]
Elements in a list start with the index 0, and
s = "Godot"
5. List Operators and Methods increase with each element in the list. Using print(s[0:3]) # ‘God’
negative numbers allows you to start counting print(s[0:3:2]) # `Gd`
backwards. print(s[::-1]) # ‘todoG’
in
my_list = [
Membership operator. Checks if an element is in "someone", # index 0 (-4) 8. Useful Built-in Functions
the list. "in", # index 1 (-3)
"early", # index 2 (-2) print(...)
my_list = [1, 2, 3] "20s", # index 3 (-1)
1 in my_list # True ]
Print variables and values out
4 in my_list # False
You can access an element in a list using its’
print("J’ai", 16, "age") # ‘J’ai 16 age’
.append(element) index.
input(...)
Appends element to the end of the list. print(my_list[0]) # ‘someone’
print(my_list[-1]) # ‘20s’
Prompt user for input
my_list = [1, 2, 3]
my_list.append(4) Accessing certain parts of a list is called “Slicing”.
song = input("What are you listening to? ")
print(my_list) # [1, 2, 3, 4] Three values can be used for slicing:
min(iterable)
- Start: Index to start the slice range
- Stop: Index after end of slice range. Finds and returns the smallest element in
Defaults to list length. iterable.
- Step: Get every nth element. Defaults to 1.
result = min([1, 200, 199]) # 1
32
O-Level Computing Theory! – Additional Materials

max(iterable) round(number, ndigits=0) Output:

Finds and returns the biggest element in Round number to nearest ndigits (default 0; whole 0 potatoes
iterable. number) 1 milk
2 eggs
result = max([1, 200, 199]) # 200 print(round(0.96)) # 1
print(round(0.96, 1)) # 1.0 zip(
sum(iterable) iterable1,
abs(x) iterable2,
Returns sorted iterable. ...,
Return absolute value of number x strict=False
total = sum([7, 3, 8, 4]) # 22 )
print(abs(-9)) # 9
sorted(iterable) Advanced – Iterates through argued iterables and
ord(x) yields multiple values, one from each iterable.
Returns sorted iterable.
Returns ASCII/Unicode code point integer from In cases where the iterables are not of equal
sorted_list = sorted([7, 4, 5]) # [4, 5, 7] character x length, keyword argument strict should be set to
True, which will end when one of the iterables
len(iterable) print(ord("a")) # 97 reaches its’ end.

Returns length of iterable/a string. chr(i) Code:

str_len = len("abcdef") # 6 Returns character as string from ASCII/Unicode stuff = ["potatoes", "milk", "eggs"]
list_len = len([1, 2, 3, 4]) # 4 code point integer i prices = [10.0, 6.0, 16.0]
for item, price in zip(stuff, prices):
range(...) print(chr(97)) # ‘a’ print(item, price)

Used in for loops. Just like slicing, start, stop and enumerate(iterable, start=0) Output:
step values can be used.
Advanced – Iterates through iterable, yielding 10.0 potatoes
for i in range(5): # start 6.0 milk
two values: index and value. Start index value can
print(i) # 0, 1, 2, 3, 4 16.0 eggs
be specified using start keyword argument.
for i in range(2, 5): # start, stop
print(i) # 2, 3, 4 Code:

for i in range(2, 5, 2): # start, stop, step stuff = ["potatoes", "milk", "eggs"]
print(i) # 2, 4 for i, v in enumerate(stuff):
print(i, v)

33
O-Level Computing Theory! – Additional Materials

9. random Module

Use the random module by importing it (You only


have to import this once per module/file.):

import random

random.randint(start, stop)

Returns a random integer between start and


stop inclusive.

10. math Module

Use the random module by importing it (You only


have to import this once per module/file.):

import math

math.ceil(x)

Return the ceiling of x.

math.floor(x)

Return the floor of x.

math.pow(x, y)

Return x to the power of y. Same as x**y.

math.sqrt(x)

Return the square root of x.

math.trunc(x)

Return truncated x as an integer.

34

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy