Everything File - Calthorpe Park Moodle

Download Report

Transcript Everything File - Calthorpe Park Moodle

Networks
Specification
• You need to be able to:
a) explain the advantages of networking stand-alone computers into
a local area network
b) describe the hardware needed to connect stand-alone computers
into a local area network, including hub/switches, wireless access
points
c) explain the different roles of computers in a client-server and a
peer-to-peer network
d) describe, using diagrams or otherwise, the ring, bus and star
network topologies
e) describe the differences between a local area network and a wide
area network such as the Internet
f) explain the terms IP addressing, MAC addressing, packet and
protocols
g) explain the need for security measures in networks, such as user
access levels, suitable passwords and encryption techniques
h) describe and justify network policies such as acceptable use,
disaster recovery, failover, back up, archiving.
Why network computers together?
• To share hardware peripherals (e.g. printers
and scanners)
• To share files with other users
• To allow for central backups
• To make software installation quicker and
easier
• To allow for central security (e.g. virus
checking, firewalls, user names and
passwords)
What hardware is needed to network
PCs together?
• Hubs/switches/router, network card
• repeater, bridge, network card, wireless access points,
modems
What is a hub?
• A hub is a hardware device that connects multiple
computers together in a network and allows
them to share data packets.
• Each computer will be connected to a single 'port'
on the hub. So if you purchase an '8 port hub',
you will be able to connect up to eight computers
together.
• You can also 'daisy chain' hubs to allow even
more computers to join the network.
• Only star topologies use a hub.
What is the difference between a hub
and a switch?
• A hub receives all data sent over the network and
sends it to all the other devices on the network.
Only the device who the data packet is for will
acknowledge it; the other devices will ignore it.
• A switch is bit more intelligent than a hub and it
learns which devices are on the network (and
their port number/address) and only sends the
data packet to the computer who is the intended
recipient. This is more efficient than a hub as it
doesn’t result in lots of unnecessary network
traffic.
What is a router?
• A router is a device that transfers data from
one network to another in an intelligent way.
It has the task of forwarding data packets to
their destination by the most efficient route.
• It can protect the computers on the network
by hiding them from the outside world (i.e. a
firewall).
• Some routers include an ethernet port and
modem to provide access the internet.
What is a network card?
• A Network Interface Card (NIC) is a hardware
card installed in a computer so it can
communicate on a network.
What is a repeater?
• Signals fade as they travel along cables. A
repeater joins two cables together and boosts
the signal back to its correct level
What is a bridge?
• A bridge joins two networks together – it is
less sophisticated than a router, but is cheaper
What is a Wireless Access Point?
• A Wireless Access Point (WAP) is method of
creating a local area network that doesn’t
require cables,
• A WAP device has a number of dedicated
radio channels available that a Wi-Fi computer
can connect to. All data passing through the
radio channel is then fed into the hard-wired
network that the WAP device is supporting
What disadvantages does Wi-Fi have?
• It is slower than a dedicated cabled network
• It has a limited amount of radio channels.
• It is less secure because it depends on setting
a password and keeping the password secret.
What is a modem?
• A modem is a device that provides access to the
internet.
• Standard ADSL (telephone) modems come in two
forms. An external box that links to your
computer through an USB port or network cable,
or an internal modem that is plugged directly to
the motherboard inside the computer.
• In addition to telephone modems, radio has now
become very popular as a means of connecting to
the internet. The device that allows you to do this
is called the Wi-Fi modem
What is the difference between a clientserver and a peer-to-peer network?
• In a Client-server network, the server acts as
the main computer handling login requests,
user storage, etc. The client could be any
computer. The user can log on to any client
and still access the server.
• In a Peer-to-peer network, each computer
shares information equally and plays an equal
role in the network. No network operating
system is required.
Name 3 network topologies
• Ring
• Star
• Bus
Describe a ring topology
Describe a bus topology
Describe a star topology
What is the difference between a LAN
and a WAN?
• A Local Area Network (LAN) is on one site
• A Wide Area Network (WAN) is across more
than one site (a series of interconnected LANs)
– the internet is the biggest WAN in the world
What is an IP address?
• An IP address gives the virtual location of a
device on a network
What is MAC addressing?
• A MAC address uniquely identifies a specific
piece of hardware on a network
What is the difference between an IP
address and a MAC address?
• A device will have a different IP address
depending on the network it is on, but will
have the same MAC address no matter where
it is.
What are internet protocols?
• Protocols are a set of standards and guidelines
that tell computers how they should handle
the sending and receiving of data over a
network.
TCP/IP (Transmission Control
Protocol and Internet Protocol)
HTTP (HyperText transfer
Protocol)
FTP (File Transfer protocol)
SMTP (Simple Mail Transport
Protocol)
Used to exchanged data between computers on a
network and route packets between networks and
over the Internet.
Used on the WWW to transfer webpages and web
content from the website host server to the computer
requesting the page.
Used to transfer files between computers over a
network.
Used to transport emails.
What security measures can be used
to protect data on a network?
• user names and passwords
• user access levels
• encryption
What is disaster recovery?
• If an important system fails, there needs to be
plans in place to get the network up and
running again as quickly as possible. Many
organisations, such as banks, have a disaster
recovery plan which may mean relocating to a
different location (if the building is no longer
accessible).
What does failover mean?
• Failover is automatically switching over to
another system or piece of hardware when
one fails, e.g. switching to a different derver if
one goes down
Why is it important to have a backup?
• So that you can restore data if it gets
corrupted in some way
What is archiving?
• Sometimes there is data that you don’t need
to access very often that is taking up space;
this data can be archived – either compressed
so that it needs to be uncompressed before it
can be used or copied onto and archive tape
or disk.
What is an acceptable use policy?
• It is important for the network to have an
acceptable usage policy to provide users with
guidelines about what they can and can’t do
while using it.
The Internet
Specification
• You need to be able to:
a) describe the nature of the Internet as a worldwide
collection of computer networks
b) describe the hardware needed to connect to the Internet
including modems, routers etc
c) explain the need for IP addressing of resources on the
Internet and how this can be facilitated by the role of
DNS servers
d) explain the importance of HTML and its derivatives as a
standard for the creation of web pages
e) describe common file standards associated with the
Internet such as JPG, GIF, PDF, MP3, MPEG
f) explain the importance of compressing files that are
transmitted via the Internet
g) describe the differences between lossy and lossless
compression.
What is the internet?
• The internet is made up of millions of individual computer
networks all brought together to form the vast "InterNetwork“ - that word never caught on, so it was shortened
to the Internet.
• A large part of the Internet is the 'World Wide Web'
(WWW), but there are other parts to the Internet as well.
What is DNS?
• The Domain Name System (DNS) is a standard
technology for managing the names of Web
sites and other Internet domains. It links the
name of a website with the IP address of the
server that it is located on. When you type a
URL into a browser it is sent to your ISP which
accesses a DNS server which returns the IP
address and allows the browser to access the
requested web page.
Why is HTML important?
• HTML (HyperText Markup Language) provides
a standard format which any computer with
web browser can interpret and use to display
the pages. It allowed the World Wide Web to
get going as there was a universal standard
that everyone could use to share information.
What type of files are these?
.html, .jpg, .gif, .pdf, .mp3, .mpg, .swf, .mov
Why do you need to compress files for
use on the internet?
• Smaller files = faster download
• Smaller files = faster page display
What is the difference between
lossless and lossy compression?
Lossless compression
The original file stays completely intact and
unchanged.
Used for text documents, data files and executable
programs where it would not be desirable for parts
to be lost.
Lossy compression
Compression which involves discarding parts of the
file which won’t be noticed if they are not present.
Used for multimedia files, i.e. sound, images, video.
Databases
Specification
You need to be able to:
a)
b)
c)
d)
e)
f)
g)
h)
i)
describe a database as a persistent organised store of data
explain the use of data handling software to create, maintain
and interrogate a database
describe how a DBMS allows the separation of data from
applications and why this is desirable
describe the principal features of a DBMS and how they can be
used to create customised data handling applications
understand the relationship between entities and tables
understand the components of a relational database, such as
tables, forms, queries, reports and modules
understand the use of logical operators in framing database
queries
explain the use of key fields to connect tables and avoid
redundancy
describe methods of validating data as it is input
What is a database?
• A database is a persistent organised store of
data which can be easily and quickly searched.
Give an example of data handling
software
• Data handling software, such as Microsoft
Access, allow users to:
– add tables, define fields and add validation
(create)
– add/edit/delete data (maintain)
– run queries to extract information from the
database (interrogate)
What is a DBMS?
• DBMS stands for Database Management
System. It separates the data from the
application, e.g. SIMs is the application that
accesses the school’s pupil database
• A DBMS allows for – concurrent usage,
security or data, backup and recovery, data
integrity
What is the difference between a relational
database and a flat file database?
• In a flat file database all of the data is stored
in one table
• In a relational database the data is separated
into individual tables (entities) that are linked
by a primary key
What is the advantage of separating
data into different entities?
• It avoids data redundancy, and takes up less
space
• It makes it harder to make mistakes and lose
data integrity
• It makes it easier to update the database
What are the components of a
relational database?
Tables
Forms
Queries
Reports
Represents the entity in the database. Fields
and primary keys are defined and data stored in
the table. (Create)
Provide a customisable user interface to add/edit
and delete data (Maintain)
Allow data that meets specific criteria to be
extracted and displayed (Interrogate)
Displays the results of queries in a customised
format designed to be printed
What is a query?
• A way of searching a database to extract
information that meets specific criteria
What are (logical) operators?
•
•
•
•
AND
NOT
OR
=, <, >, <=, >=
What is a primary key?
• a unique field that allows a record to be
identified
What is validation?
• Checking that the data being entered into a
database meets certain criteria
What methods of validation can be
used?
• Presence check – field cannot be left blank
• Range check – field must contain a value
within a certain range or one of a specific set
of values
• Data Type – field must contain a specifc type
of data (date, text, number, boolean, etc.)
Fundamentals of Computer
Systems
Specification
You need to be able to:
(a) define a computer system
(b) describe the importance of computer systems in the
modern world
(c) explain the need for reliability in computer systems
(d) explain the need for adherence to suitable
professional standards in the development, use and
maintenance of computer systems
(e) explain the importance of ethical, environmental and
legal considerations when creating computer systems.
What is a computer system?
• At its most basic, a computer system is nothing more than an input,
a processor and an output.
• A computer system will usually have some storage capability and
more often now – a way of communicating with other devices.
How are computers used in the modern
world?
• Computer systems are integral parts of our
lives. They are used for entertainment, for
shopping, for making bookings, for navigation,
for security, for banking, for school/work, for
communication, as embedded chips to run
devices.
Why do we need to use the same professional
standards when developing and maintaining
computer systems?
• Without professional standards systems will
be developed that aren’t compatible with
each other
• Without professional standards low quality
buggy systems will be produced.
What legal considerations are there
when developing software?
• Data Protection Act
• Copyright Designs and Patents Act
What environmental considerations
are there when developing software?
• Obsolete equipment needs to be disposed of
responsibly
• Computer equipment uses a lot of electricity
What ethical considerations are there
when developing software?
• Just because we CAN do something that
doesn’t mean we SHOULD
Software
Specification
You need to be able to:
a) explain the need for the following functions of an
operating system: user interface, memory
management, peripheral management, multi-tasking
and security
b) describe the purpose and use of common utility
programs for computer security (antivirus, spyware
protection and firewalls), disk organisation
(formatting, file transfer, and defragmentation), and
system maintenance (system information and
diagnosis, system cleanup tools, automatic updating)
c) discuss the relative merits of custom written, off the
shelf, open source and proprietary software.
What does an operating system do?
• It provides a user interface (i.e. windows and
menus), manages the memory, manages the
peripherals (e.g. printer, scanner, mouse),
allocates resources to all of the tasks that the
computer is doing and manages security (e.g.
user name and passwords; access levels)
What security utility programs are
there?
• Anti-virus
• Anti spyware
• Firewall
What utility programs are there for
disk management?
• Formatting
• File transfer
• Defragmentation
What utility programs are there for
system maintenance?
• system information and diagnosis
• system cleanup tools
• automatic updates
What is custom written software?
• Software developed specifically for a
particular business or organisation
What are the advantages and
disadvantages?
• Advantages: custom made to meet exact
purpose
• Disadvantages: very expensive and need
technical expertise to develop.
What is off-the-shelf software?
• Software developed by a software house to be
sold generally
What are the advantages and
disadvantages?
• Advantages: cheaper than developing bespoke
software; technical support is available.
• Disadvantages: not specific to the company
and so might not do everything you want it to
do.
What is open source software?
• Software written by the general public for
everyone else to use. The source code of the
program is freely available so anyone can
change it.
What are the advantages and
disadvantages?
• Advantages: anyone can use/adapt the
software to meet their needs; the
collaborative approach to development can
lead to better quality
• Disadvantages: because the source code is
available to all there can be security issues
What is proprietary software?
• Software written by a developer and allowed
to be used by others but with certain
restrictions, e.g. can’t adapt software. Source
code is hidden.
What are the advantages and
disadvantages?
• Advantages: can allow for different versions of
same software, e.g. educational version with
limited functionality or full- functionality
version costing more.
• Disadvantages: source code cannot be
inspected so may contain spyware or other
malicious features within the software.
Hardware
Specification
• You need to be able to:
a) understand the need for input and output
devices
b) describe suitable input devices for a wide range
of computer controlled situations
c) describe suitable output devices for a wide range
of computer controlled situations
d) discuss input and output devices for users with
specific needs.
Why do we need input and output
devices?
• So that we can interact with the computer
(processor) and see the results of processing
What input devices can you think of?
•
•
•
•
•
•
•
•
•
•
•
•
•
Keyboard
Concept keyboard
Mouse
Trackerball
Foot operated mouse
Touch screen
Barcode scanner
Joystick
Game controller
Microphone
Sensors
Camera
Sip-puff switch
What output devices can you think of?
• Monitors
– CRT Monitor (Cathode Ray Tube)
– TFT Monitor (Thin Film Transistor)
– LCD Monitor (Liquid Crystal Display)
• Speakers
• Headphones
• Printers
–
–
–
–
Inkjet printer
Laser printer
Dot-matrix printer
Braille printer
• Lights
• Actuators
What input and output devices can be
used by users with disabilities?
•
•
•
•
•
•
•
•
•
Sip-puff switch
Eye tracker
Foot mouse
Tracker ball
Concept keyboards
Magnifier
Voice recognition software
Text-to-speech software
Braille printer
Specification
• You need to be able to:
a) state the purpose of the CPU
b) describe the function of the CPU as fetching and
executing instructions stored in memory
c) explain how common characteristics of CPUs
such as clock speed, cache size and number of
cores affect their performance.
What does the CPU do?
• The purpose of the CPU is to Fetch and
Execute instructions stored in memory. It acts
as the brain of the computer and controls the
rest of the system.
How does clock speed affect
performance?
• Clock speed is the number of cycles that the
CPU can complete in one second (measured in
Hertz or Hz).
• The faster the clock speed, the more
instructions that can be executed in a second;
a 1GHz processor can execute 1000 million
instructions per second
How does cache memory affect
performance?
• Accessing data from the
hard disk is very slow;
even RAM isn’t quick
enough; so the CPU
uses cache memory
which is a smaller area
of high access speed
memory. It looks for
the data in the cache
first, then in RAM then
on the hard disk. The
bigger the cache the
faster the computer
How does the number of cores affect
performance?
• This is the number of processing cores the
CPU has. A dual-core has two and is able to
process two instructions simultaneously in the
same cycle.
Specification
• You need to be able to:
a)
b)
c)
d)
e)
f)
g)
h)
describe the difference between RAM and ROM
explain the need for ROM in a computer system
describe the purpose of RAM in a computer system
explain how the amount of RAM in a personal
computer affects the performance of the computer
explain the need for virtual memory
describe cache memory
describe flash memory
discuss how changes in memory technologies are
leading to innovative computer designs.
What is the difference between RAM
and ROM?
• RAM is Random Access Memory and is the
volatile memory that programs and data that
the CPU is working on are stored in
• ROM is Read Only Memory and contains the
boot information to get the computer up and
running. The boot information is called the
BIOS (basic input output system).
How does the amount of RAM affect
computer performance?
• The larger the RAM, the more
instructions/data can be held in quick access
memory without needing to use virtual
memory and accessing the hard drive, which is
much slower.
Why is virtual memory needed?
• Virtual memory is an area on the hard drive (a
page file) set up by the CPU to be used when
the RAM runs out. The last used
data/program is moved into virtual memory.
This is why if you have several programs
running, and you haven’t used one for a while,
it sometimes takes a noticeable amount of
time to “wake up”
What is cache memory?
• The cache is the holding area for data from
the RAM. It has a faster access speed than
RAM.
What is flash memory?
• Flash Memory (solid-state memory), has no
moving parts. It is similar to RAM but is nonvolatile which means when the power is cut
off, it still remembers the content. It has
faster access speeds than a hard disk.
How do changes in memory
technology affect technology?
Physical Size
& Capacity
Costs
Speed
Power
Memory chips become more compact (storing
more bits per chip) which leads to smaller
computing devices and larger capacities.
The cost of memory falls which means it is
more affordable to have larger amounts of
RAM available.
Read/write times are improving which mean
faster access and better performance.
Memory chips are more power-efficient
meaning portable devices work for longer
between charges and batteries can be smaller
and lighter.
Specification
• You need to be able to:
a) explain the need for secondary storage
b) describe common storage technologies such as
optical, magnetic and solid state
c) select suitable storage devices and storage media
for a given application and justify their choice
using characteristics such as capacity, speed,
portability, durability and reliability.
Why do computers need secondary
storage?
• Secondary storage is needed for when we
want to store files (data or applications)
permanently. RAM is volatile so that data and
applications that you are working on will be
erased when the computer is turned off.
What magnetic storage devices are
there?
• Hard drive (internal and external/portable)
• Magnetic tape
• Floppy disk
What optical storage devices are
there?
• CD
• DVD
• Blu-ray disk
What solid state storage devices are
there?
• Internal Solid State/Flash storage
• USB Memory stick
• Memory card (SD card)
Representation of data
Specification
• You need to be able to:
a) define the terms bit, nibble, byte, kilobyte,
megabyte, gigabyte, terabyte
What are the definitions of bit, nibble, byte,
kilobyte, megabyte, gigabyte and terabyte?
•
•
•
•
•
•
•
Bit = binary digit – the smallest unit in computing
Nibble = 4 bits
Byte = 8 bits
Kilobyte = 1024 bytes = 8192 bits
Megabyte = 1024 kilobytes = 8388608 bits
Gigabyte = 1024 megabytes = 8589934592 bits
Terabyte = 1024 gigabytes = 8796093022208 bits
Specification
• You need to be able to:
a) explain why data is represented in computer
systems in binary form
b) understand and produce simple logic diagrams
using the operations NOT, AND and OR
c) produce a truth table from a given logic diagram.
Why is data represented in binary form
in computers?
• Each CPU is made up of millions of transistors
which can only have two states (ON/OFF,
TRUE/FALSE, 1/0).
Describe the NOT operation.
A
Q
A
Q
1
0
0
1
• This operation produces an output that is opposite to the input.
• If the input is 1 (True) then the output is 0 (False).
• If the input is 0 (False) then the output is 1 (True)
• The shorthand way of writing this is Q = NOT A where 'A' is the
input and 'Q' is the output.
Describe the AND operation
A
B
Q
A
B
Q
1
1
1
1
0
0
0
1
0
0
0
0
• This operation produces an output that is only true if BOTH
inputs are true.
• If the A is 1 (True) AND B is 1 (True) then the output is 1 (True).
• If any of the inputs is 0 (False) then the output is 0 (False)
• The shorthand way of writing this is Q = A AND B where 'A' and
‘B’ are the inputs and 'Q' is the output.
Describe the OR operation
A
B
Q
A
B
Q
1
1
1
1
0
1
0
1
1
0
0
0
• This operation produces an output that is true if EITHER input is
true.
• If both A and B are 0 (False) then the output is 0 (False)
• If any of the inputs is 1 (True) then the output is 1 (True)
• The shorthand way of writing this is Q = A OR B where 'A' and
‘B’ are the inputs and 'Q' is the output.
Specification
• You need to be able to:
a) convert positive denary whole numbers (0-255) into
8-bit binary numbers and vice versa
b) add two 8-bit binary integers and explain overflow
errors which may occur
c) convert positive denary whole numbers (0-255) into
2-digit hexadecimal numbers and vice versa
d) convert between binary and hexadecimal
equivalents of the same number
e) explain the use of hexadecimal numbers to represent
binary numbers.
What are the headings on columns in
binary?
128
64
32
16
8
4
2
1
How do you convert from Binary to
denary?
• Add up all the columns where the one’s are
How do you convert from denary to
binary?
• Find the biggest binary number that fits into
the denary number and then take it off –
repeat until you’ve only 1 or 0 left.
How do you add binary numbers?
•
•
•
•
0+0=0
0+1=1
1 + 1 = 10
1 + 1 + 1 = 11
What is an overflow error?
• An error that occurs when adding 8 bit binary
numbers if the result will not fit within 8 bits
What symbols
are used in
hexadecimal?
Denary
Hex
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
A
11
B
12
C
13
D
14
E
15
F
How do you convert from hex to
binary?
• Split the Hex into two and find the binary for
each nibble
How do you convert from binary to
hex?
• Split the binary number into 2 nibbles and find
the hex symbol for each nibble
How do you convert from denary to
hex (and vice versa)?
• The easiest way is to go through binary
Specification
You need to be able to:
a) explain the use of binary codes to represent
characters
b) explain the term "character set"
c) describe with examples (e.g. ASCII and Unicode)
the relationship between the number of bits per
character in a character set and the number of
characters which can be represented
How is binary used to represent
characters?
• Every time a character is typed on a keyboard
a code number is transmitted to the computer
• The code are stored in binary
What is a character set?
• Different sets of codes are available for
different types of computer
• Most PCs use a character set called ASCII
What is Unicode?
• The simplest form of ASCII uses 7-bit encoding
(72 or 128 different codes)
• Unicode uses 16-bit encoding (162 or 65,536
different codes)
• EBCDIC uses 8-bit character encoding (82 or
255 different codes)
Specification
• You need to be able to
a) explain the representation of a image as a series
of pixels represented in binary
b) explain the need for metadata to be included
with the file such as height, width and colour
depth
c) discuss the effect of colour depth and resolution
on the size of an image file
What is metadata?
• An image file is just a series of binary numbers
010101110011110001110000111….. Etc.
• In order for the computer to interpret the file
and display the image it must know extra
information such as the resolution of the file
(i.e. the height and width of the picture e.g.
600x800) and the colour depth. This
information is called metadata – and is stored
in the file itself in binary
What is the difference between a
vector and a bitmap
• A vector graphic is made up of lines with
specific properties such as line style, line
colour and where it starts and ends. The
computer sores all of this data in binary.
• A bitmap graphic is made up of information
about each pixel in the image
What is the resolution of a picture?
• The number of pixels per inch (usually known
as dots per inch or dpi) is known as the
resolution of the picture. The more dots per
inch the better the resolution but the larger
the file.
What is the colour depth of a picture?
• The number of bits used to store each pixel
dictates how many colours the picture can
contain, for example 8 bits per pixel will give
256 colours. This is known as the colour
depth. Again the more bits per pixel, the
bigger the file.
What effect does colour depth and
resolution have on file size?
• The higher the colour depth (i.e. the more bits
per pixel) the bigger the file
• The higher the resolution the bigger the file
Specification
• You need to be able to
a) explain how sound can be sampled and stored in
digital form
b) explain how sampling intervals and other
considerations affect the size of a sound file and
quality of its playback.
How is sound sampled and turned into
digital data?
• Sound is sampled by taking regular
measurements of the sound wave and then
converting those measurements into a binary
number to be stored in a digital file.
How does the sampling interval affect
the size of the sound file?
• The sampling interval is the time between
samples, the smaller the interval the more
samples per second, the better the quality of
the sound and the bigger the file
Specification
• You need to be able to
a) explain how instructions are coded as bit
patterns
b) explain how the computer distinguishes between
instructions and data.
How are instructions turned into bit
patterns?
• Computer programs are made up of
instructions written in a programming
language. When a program is compiled, the
computer turns the high level programming
language into machine code, which is the
binary representation of the instructions.
How does the CPU know the difference
between data and instructions?
• Data and instructions are both in binary (von
Neuman architecture) so the operating system
has to know which is which. Every location in
memory has a unique address (location
number) and the operating system knows
where in memory the data is stored and
where the programs are stored.
Programming
Specification
• You need to be able to
a) Understand algorithms (written in pseudo code
or flow diagram), explain what they do and
correct or complete them (fill in the gaps).
b) Produce algorithms in pseudo code or flow
diagrams to solve problems
What is an algorithm?
• In computer terms, an algorithm describes the
set of steps needed to carry out a software
task.
• A good algorithm will be as general as possible
to allow for the widest use.
• Note: an algorithm is not code – it should not
be language specific
What is a flow chart?
• A way of showing graphically the flow of
instructions through an algorithm
What is pseudocode?
• Pseudocode uses structured English to lay out
an algorithm
Specification
a) Understand and use sequence within an algorithm
b) Understand and use selection in an algorithm (IF
and CASE statements)
c) Understand and use iteration in an algorithm (FOR
WHILE REPEAT loops)
What does “sequence” mean in an
algorithm?
• In an algorithm each instruction is laid out one
after another. This is called a 'sequence'.
What does “selection” mean in an
algorithm?
• It is very unlikely that an algorithm will have each
instruction occurring one after the other with no
deviation at all. It is normal to have some kind of
decision being made within the algorithm. This is
where the next instruction to be processed
depends on some condition being true or not.
This is called 'selection'.
• Selection is such a common requirement that
every computer language has a way of coding for
it. These are called 'conditional statements'
Which construct allows for “selection”
within an algorithm?
• IF ..... THEN ..... ELSE…END
• This construct allows you to place a condition after the IF section,
the statements inserted after the THEN part will be executed if the
condition is true. On the other hand the statements after the ELSE
section are carried out should the condition be false. The END
statement marks the end of the conditional block.
• Example:
IF (x > 10) THEN
Print (x)
ELSE x = x + 1
END
• You do not have to use an ELSE statement every time. If no code
needs to run if the condition is false, then there is no need to use it.
What is a Switch/Case construct?
• It is a very common requirement that you want to test for a
set of values rather than just a single one.
• The long way of doing this is to write
if (x = 'Monday') then ....
if (x = 'Tuesday)' then ....
if (x = 'Wednesday') then ... and so on.
• This works but takes an awful lot of source code.
• What you need is a SWITCH construct. The purpose of a
switch statement is to test the condition only once then
branch to one of a set of choices.
What is a Switch/Case construct?
• Unfortunately every language seems to have a very different
way of laying out a switch statement but the pseudo-code for
the general idea is shown below
SWITCH x
CASE 'Monday': Print ()
CASE 'Tuesday': Work_salary()
default: Store()
END
• It begins with a test for the condition of x, which is the
SWITCH part. Then the appropriate CASE is run depending on
the value of x. In this case it will handle x being Monday or
Tuesday. Should x be neither of those values then the
DEFAULT statement is run. You can of course have more than
two cases and you can have many statements within each
case block.
What is iteration?
• One of the most basic actions of computer code
is to loop around itself.
• This has the advantage of re-using the same block
of code but with a different set of conditions each
time.
• Note: you must be careful that the end condition
will actually happen!
• A very common coding error is to cause the end
condition to never occur and you end up with an
infinite loop.
FOR ...... NEXT
•
This loop sets up a counter to count how many times around the loop the code has
run, once the end condition has been met, the loop finishes and the CPU carries
on with the next block of code.
Example
FOR myloop_counter = 1 to 30 STEP 2
x=x+1
Print (x)
NEXT
•
•
•
•
The loop counter in this case is called 'myloop_counter'.
The starting value is 1 although it could be anything - even a negative number. The
ending value is 30, so once the myloop_counter has incremented to this value the
loop terminates.
The default increment is 1 which usually does not need stating, however, if a
different increment is needed then the STEP keyword sets this value. In this case
the increment is 2 so the loop will go around 15 times.
Note that a FOR .... NEXT loop will run at least once.
DO .... WHILE
• Another type of loop is the DO ..... WHILE loop
Example
DO Print (x)
IF printer = 'out of paper' then
finish_loop = 'Time to end'
ENDIF
WHILE finish_loop is NOT 'Time to end'
• With this type of loop you are changing the exit condition within the code
itself. This is often handy when you need to test for a non-numeric
condition.
• In the example above, the code prints out a variable x, then checks to see
if the printer is out of paper. When it is, the variable 'finish_loop' is set to
the terminating condition, otherwise the loop keeps on going around.
• This kind of loop also executes at least once because the WHILE condition
is not tested until the end of the first loop.
WHILE ..... END
• In the FOR ... NEXT loop and the DO .... WHILE loop the code within
the block will run at least once which is sometimes not desired.
• Another type of loop that avoids this is the WHILE ..... END loop
Example
WHILE pointer IS NOT 'End of File'
Read (data from file)
Increment pointer
END
• With this type of WHILE loop, the test is carried out before the code
is run.
• In the example above, some kind of pointer is indicating the current
position within a file but before any attempt is made to read data
from the file the WHILE test makes sure that the end of the file has
not been reached.
Specification
a) Define the terms variable and constant as used
in an imperative language
b) Use variables and constants
c) Describe the data types integer, real, boolean,
character and string
d) Select an justify appropriate data types for a
given program
e) Perform common operations on numeric and
Boolean data
f) Use one dimensional arrays
What is a variable
• A variable is a named value that can be
changed as the program runs
What does it mean to say a variable is
being declared?
• Many computer languages insist that you
'declare' a variable before you can use it. This
means you define the variable in terms of its
name and data type, e.g. in VB Dim
my_variable As Integer
What does it mean to say a variable is
being initialised?
• The word 'initialise' simply means assigning a
starting value to a variable
What is a constant?
• A constant is a named item or symbol that
does not change its initial value.
What data types can you think of?
• Integer, real, boolean, string, character
What is an Integer?
• Integer represents whole numbers with no
decimal points.
What is a real?
• A 'Real' data type is numerical data which
contains decimal numbers and is used when
extra detail is required and a whole number
would not provide enough information.
What is Boolean data?
• Boolean data holds one of two values, for
example:
– yes/no
– true/false
–0/1
What is a string?
• A string (or text) data type can hold any
alphanumeric character including text,
numbers and symbols including carriage
returns and spaces.
Why use a character data type?
• Although a string can hold even a single
character, this may not be the best way of storing
it. This is because a string may have a minimum
number of bytes allocated even for a single
character.
• A better data type is 'Character'. This is intended
to hold a single character and takes up one byte
of storage.
• Characters include all the usual ASCII characters
or other character set symbols
Arrays
• An array is a data structure that can hold a list
of items, with each item being accessed by
pointing to its location in the array.
Specification
a) Define the term high level language
b) Explain the difference between high level code
and machine code
c) Explain the need for translators to convert high
level code to machine code
d) Describe common tools and facilities available in
an integrated development environment (IDE),
editors, error diagnostics, run-time
environment, translators, auto-documentation
What is a programming language?
• Software is created by using a computer
language to set out a sequence of insructions
that the computer will follow.
• There are many computer languages but they
do share some common features.
What is machine code?
• A CPU follows binary instructions like this:
– 1010010110111010
– 1001110110000111
– 0001110010110001
• These instructions are stored in memory locations called
'Registers' within the CPU. Different CPUs have a different
set of registers.
• The raw instructions that the CPU carries out is called
'machine code' and each CPU family has a different set of
machine code.
• A person would find such a list of binary instructions
virtually impossible to follow. A better way of programming
had to be developed.
What is a low level language?
• Machine code is difficult for people to interpret and program in.
• So CPU engineers provide their customers with an 'assembly
language' which they can use to program the CPU.
• An assembly language is made up of a reasonably small set of
command words called 'Mnemonics'
• Low level languages have the advantage of providing very close
control of the CPU but the code is still quite difficult to read and
follow by other programmers.
• Each CPU family has its own assembly language and so code written
for one CPU family does not run on other CPUs. This means the
code is not very 'portable'.
• Assembly language is used for applications such as low-level device
drivers. It is also used extensively in CPUs that specialise in control
soyou may find in a washing machine or DVD player.
What is a high level language?
• Even though assembly languages are slightly “friendlier” than
machine code, both are still too awkward to use for day-to-day
programming, and so 'high level' languages were developed. They
are designed to be closer to human languages and are easier to use.
• A high level language has the following features
–
–
–
–
–
Easier to write
Easier to read
Easier to maintain
Portable : can work across different CPU families
Supports a wide range of data types
• High level languages have been around for more than 60 years and
by now there are dozens of them. Some popular ones include
BASIC, C++, C, FORTRAN, Pascal
How does a computer understand
your progam?
• High level languages are fairly close to normal
written language, but this means that they are
nowhere close to machine language!
• So an application is needed to convert the
fairly abstract high level language into a
precise set of machine codes that the CPU can
actually run. This application is called the
'translator'
Converting High Level Languages
• A translator converts high level commands into a set of machine codes.
One high level command can translate into many individual machine
instructions.
• This has another advantage, namely the same piece of high level code can
be converted into the machine code of a number of different CPUs. You
simply choose an appropriate translator.
• So a programmer need only write high level software once and yet it will
run on a number of different CPUs. This is called 'portable code'
• There are two kinds of translator.
1. Compiler.
– This takes the source code and converts it all once into machine code. This
machine code is then stored in an 'executable' file. These often have a .exe or
.com extension.
2. Interpreter
– This takes a single line of high level source code at a time and converts it into
machine code. This machine code then immediately runs on the CPU. If there
are any errors in the source code, it will be shown to the user or it may simply
refuse to run without any explanation.
What tools does a programmer need?
1. Text editor
2. Translator
3. Debugging tool
4. Documentation
You could use an independent set of tools, but a better
way is to use an Intergrated Design Environment (IDE)
What is an Integrated Design
Environment (IDE)
• An Intergrated Design Environment (IDE) brings
together the tools you need into one application
so that you can efficiently and easily develop
code. An IDE brings together
–
–
–
–
–
Source code editing
Debugging / error diagnostics
Translating (Complier)
Run time environment
Auto-documenting
• Visual Basic Express is an IDE
What is a Run-Time Environment?
• Actually running your code on the real CPU
might take a relatively long time to prepare
(several minutes). So an IDE provides a 'Runtime' environment. This means the code is run
within the IDE as if it were running on the real
CPU. This saves a huge amount of time during
development.
What is Auto-Documentation?
• This is also a great time-saver. As you write
your source code, this tool makes a note of
the variables used, which modules make up
the software, which subroutine calls what.
Perhaps it also extracts any comments you
make within the source code and so on.
• It then formats this information into a tidy text
file. This documentation is used by coders,
developers and maintenance staff.
Specification
a) Describe syntax errors and logic errors which
may occur while developing a program
b) Understand and identify syntax and logic
errors
c) Select and justify test data for a program,
stating the expected outcome of each test
What is a syntax error?
• A syntax error is when a grammatical rule of
the computer language is broken
How do you spot Syntax errors
• Often the IDE will identify syntax errors for
you, even before the code is compiled
• Before your source code is run, the interpreter
or compiler checks each statement for syntax
errors.
What is a Logic error?
• Logic errors occur when the code does not run
in the way it was intended because of the way
it is written
What is test data for?
• The purpose of test data is to be confident
that the program runs as expected with
'normal' data and that it behaves itself when
given extreme or plain invalid data.
What three steps should you use when
deciding on test data?
• Test it with values within the expected range
• Present it with values at the extreme range of
a logic statement
• Test it with unusual data such as the wrong
type.