0% found this document useful (0 votes)
3 views59 pages

Introduction To Computer

The document provides an introduction to computers, detailing their functions, components, and types, including hardware and software distinctions. It explains the input-process-output model, the role of operating systems, and the importance of memory types such as RAM and ROM. Additionally, it covers computer science concepts, computational thinking, and data storage methods, emphasizing the significance of binary representation.

Uploaded by

rayanm1208
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)
3 views59 pages

Introduction To Computer

The document provides an introduction to computers, detailing their functions, components, and types, including hardware and software distinctions. It explains the input-process-output model, the role of operating systems, and the importance of memory types such as RAM and ROM. Additionally, it covers computer science concepts, computational thinking, and data storage methods, emphasizing the significance of binary representation.

Uploaded by

rayanm1208
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

INTRODUCTION

TO
COMPUTER

Mohammed Hamdaan
31/12/2022
WHAT IS A COMPUTER?
A Computer is an electronic machine or device that performs calculations
and operations on input data based on instructions provided by a software
or a hardware program
It has the ability to accept data, process it, and then it produces an output
It has the ability to store, retrieve, and delete data
You can use a computer to create documents, send email, watch movies,
develop Software programs, develop building plans, browse the Web
INPUT, PROCESS AND OUTPUT
 All the parts in a computer can be divided in 2 groups which are
output and input
 A computer receives an input, processes the
information(program + input data), then produces an output
 Input: Input is the information or data that is fed into the
computer via an input device such as a Keyboard, IO port,
camera, mouse, scanner
 Input captures the data from user, or it is the process of
accepting data or information, by using input the computer can
do any process
 Process: It is the program that processes the input data to
produce a desired output
 Output: This is the info that comes out of the computer as a
result from processing. The output is displayed on a screen
(monitor) or passed on to an output device such as a Printer
WHAT IS A HARDWARE AND A SOFTWARE?
Computer hardware
 Hardware is the physical components of the computer, such
as the central processing unit (CPU), hard disk, monitor,
mouse and keyboard
 It also includes all the parts inside the computer case, such as
the hard disk drive, motherboard, video card, and many others
 Computer hardware is what you can physically touch

Computer software
 Software is the programs that run on a computer.
 Computer software, also called software, is a set of
instructions and its related documentations that tells a
computer what to do or how to perform a task
 Software includes all different software programs on a
computer, such as applications(MS Office, Paint, Anti virus)
and the operating system (Windows, Apple OS, MAC OS,
Linux, Solaris, Android)
INPUT, PROCESS AND OUTPUT
Input Devices Processing device Output Devices

 Keyboard  Monitor

 Scanner  Printer

 Mouse
CPU  Headphone

 Microphone  Speaker

 Camera  Headset
WHAT IS AN OPERATING SYSTEM?
 An operating system is an interface between the user and the computer hardware
 An operating system is a software that manages computer hardware
 Operating system is the one program running at all times on the computer
 An operating system is concerned with the allocation of resources and services, such as
memory, processors, devices, and information.
 An operating system (OS) is system software that manages computer hardware, software
resources, and provides common services for computer programs
 Examples of OS devices are: Window 7, Windows 8, Windows 10, Android, IOS, MacOS, Disk
operating systems (DOS) Windows XP
WHAT ARE THE IMPORTANT PARTS OF A COMPUTER?
The 5 Most Important Parts of A Computer are:
• The Motherboard.
• The Central Processing Unit (CPU)
• RAM & ROM

The Motherboard-
The motherboard is the backbone that ties the computer's components
together in one spot and allows them to talk to each other. Without it,
none of the computer pieces, such as the CPU, GPU, or hard drive, could
interact. Total motherboard functionality is necessary for a computer to
work well.
ALU (arithmetic & logic Unit)-
The ALU performs simple addition, subtraction, multiplication, division,
and logic operations, such as OR and AND. The memory stores the
program's instructions and data.
WHAT ARE THE IMPORTANT PARTS OF A COMPUTER?
The CPU-
The computer's central processing unit (CPU) is the portion of a
computer that retrieves and executes instructions. The CPU is
essentially the brain of a CAD system. It consists of an arithmetic and
logic unit (ALU), a control unit, and various registers. The CPU is often
simply referred to as the processor.

The Hard Disk-


A hard drive is the hardware component that stores all of your digital
content. Your documents, pictures, music, videos, programs, application
preferences, and operating system represent digital content stored on a
hard drive.

The Graphics Card-


A graphics card provides a high-quality visual display by processing and
executing graphical data using advanced graphical techniques, features
and functions. A graphics card is also known as a graphics adapter,
graphics controller, graphics accelerator card or graphics board.
PARTS AND FUNCTIONS OF THE CPU
All computers Must have a CPU and at least 1 input device that gets data from the
real world. This could be a mouse and keyboard on a conventional PC or a
temperature sensor. Input devices take real-world data and convert it into a form that
can be stored on the computer. The input from these devices is processed and the
computer will generate outputs. The output device could be a conventional computer
screen or a speaker. The fourth component is
WHAT ARE THE ONLINE DANGERS?
TYPES OF COMPUTERS
These are three different computer types classified according to their
performance, power, and sizes

Minicomputers
 Minicomputers are small Computers that are more powerful
compared to personal computers, but they are less powerful if
we compare them with mainframe or supercomputers
 The minicomputer is designed to fulfil the computing needs of
several people in a small to a medium-sized business
environment
 The first minicomputer was developed by IBM

Supercomputers
 Supercomputers are the computers that are most powerful in
the world and are primarily used for complex scientific
calculations
 These computers are capable of processing trillions of
instructions per second Mini computer
TYPES OF COMPUTERS CONTINUED

 A supercomputer has a capacity of 200 to 300 gigabytes or more


 Although their components are like the desktop computer, but
their processing speed is very high that is why they are primarily
used for engineering problems and scientific calculations
 They can perform complex tasks quickly and efficiently
 In 2003, India developed a supercomputer

Microcomputer
 A microcomputer was created in January 1971 by a team of logic
architects and silicon engineers—Federico, Marcian (Ted) Hoff, Supercomputers
Stanley Mazor, and Masatoshi
 A small personal computer with a microprocessor as a central
processor is an example of a microcomputer
 Microcomputer, an electronic device with a microprocessor as
its central processing unit (CPU)
 Microcomputer was formerly a commonly used term for personal
computer, particularly any of a class of small digital computers
Microcomputer
WHAT IS THE INSTRUCTION CYCLE?
The main job of the CPU is to execute programs using the fetch-decode-execute cycle (also
known as the instruction cycle).
This cycle begins as soon as you turn on a computer.
To execute a program, the program code is copied from secondary storage into the main
memory.
All computer software is built up of sets of instructions.
Instructions are encoded in binary.
The fetch-decode-execute cycle is the sequence of steps that the CPU follows to process
instructions.
WHAT IS BIOS?
 BIOS (basic input/output system) is the program a computer's microprocessor uses to start
the computer system after it is powered ON
 BIOS is the first program to run when the computer is turned ON
 It also manages data flow between the computer's operating system (OS) and attached
devices, such as the hard disk, video adapter, keyboard, mouse and printer
 The BIOS is a computer program embedded on a chip in a computer’s ROM
 Normally the BIOS chip is located in the ROM but in the modern computer systems, the BIOS
contents are stored on a flash memory chip so that the contents can be rewritten without
removing the chip from the motherboard.
 The BIOS software has a number of different roles, but its most important role is to load the
operating system
 When users turn on their computer, the microprocessor passes control to the BIOS program,
which is always located at the same place on EPROM
COMPUTER SCIENCE
Computer science is a very large subject with lots of applications. Computer Science is the
study of computers and computational systems. Computer scientists design new software,
solve computing problems and develop different ways to use technology. Computer
scientists deal mostly with software and software systems; this includes their theory,
design, development and application.

What is computational thinking?


Computational thinking involves looking at a problem and working out a way a
computer might be able to help you solve it. To do this, you need to understand
how a computer processes information. You probably use computational
thinking at school too, but don’t realise it. If you analyse a problem and plan out
the solutions, you are using computational thinking.

Using computational thinking


A programmer, coder or software engineer is someone who designs and makes
computer programs. They might use one type of computer language or many.
They use computational thinking all the time. Programmers are logical
thinkers and problem-solvers. They look at problems and try to come up with
different ways of solving them. There is often more than one way to solve a
problem and coders try to find the most efficient way. This could mean finding
the solution to the problem which requires the least number of steps.
COMPUTER SCIENCE
What is computer technology?
The technologies that computer scientists produce are all around us. Think about
all the technology that you encounter in your day:
▪ The tablet you were using to watch a video after breakfast has been
programmed.
▪ The traffic lights on the pedestrian crossing you used to get to school have been
programmed to help you get safety across the road.
▪ The bus you took to go swimming after school has an engine management
system that is programmed.
▪ The CCTV camera that was watching you in the supermarket has been
programmed to move automatically and store images.

Future innovations
Technology advances constantly and people are always working on new and
inventive ways to use it. These include hardware innovations like wearable
technology such as smart watches, new interface methods and new
software such as voice recognition, machine translation and predictive analytics.
Being able to think logically and come up with solutions to problems are useful
skills in all professions.
STORAGE IN A COMPUTER
1 byte = 8 bits
 KB = Kilobyte = 1000 bytes
 MG = Megabyte = 1,000,000 bytes
 GB = Gigabyte = 1,000,000,000 bytes
 TB = Terabyte = 1,000,000,000,000 bytes
 RAM cards (Random Access Memory) will remember
whatever is said to them and can even change to
remember new information. But, when the computer is
turned off it forgets everything. That’s why you need to
save your work.
 ROM (Read-Only Memory) is good at remembering
things, but cannot change its mind. It holds information
that was built into it.
COMPUTER MEMORY
Memory is an essential element of a computer. Without its memory, a computer is of hardly any use.
Memory plays an important role in saving and retrieving data. Memory is of the following types -
Primary Memory and Secondary Memory.

Primary Memory:
Primary Memory is an internal memory of the computer. RAM and ROM both form a part of primary
memory. The primary memory provides the main working space for the computer.

Random Access Memory (RAM):


RAM is primary-volatile memory. This is referred to as Random access memory (RAM) because it is
possible to randomly access (read/write) any location directly. It is also called read/write memory. It
contents disappear from RAM as soon as the power to the computer is switched off. The memories
which lose their content on the failure of the power supply or when the power is switched off, are
known as volatile memories. Hence RAM is volatile memory.

Read-Only Memory (ROM):


The contents of ROM can only be read by the CPU but cannot be changed. The storage of programs
and data in the ROM is permanent. The ROM stores some standard programs supplied by the
manufacturers to operate the personal computer – Ex BIOS. The basic input/output (BIOS) program is
stored in the ROM that examines and initializes various equipment attached to the PC when the power
switch is ON. The memories which do not lose their content on the failure of power supply, are known
as non-volatile memories. Hence, ROM is non-volatile memory.

PROM:
There is another type of primary memory in computer, which is called Programmable Read Only
Memory (PROM).
COMPUTER MEMORY CONTINUED
PROM continued:
You know that it is not possible to modify or erase programs stored in ROM, but you can store your
program in a PROM chip. Once the programs are written they cannot be changed and remain intact
even if the power is switched off. Therefore, programs or instructions are written in PROM or ROM
cannot be erased or changed.

EPROM (erasable programmable read-only memory) :


This stands for Erasable Programmable Read-Only Memory, which overcomes the problem of PROM
& ROM. EPROM chips can be programmed time and again by erasing the information stored earlier in
them. When the EPROM is in use information can only be read. The content of EPROM is erased by
using UV rays through a device known as an EPROM eraser. EPROM programmers are used to
writing data onto the EPROM

EEPROM (electrically erasable programmable read-only memory):


EEPROM is a non-volatile flash memory. Data saved in an EEPROM chip can be re-flashed. The
content of EEPROM is erased by using electric signals. EEPROM is used in computers, integrated into
microcontrollers for smart cards and remote keyless systems, and other electronic devices to store
relatively small amounts of data by allowing individual bytes to be erased and reprogrammed
Secondary Memory / Non-Volatile Memory:
Secondary memory consists of all permanent or persistent storage devices, such as read-only
memory (ROM), flash drives, hard disk drives (HDD), magnetic tapes, and other internal/external
storage media types. In computing operations, secondary memory is accessed only by the primary
memory and later transported to the processor.
COMPUTER MEMORY CONTINUED
Secondary Memory / Non-Volatile Memory:
Secondary memory is slower than primary memory but can store and retain data, even
if the computer is not connected to electrical power. It also has substantial storage
capacities, ranging from megabytes to several terabytes of storage space within single
memory. Secondary memory is external and permanent in nature. The secondary memory is
concerned with magnetic memory. Secondary memory can be stored on storage media like
floppy disks, magnetic disks, magnetic tapes, This memory can also be stored optically on
Optical disks - CD-ROM.
WHAT IS A MICRO: BIT?
The Micro: bit is a mini-computer. You can write programs and transfer them to the micro: bit to be
run. The micro: bit can be programmed to do a number of different things, it can be a digital watch,
fitness tracker or a games console. The device features 25 LED lights and two programmable
buttons, which can be used in game-play or to skip through tracks in a playlist.
Parts if the Micro: bit
The buttons are a very common input device. Your micro: bit has two buttons you can program, and a
reset button.
An LED or light-emitting diode is an output device that gives off light. Your BBC micro: bit has a
display of 25 LEDs for you to program.
A processor is sometimes called the ‘brains’ of a computer and your BBC micro: bit has a
microprocessor inside it. It’s an essential part of your micro: bit as it runs the programs you write.
HOW IS DATA STORED ON A COMPUTER
 Data in a computer is stored in Binary format
 The binary number system used in computers consists of only two digits: 0 & 1
 Binary numbers use two digits, 0 and 1, to represent all possible values
 Conventional numbers use ten digits, from 0-9, to represent all possible values.
 Binary to decimal conversion can be done in the simplest way by adding the
products of each binary digit with its weight (which is of the form - binary digit × 2
raised to a power of the position of the digit) starting from the right-most digit
which has a weight of 20.
What is Binary to Decimal Conversion?
 Binary to decimal conversion is done to represent a number given in binary
number system to its equivalent in the decimal number system.
 Every number system has a base and the base of a number system is determined
by the total number of digits used in the number system. For example, the binary
number system has a base of 2 because it has only two digits to represent any
number. Similarly, the decimal number system has a base of 10, as it has 10 digits
to represent a number.
Binary to Decimal Conversion Methods
 Binary to decimal conversion is done to help read large binary numbers easily in a
form that humans can understand.
 There are two methods to convert a number in binary to decimal number system.
 Positional Notation Method
 Doubling Method
HOW TO CONVERT A BINARY CODE TO A DECIMAL USING THE
POSITIONAL METHOD
Step 1:
List out the powers of 2 for all the digits starting from the rightmost position. The first power would be 20 and as we
move on it will be 21, 22, 23, 24, 25,... In the given example, there are 6 digits, therefore, starting from the rightmost
digit, the weight of each position from the right is 20,21,22,23,24,25

Step 2:
Now multiply each digit in the binary number starting from the right with its respective weight based on its position and
evaluate the product. Observe the figure shown below to relate to the step. Finally, sum up all the products obtained for
all the digits in the binary number

Step 3:
Now, express the binary number as a decimal number: (101101)2(101101)2 = (45)10
HOW TO CONVERT A BINARY CODE TO A DECIMAL USING THE
DOUBLING METHOD
Step 1:
Write the binary number and start from the left-most digit. Double
the previous number and add the current digit. Since we are starting
from the left-most digit and there is no previous digit to the left-most
digit, we consider the double of the previous digit as 0. For example
in (101101)2(101101)2, the left-most digit is '1'. The double of the
previous number is 0. Therefore, we get ((0 × 2) + 1) which is 1

Step 2:
Continue the same process for the next digit also. The second digit
from the left is 0. Now, double the previous digit and add it with the
current digit. Therefore, we get, [(1 × 2) + 0], which is 2

Step 3:
Continue the same step in sequence for all the digits. The sum that is
achieved in the last step is the actual decimal value. Therefore, the
result of converting the binary number (101101)2(101101)2 to a
decimal using the doubling method is 4510
BINARY CODE DECIMAL NUMERS Hexa Decimal BINARY CODE DECIMAL NUMERS Hexa Decimal BINARY CODE DECIMAL NUMERS Hexa Decimal

0000 0 0x00 0001 0000 16 0x10 0010 0000 32 0x20

0001 1 0x01 0001 0001 17 0x11 0010 0001 33 0x21

0010 2 0x02 0001 0010 18 0x12 0010 0010 34 0x22

0011 3 0x03 0001 0011 19 0x13 0010 0011 35 0x23

0100 4 0x04 0001 0100 20 0x14 0010 0100 36 0x24

0101 5 0x05 0001 0101 21 0x15 0010 0101 37 0x25

0110 6 0x06 0001 0110 22 0x16 0010 0110 38 0x26

0111 7 0x07 0001 0111 23 0x17 0010 0111 39 0x27

1000 8 0x08 0001 1000 24 0x18 0010 1000 40 0x28

1001 9 0x09 0001 1001 25 0X19 0010 1001 41 0X29

1010 10 0x0A 0001 0110 26 0x1A 0010 1111 42 0x2A

1011 11 0x0B 0001 1011 27 0x1B 0010 1011 43 0x2B

1100 12 0x0C 0001 1100 28 0x1C 0010 1100 44 0x2C

1101 13 0x0D 0001 1101 29 0x1D 0010 1101 45 0x2D

1110 14 0x0E 0001 1110 30 0x1E 0010 1110 46 0x2E

1111 15 0X0F 0001 1111 31 0x1F 0010 1111 47 0x2F


1. Algorithm, Flowcharts And Pseudocode
2. Data representation
3. Programming
4. Networking
5. Cybersecurity
6. Social media
What is an Algorithm?
• An algorithm is a set of commands that must be followed for a computer to perform calculations or other problem-
solving operations.
• According to its formal definition, an algorithm is a finite set of instructions carried out in a specific order to perform
a particular task.
• It is not the actual program or code; it consist of a sequence of instructions, often written in an user friendly
language, such as English, to solve a well defined problem.
• Algorithm written in an English like language can be translated into any computer programming language such as
Python, C++ and etc
Characteristics of an Algorithm
What is an Algorithm?
.• Input: An algorithm requires some input values. An algorithm can be given a value other than 0 as input.
• Output: At the end of an algorithm, you will have one or more outcomes.
• Unambiguity: A perfect algorithm is defined as unambiguous, which means that its instructions should be
clear and straightforward.
• Finiteness: An algorithm must be finite. Finiteness in this context means that the algorithm should have a
limited number of instructions, i.e., the instructions should be countable.
• Effectiveness: Because each instruction in an algorithm affects the overall process, it should be
adequate.
• Language independence: An algorithm must be language-independent, which means that its instructions
can be implemented in any language and produce the same results.
Fundamentals of algorithms
Basics of algorithms
An algorithm is a set of instructions that describes how to solve a problem. Algorithms can be designed using pseudo-
code and/or flowcharts. They are written using English statements and expressions.
Whether algorithms are designed with pseudo-code or flowcharts, the focus is on the logic of the steps instead of
the programming language because programmers should be able to translate an algorithm into any programming language, for
example, from Python to C++. This is known as being language independent.

Pseudo-code
Pseudo-code is a simple way of describing a set of instructions in a manner that resembles a programming language. In an
algorithm, most processes fall into three main categories:
• Inputs
• Processes
• Outputs
When pseudo-code is being written, inputs, processes and outputs can be identified using the keywords in the code.
For example, if a person was writing a program where a number is input and the program calculates and outputs the times table
up to ten, they could write a statement like this:
The user INPUTS a number which is saved as num FOR each number from 1 to 10, OUTPUT
num*number
This could be improved by writing the pseudocode:
num ← USERINPUT FOR number ← 1 TO 10 OUTPUT number * num ENDFOR
Factors of an Algorithm
• Modularity: This feature was perfectly designed for the algorithm if you are given a problem and break it down into
small-small modules or small-small steps, which is a basic definition of an algorithm.
• Correctness: An algorithm's correctness is defined as when the given inputs produce the desired output, indicating
that the algorithm was designed correctly. An algorithm's analysis has been completed correctly.
• Maintainability: It means that the algorithm should be designed in a straightforward, structured way so that when you
redefine the algorithm, no significant changes are made to the algorithm.
• Functionality: It takes into account various logical steps to solve a real-world problem.
• Robustness: Robustness refers to an algorithm's ability to define your problem clearly.
• User-friendly: If the algorithm is difficult to understand, the designer will not explain it to the programmer.
• Simplicity: If an algorithm is simple, it is simple to understand.
• Extensibility: Your algorithm should be extensible if another algorithm designer or programmer wants to use it.
Approaches of an Algorithm
Brute Force Algorithm
This algorithm uses the general logic structure to design an algorithm. It is also called an exhaustive search algorithm
because it exhausts all possibilities to provide the required solution. There are two kinds of such algorithms:
[Link]: Finding all possible solutions to a problem and then selecting the best one, will terminate if the best
solution is known.
[Link]: It will stop as soon as the best solution is found.

Divide and Conquer


This is a straightforward algorithm implementation. It enables you to create an algorithm in a step-by-step fashion. It
deconstructs the algorithm to solve the problem in various ways. It allows you to divide the problem into different
methods, generating valid output for valid input. This accurate output is forwarded to another function.

Greedy Algorithm
This is an algorithm paradigm that makes the best choice possible on each iteration in the hopes of choosing the best
solution. It is simple to set up and has a shorter execution time. However, there are very few cases where it is the best
solution.
Approaches of an Algorithm
Dynamic Programming
It improves the efficiency of the algorithm by storing intermediate results. It goes through five steps to find the best
solution to the problem:
1. It divides the problem into subproblems to find the best solution.
2. After breaking down the problem into subproblems, it finds the best solution from these subproblems.
3. Memorization is the process of storing the results of subproblems.
4. Reuse the result to prevent it from being recomputed for the same subproblems.
5. Finally, it computes the complex program's output.
Branch and Bound Algorithm
Only integer programming problems can be solved using the branch and bound algorithm. This method divides all
feasible solution sets into smaller subsets. These subsets are then evaluated further to find the best solution.
Randomized Algorithm
As with a standard algorithm, you have predefined input and output. Deterministic algorithms have a defined set of
information and required results and follow some described steps. They are more efficient than non-deterministic
algorithms.
Backtracking
It is an algorithmic procedure that recursively and discards the solution if it does not satisfy the constraints of the
problem. Following your understanding of what is an algorith, and its approaches, you will now look at algorithm
analysis.
Basis of algorithms
How to Write an Algorithm?
There are no well-defined standards for writing algorithms. It is, however, a problem that is resource-dependent.
Algorithms are never written with a specific programming language in mind. For Example:

Step 1 − Start
Step 2 − declare three integers x, y & z
Step 3 − define values of x & y
Step 4 − multiply values of x & y
Step 5 − store result of step 4 to z
Step 6 − print z
Step 7 − Stop
Fundamentals of algorithms
The ← symbol in pseudo-code means assignment. Most programming languages use = instead of ←. In the example above, num ←
USERINPUT means that the user input is being put into, or assigned to, the variable called num.
Outputs use the word OUTPUT before the data to be sent to the user. In the example above, the line OUTPUT number * num in
Python might look like print (number * num). Processing refers to any operation the computer system is performing on data, for
example doing a calculation or searching for something. In OUTPUT number * num, the program is actually performing a
calculation within the output, so it is possible to see statements which combine one or more of these.
Fundamentals of algorithms
Flowcharts
A flowchart is a diagram that shows an overview of an algorithm. Flowcharts use a variety of standard symbols to represent
different elements, and arrows to show the flow or direction. These symbols are used to construct the flowchart and show the
step-by-step solution to the problem.
Fundamentals of algorithms
Start

Input
“What is the
best subject”?

Answer = No Output – “Try


Maths ? again”

Yes

Output
“Yes, Stop
Offcourse!
Fundamentals of algorithms
Start

Input
2 numbers (a,b)

No

If a>b Output – “b is
the greatest”

Yes
Output
“A is the
greatest” Stop
Fundamentals of algorithms
Start

Input two
numbers (a, b)

Sum= a+b

Print sum Stop


Fundamentals of algorithms
Start

Input a Yes
If a>0 A is greater than 0
number (a)

No

Yes
If a=0 A is equal to 0

No

A is less than 0 Stop


Fundamentals of algorithms
Decomposition
Decomposition is breaking a problem down into smaller, more manageable chunks. In programming, this means breaking down
an algorithm into smaller problems that can be solved on their own.
For example, using the times table problem from the previous page, this could be broken down in the following way:

num ← USERINPUT
FOR number ← 1 TO 10
OUTPUT number * num
ENDFOR

In larger programs, problems are decomposed further until it is easy to identify how each could be written as an
individual subroutine in the program. This is useful to a development team, for example, as it means that the work can be
divided between them. As the problem has been broken down into smaller sections, the subroutines can be reused to solve
similar problems.
Decomposition is breaking a problem down into smaller, more manageable chunks.
Fundamentals of algorithms
Determining the purpose of simple algorithms
When given an algorithm, there are a number of ways to determine what the purpose of the algorithm is. Sometimes it is clear
as the algorithm is simple; however, at other times it is useful to ‘dry run’ the algorithm to see what is taking place.
Dry running an algorithm means to assign the values to variables of an algorithm and to do any processing that takes place
without translating it into code.

Trace tables
Trace tables enable the variable values in an algorithm to be recorded as the algorithm is dry run. For example, using the times
table algorithm below, a table could be created showing the value of the variables num and number as the program runs:
num ← USERINPUT FOR number ← 1 TO 10 OUTPUT number * num ENDFOR

Visual inspection
Some algorithms follow a pattern that can be recognised. Many of these are referred to as standard algorithms and often follow
a set pattern for searching for or sorting data. Sometimes it is clear what this is just by looking at the pseudo-code. For example,
the algorithm below follows a recognisable pattern for searching through each letter of a word and checking if the letter entered
matches. This would be a useful decomposed part of a hangman game.
guess ← USERINPUT FOR i ← 0 TO LEN(word) IF word[i] = guess THEN OUTPUT “found” ENDIF
ENDFOR
Fundamentals of algorithms
Efficiency of algorithms
Not all algorithms are made equal and it is a computer scientist’s job to consider the patterns and features that would find the
best solutions to problems.
For example, sorting data into alphabetical order could be completed using a number of different methods. The programmer
could choose to use bubble sort or merge sort, which are both standard sorting algorithms - but before choosing, it would be
important to know which would be most efficient. You can read more about sorting algorithms in the common algorithms guide.
Efficiency looks at how much time it takes to run a particular algorithm and how much space is needed. By using both
measurements, an algorithm that looks much more complex can actually be more efficient.
In the example of sorting data, the programmer might choose to look for the smallest piece of data and put that at the start of a
new array, then repeat the process until all the data has been removed from the original array. This would certainly solve the
problem, but there are better ways to reach the goal. These would be described as being more efficient.

Efficiency looks at how much time it takes to run a particular algorithm and how much space is needed.
Fundamentals of data representation
Character encoding
Computers work in binary. As a result, all characters, whether they are
letters, punctuation or digits are stored as binary numbers. All of the
characters that a computer can use are called a character set.
Two standard character sets in common use are: Hexadecima
Character Decimal Binary
• American Standard Code for Information Interchange (ASCII) l
• Unicode A 65 1000001 41

ASCII code Z 90 1011010 5A


ASCII uses seven bits, giving a character set of 128 characters. The
a 97 1100001 61
characters are represented in a table, called the ASCII table. The 128
characters include: z 122 1111010 7A
• 32 control codes - mainly to do with printing
• 32 punctuation codes, symbols, and space 0 48 0110000 30
• 26 upper case letters
9 57 0111001 39
• 26 lower case letters
• numeric digits 0-9 Space 32 0100000 20
We tend to say that the letter ‘A’ is the first letter of the alphabet, ‘B’
is the second and so on, all the way up to ‘Z’, which is the 26th letter. In ! 33 0100001 21
ASCII, each character has its own assigned number. For example:
Character encoding
Unicode
While suitable for representing English characters, 256 characters is far too small to hold every character in other languages,
such as Chinese or Arabic. Unicode uses 16 bits, giving a range of over 65,000 characters. This makes it more suitable for those
situations.
Unicode also allows us to represent additional characters that are more visual such as emojis and emoticons.

Representing images
Computers work in binary. All data must be converted into binary in order for a computer to process it. Images are no exception.
Important information
•Problem: A problem can be defined as a real-world problem or real-world instance problem for which you need to
develop a program or set of instructions. An algorithm is a set of instructions.
•Algorithm: An algorithm is defined as a step-by-step process that will be designed for a problem.
•Input: After designing an algorithm, the algorithm is given the necessary and desired inputs.
•Processing unit: The input will be passed to the processing unit, producing the desired output.
•Output: The outcome or result of the program is referred to as the output.

An algorithm has the following characteristics:


•Input: An algorithm requires some input values. An algorithm can be given a value other than 0 as input.
•Output: At the end of an algorithm, you will have one or more outcomes.
•Unambiguity: A perfect algorithm is defined as unambiguous, which means that its instructions should be clear and
straightforward.
•Finiteness: An algorithm must be finite. Finiteness in this context means that the algorithm should have a limited
number of instructions, i.e., the instructions should be countable.
•Effectiveness: Because each instruction in an algorithm affects the overall process, it should be adequate.
•Language independence: An algorithm must be language-independent, which means that its instructions can be
implemented in any language and produce the same results.
Programming
• A computer program consists of code that is executed on a computer to perform particular tasks. This code is
written by programmers.
• Programming is the process of giving machines a set of instructions that describe how a program should be carried
out.
• Programmers will start by using a code editor or IDE to write what is called source code. This is a collection of code
written in a programming language that other programmers can read.
• Source code needs to be converted into machine language so machines can understand the instructions and
execute the program. This process of converting source code into machine language is known as compiling. e.g. C
and C++.
• There are other languages that do not use compilers. Instead, these languages will use an interpreter that will read
and execute the code, e.g. JavaScript and PHP.
• Once the code is executed, then the computer program can run. The different types of computer programs include
Word processors, Database systems, video games, and websites.
• These computer programs allow us to interactive with different software devices and services like phones, websites,
and the computers themselves.
Types of programming languages
There are hundreds of programming languages in existence. Developers will first consider the needs of the application
so they can decide which languages would be appropriate to use.
Here are a few popular programming languages.
•Python
•JavaScript
•C/C++
•Java
•C#
•Ruby
•PHP
Computer Networks
A network is two or more computers - or other electronic devices - that are connected together for the purpose of
communication. They are connected by a wired medium such as cables, or by a wireless medium such as Wi-Fi.
A network is two or more computers connected together to share data.
A network can be defined as a group of computers and other electronic devices connected in some ways so as to be able to
exchange data. Each of the devices on the network can be thought of as a node. Examples of electronic devices are computer,
iPad, fax machines, printers, mobiles etc - each node has a unique address.
There are a number of advantages of using a network, including:
• Being able to share hardware such as printers and scanners.
• Centralised (and often automatic) back-up of files.
• Software can be installed and updated centrally, rather than on several machines. It can also often be bought using a site
licence which can save organisations money.
• Allows easy sharing of files.
• Improved communication between network users and devices.
Computer Networks 2
A network is simply two or more computer systems connected together to allow them to communicate and share information.
Networks allow us to:
• Send and receive emails (communication)
• Share peripherals like printers
• Work simultaneously on tasks and share files
• Have a roaming profile, meaning you can use almost any machine on the network Any machine which is not part
of a network is known as a
There are some disadvantages, such as: Stand Alone Machine. This may
• Hardware, including servers like File and Web servers are expensive mean that it doesn't have a
• Specialist staff (like a Network Manager) may be required to look after the network Network Interface Card (NIC),
• If any of the hardware fails, the network may not function properly but often means that the
• A greater risk from viruses machine is simply not required
to be connected to a network.
LAN and WAN
A network which covers a smaller geographical area, like a school or a library, is known as a Local Area Network (LAN).
A network which covers a larger geographical area, like a city or a university campus that has several sites, is known as a Wide
Area Network (WAN).
Types of Networks
Connection to a network has many advantages for companies, such as:
• Instant update of fast-changing information across large distances, such as car prices, stock prices
• Global communication via tools like Skype, Twitter or email

The internet
The internet is simply a network of networks all connected together. This allows us to access information on other computer
systems, sometimes thousands of miles away.
Most of the information we access is displayed through webpages on the World Wide Web.
Wired vs. wireless
A wired connection uses a physical wire to send data. In a school or office, these are normally hidden away, with many
access points built into walls. This has many advantages:
• The wired connection is normally more secure
• The wired connection speed is normally faster
Wired connections make use of different wires, each having different data transfer speeds. The options are:
• Fibre optic and Copper wire
However, there are disadvantages to wired connections, including:
• This could leave many wires trailing round an office
• If the wires are damaged they need to be replaced
• A very large amount of cabling and network hubs may be needed in large premises
A wireless connection can connect devices without any wires needed between them. This has several advantages, such
as:
• There are no wires causing clutter or hazards (i.e. tripping over wires)
• A connection can be made anywhere within the range of the device
However, there are disadvantages, including:
• If the connection is unsecured, other users could access it
• There can be interference with the wireless signal from other devices
Cyber security threats
Not all online content can be trusted. When using the internet, it is important to understand the threats that may occur.
Technology is rapidly evolving and as a result, the way that criminals are using the internet is also changing.
There are a number of different threats to computer systems that include:
• social engineering
• malicious code
• human error

Any risk posed to a computer system from an internet source is considered a cyber threat. These threats are often combined to
increase the probability of harm to a system. By taking steps to understand what the potential risks are, people and businesses
are able to better protect their systems and data.
Social engineering techniques
Social engineering is manipulating people into handing over confidential information
such as a PIN or password. There are several forms:
o blagging
o phishing
o pharming
o Shouldering

Blagging
Blagging is when someone makes up a story to gain a person’s interest and uses this to
encourage them to give away information about themselves, or even send money.
For example, a person may receive an email that appears to be from a friend telling them
that they’re in trouble and asking them to send money.

Shouldering
This is the simplest form of taking personal details. Shouldering is looking at someone’s
information over their shoulder, for example looking at someone enter their PIN in a
shop or at a cashpoint.
A person can prevent this by using their hand to cover the keypad as they type their PIN,
or being aware of people around them when typing in PINs. Software helps protect
against shouldering by masking what is typed, showing an asterisk on the screen instead
of the symbol that was entered.
Social engineering techniques
Phishing
Similar to blagging, a phishing email will ask a person to send personal details, but
pretends to be from a business. They can often look convincing, but may contain
spelling errors or URLs that do not match the business's website.
When a person clicks on these links and logs in, it sends their username and password
to someone who will use it to access their real accounts. This information might be
used to steal a person’s money or identity, or the email may contain malware.
Banks will never send emails asking for personal information or usernames and
passwords. If someone receives an email that they think might be phishing, they
should report it to the business the sender is claiming to be.

Pharming
Pharming is a type of cyberattack that redirects a user from a genuine website to a
fake one. The fake website will often look like the genuine one. When a person logs in,
it sends their username and password to someone who will use it to access their real
accounts.
There are several ways that a pharming cyberattack can redirect traffic from a genuine
website to a fake one. One example is if the Domain Name Servers (DNS) of the
website, which match the website address with the IP address of the webserver,
are hacked and the IP address is changed to become the address of the pharming site.
Malicious code
Malicious code is software written to harm or cause issues with a computer. This is also referred to as malware and comes in a
number of different forms. In all its forms, the code has been written to either harm or steal data from your computer system.
There are a number of types of malware, which include:
❑ viruses
❑ trojans
❑ ransomware
❑ spyware
❑ Adware

Viruses
A virus is a piece of malware that infects a computer, and then replicates itself to be passed onto another computer.
Anti-virus software holds a large database of known viruses. If a program that is installing, or file that is being opened, appears
to be similar to one of these, the anti-virus software will warn the user and, depending on the type of anti-virus, place all related
files into a secure folder until it is confirmed that it is safe.

Trojans
A Trojan appears to be a piece of harmless software, often given away for free, that contains malicious code hidden inside. This
only appears once the gifted software is installed. It was named after the Greek myth of the Trojan horse.
Malicious code
Ransomware
Ransomware hijacks the data on a computer system by encrypting it and demanding that the owners pay money for it to be
decrypted.
Having up-to-date anti-virus software and educating users to not open suspicious attachments will help protect from
ransomware.

Spyware
Spyware is a type of malware that collects the activity on a computer system and sends the data it collects to another person
without the owner being aware.
If a computer has been infected by spyware, it could be sending back everything that is typed, or the sites that are visited, or
even where the user is clicking on their screen. Spyware that records what is being typed is known as a keylogger. Keyloggers
attempt to find out usernames and passwords by collecting everything that is entered into the system, which allows the hacker
to search for personal data.
Most anti-virus software will also look for spyware in the same way as viruses. Specialist anti-spyware software is also available.

Adware
Adware is software that either causes pop-ups or windows that will not close. Generally, the pop-ups or windows display
advertisements. Many anti-virus programs will detect and prevent adware infecting a computer system, but specialist anti-
adware programs also exist.

You might also like