A-level Computing/Print version

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents


A-level Computing is an A-level course run for students in the UK

Note: current version of this book can be found at http://en.wikibooks.org/wiki/A-level_Computing

Table of contents

Introduction

Overview

AS modules

Computer Systems, Programming and Network Concepts
Introduction to Computer Systems
Introduction to Programming
Introduction to Information and Data Representation
Introduction to Communication and Networking
Principles of Hardware, Software and Applications
Practical Systems Development (Short practical project)

A2 modules

Processing and Programming Techniques
Data Representation in Computers
Questions
Machine Level Structure
Machine Operation and Assembly Language
Programming Concepts
Operating Systems
Advanced Systems Development
The Practical Project

Answers

Data Representation in Computers


Authors

Contributors

  • Mr. P. Kemp - East London
  • Mr. A. McPherson - West London
  • Mr. J. Edwards - Isle of Man

Thanks for helping out!

License

GNU Free Documentation License

Version 1.2, November 2002

Copyright (C) 2000,2001,2002  Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.

The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
C. State on the Title page the name of the publisher of the Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements."

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.


Overview

Introduction

This is a book about A-Level Computing. It aims to fit in with the AQA GCE A-Level Computing syllabus but is not endorsed by AQA. It should be useful as a revision guide or to find alternative explanations to the ones in your textbook. If you haven't heard of an A-Level then this book probably won't be of much interest to you but you can find out about them at Wikipedia.

If any part of this book is unclear or even wrong then please post a comment on the discussion page or simply fix it yourself! In particular, please say if the book assumes any knowledge or skills which not all A-Level Computing students have.

Course Structure

  • To be awarded an AS (Advanced Subsidiary) Level qualification in Computing, a student must take the 3 AS modules.
  • To be awarded an A (Advanced) Level qualification in Computing, a student must take all 6 modules.

Modules

Please note all modules have complementary question and answer sections

AS modules

A2 modules

Appendix

Computer Systems, Programming and Network Concepts

This is the Computer Systems, Programming and Network Concepts module of the A-level Computing Book. This module consists of four chapters listed below with their short summaries. Please follow the links to learn out more about each section.

Contents

  1. Introduction to Computer SystemsDevelopment stage: 75% (as of Sep 24, 2006) (Sep 24, 2006)
    An introduction to the hardware components of a computer system and the different types of software. Overview of the interaction between software and hardware, binary notation in computers and execution of the processor.
  2. Introduction to ProgrammingDevelopment stage: 50% (as of Sep 25, 2006) (Sep 25, 2006)
  3. Introduction to Information and Data RepresentationDevelopment stage: 25% (as of Sep 26, 2006) (Sep 26, 2006)
  4. Introduction to Communication and Networking

Introduction to Computer Systems

Definition of this section is available at [1], page 16. This text will be expanded shortly

What is Hardware and Software?

At the highest level, a computer system is composed of hardware and software components. Hardware consists of all the physical devices. All the programs (code) that run on the computer system form the software part. The hardware and software are tightly coupled and they complement each other. Hardware is useless without software and software requires hardware to carry out computations.

Different Types of Software

System Software

System software is anything that is an essential part of the computer system; or in other words a software is the artificial intelligence which dictate the rules of operation within its systems.

Operating system software

An operating system is the low-level software that acts as an interface between the user and the hardware. The OS provides a "virtual machine" where the user is safe to execute their applications and program code.

Image:os_stack.png

Common operating systems include Microsoft Windows, Mac OS X and GNU/Linux derivatives.

Utility programs

Utility software helps manage and tune the computer hardware, OS or application software. It usually performs a single task or small range of tasks. Good examples include:

  • Archive: utilities take a file or collection of files and output a single file or stream.
  • Disk defragmenters: reorganise file structure so that all file fragments are contiguous on the disk. Modern filesystems, such as those used by Mac OS X and GNU/Linux, do not need explicit defragmenting.
  • Encryption: utilities use a specific algorithm to encrypt/decrypt the contents of a file or stream using an encryption key.
  • Virus scanners: scan for malicious computer program code in files.

Library programs

A collection of subprograms used to develop software and hardware compatibilities. Libraries contain "helper" code and data for other programs to use in a modular way; they are usually not executable and exist purely to provide services to other programs.

Compilers, assemblers and interpreters

A compiler is a computer program that translates code written in a high level language to a lower level language, e.g. assembly language or machine language. The most common reason for translating source code is to create an executable program (converting from a high level language into machine language).

Advantages of using a compiler

  • Source code cannot be stolen/copied
  • Tends to be faster than interpreting source code
  • Produces an executable file, and therefore the program can be run without need of the source code

Disadvantages of using a compiler

  • Object code needs to be produced before a final executable file
  • The source code must be 100% correct for the executable file to be produced

An assembler translates assembly language into machine language. Assembly language consists of mnemonics for machine opcodes so assemblers perform a 1:1 translation from mnemonic to a direct instruction. Conversely, one instruction in a high level language will translate to one or more instructions at machine level.

Advantages of using an assembler

  • Assembly code is often very efficient (and therefore fast) because it is a low level language
  • It is fairly easy to understand due to the use of English-like mnemonics

Disadvantages of using an assembler

  • Lots of assembly code is needed to do relatively simple tasks, and complex programs require lots of programming time
  • Assembly tends to be optimised for the hardware it's designed for, meaning it is often incompatible with different hardware

An interpreter program executes other programs directly, running through program code and executing it line-by-line. This is slower than running compiled code but it can take less time to interpret program code than to compile in then run it — this is very useful when prototyping and testing code.

Advantages of using an interpreter

  • Useful for prototyping software and testing basic program logic
  • Easy to find errors in source code because the translation will stop when an error is encountered

Disadvantages of using an interpreter

  • Source code is required for the program to be executed
  • Interpreters are generally slower than compiled programs due to the per-line translation method

Application Software

Application software is designed for the user to allow them to solve a task. These may include Word processors, spreadsheets and database packages. (NOTE: do not use brand names in the exam, unless asked to, it is better to use the type of software instead, e.g. Excel Spreadsheet package)

General purpose

General purpose application software is designed to solve a wide range of tasks, for example:

  • Word processor
  • Spreadsheet package
  • Presentation package

Special purpose

Special purpose application software performs a specific task or set of tasks, for example:

  • Media player
  • Accounting
  • Vector drawing

Bespoke

Bespoke application software has been written specifically for the needs of a user or company. It is "tailored" to their exact requirements. Some examples might be:

  • Air traffic control
  • Factory robot
  • Tourist kiosk

Introduction to how computers store data

Computers can't understand colours, words and sounds like humans. Even if you use digital cameras and voice recognition, a computer has to translate these inputs into the only language it does understand, that is the language of 1 and 0. This is called binary.

Binary is different from our own decimal numbering system. Instead of having 10 different values like decimals: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 (this can also be referred to as denary or base 10), binary (or base 2) only has 2 values: 0 and 1. A binary digit, or bit as it is more commonly known, can either be set to 0 (off) or 1 (on).

By combining many bits together, we create what are known as "bit patterns". Inside the computer, all data is transmitted and manipulated in bit patterns. Apart from individual bits, the two other most important bit patterns are:

  • Byte: This is a series of eight bits that computers tend to use as the smallest number of bits to store data, e.g. 10110110.
  • Word: This is sometimes called a 'manipulation unit'. It is a set length of bits that varies between types of computers, but is usually 32 or 64 bits long in most modern computers.
  • Program: A program is a set of instructions that are processed by the computer to do a specific operation. This could be anything, from adding two numbers and outputting the result, to the complex instructions in the program of a computer game.
  • Data: Data (the singular is datum) are raw numbers that have no meaning by themselves. Data could be stored about parts of a video clip, an image, a sound, text or a number.

What parts make up a computer?

These components are found in virtually every computer:

  • Processor: The 'brain' of the computer. It executes instructions sequentially and processes data. The processor is usually divided up into the Arithmetic and Logic Unit (ALU), and the Control Unit. The ALU carries out logical evaluations (for example comparisons), and mathematical expressions (such as addition and subtraction). The Control Unit carries out the functions that organise instructions and co-ordinates all the data and instructions, similar to traffic lights controlling the flow of cars. The processor is also called a Central Processing Unit (CPU).
  • Clock: A piece of hardware used to keep the processor (and some other integrated circuits) in time by oscillating at a steady frequency.
  • Main Memory: This is temporary storage that stores data currently being worked on. It is accessible to the processor directly, without going through any input/output channels. It does, however, need to connect to the processor via the data, address, and control buses. When power is lost, all data stored in main memory is lost, therefore meaning it is volatile. Main memory is also known as Immediate Access Storage (IAS).
  • Address Bus: A collection of wires between the processor and main memory used to communicate the physical location (address) of data in main memory.
  • Data Bus: A collection of wires between the processor and all internal devices, and is used to send and receive both data and instructions.
  • Control Bus: A collection of wires between the processor and devices used to send commands and get status signals from the devices. For example, it could show whether the computer was reading or writing to memory.
  • I/O Port: An interface and physical connector that allows peripherals, such as a keyboard, mouse or monitor, to communicate with the 'heart' of the computer system — the processor and main memory. I/O stands for Input/Output.
  • Secondary Storage: This is computer memory that is not directly accessible to the processor but uses the I/O channels. It is for storing data not in active use and preserves data even without power, meaning it is non-volatile.

diagram is needed here

How to run programs

All programs are stored as a series of bit patterns ready to be executed (or "run") by the processor. All modern computer systems use the "stored program concept". This is where program instructions are loaded into main memory for the fetch and execute cycle.

The stored program concept basically states that both instructions and data to be operated on can be loaded into memory at the same time, as opposed to having the instructions pre-programmed into the hardware, and then passing this hardware the data to be processed.

The fetch-execute cycle is the retrieval of data and instructions from main memory through the data bus, and then executing the data or instructions using the processor.

An example of these ideas working together would be when a computer system was required to add two numbers together. A program that adds numbers is loaded into main memory. Then each instruction of the program is fetched and executed one after the other by the processor, along with any data required (in this case the numbers to be added). The processor stores the current instruction in a special register and uses its Arithmetic and Logic Unit to process the instruction.

Introduction to Programming

What is Programming?

Programming is the ability to get a computer to perform tasks by writing instructions that a computer can understand and execute. You must remember that the only language a computer understands is binary, a combination of 1s and 0s. This section looks at how we can write instructions and get the computer to understand those instructions.

Programming Languages

When computers were first developed in the 1940s the only way to send instructions to them was by sending them 1s and 0s through flick switches and buttons. Even though the process of sending a computer instructions got better evolving through punch cards, paper tape, magnetic tape and disks, the language computers understand has not changed from the pattern of 1s and 0s, machine code. However the way humans construct these 1s and 0s has gotten easier.

Levels of Programming Language

High/Low level programming languages are terms used to describe how abstracted the language is from the raw machine code and hardware manipulation. Whether a language is high or low level is purely subjective towards the comparison made. Assembly is considered a low level language but is a higher level langauge than machine code as it resembles English more closely. B.A.S.I.C is even further abstracted and can thus be considered a high level language.

Machine Language - First Generation

The 1s and 0s that a computer can understand and execute

100100101110101000101011010010100101

It is very difficult for humans to understand and difficult to write unaided. Machine code tends to be produced for a specific hardware set up and thus it is not portable to different machines.

Low Level Language - Second Generation

In a low level language the programmer controls and specifies the specifics of how to handle the data, where to store it, how to access it and so on. Assembly is said to be a low level language. Here is a source extract to print "Hello World!" to the screen

; This program displays "Hello, World!"
dosseg
.model small
.stack 100h

.data
hello_message db 'Hello, World!',0dh,0ah,' '

.code
main  proc
      mov    ax,@data
      mov    ds,ax

      mov    ah,9
      mov    dx,offset hello_message
      int    21h

      mov    ax,4C00h
      int    21h
main  endp
end   main
easier to write and understand when compared to machine code
allows low level access to hardware features
can produce small program sizes
can produce very fast code
not as easy to understand and write when compared to high level language
may be written specifically for a certain hardware set up and will therefore not be portable

High Level Language - Third Generation

A high level programmming language is one in which the specifics of data handling and manipulation is abstracted away (more so than in a low level language). A high level language generally has more built in functionality than a lower level language and is closer to English for a person to understand. C++ is considered a high language. Here is the source to print "Hello World!".

#include <iostream.h>
using namespace std; 
int main()
{
    cout << "Hello World!";
    return 0;
}
//Note: This code may or may not be compilable, as it varies between compilers and platforms.
easy to write and understand
built in libraries to perform routine tasks
can be ported to multiple hardware setups from same code
may be slower than second generation languages
may produce larger program files for same functionality than second generation langauge
may not allow for low level hardware access

Program Translators

We already know that computers can only execute Machine Code, so we need a way to convert from 2nd and 3rd generation languages to 1st generation, machine code.

There are three different methods that you may have to use. Assemblers, Compilers and Interpreters

Assemblers

When using Assembly language you will have to use an Assembler. The Assembler will take the assembly code and convert it into the correponding Machine Code 1s and 0s (actually current flowing and current off). There is a one to one correspondence between a single assembly language instruction and a machine code instruction. In general there will be one line of Machine code produced per line of assembly language. This translation or conversion is called 'assembling' and is performed by a piece of software called an assembler before execution of the code can take place.

Compilers

When using a high level language you will have to use a compiler to turn your code into the corresponding machine code. This is done using a compiler and performed before the execution of the code. A program like a Playstation computer game will be written in a High level language and compiled into machine code. This code will then be burnt to disk at the factory and sent to the shops, when you buy it and place it in the DVD drive of the PS2, the processor will execute the machine code.

Interpreters

Another way of running code written in High level languages is to use an interpreter. This will convert the code you write in machine code for the processor to execute. However the difference here is that the code is converted into machine code as you are running the program, so the code is interpreted only when you need to run it, line by line. This can be much slower than compilation but allows for you to correct errors in the code (debugging) when you meet them. It is also used in common languages like Java and allows you to run the same code on multiple hardware set ups as long as you have an interpreter for that hardware. Think along the lines of running the same Java Application on Linux, Windows and your mobile phone.

Comparisons

You may be asked in the exam which translator you would recommend, here are a few things to think about

  • If the code is in Assembly Language (2nd Generation), then you will use an Assembler
  • If you want the fastest code you will use a compiler
  • If you want the code to be able to run on multiple machines you will need an Interpreter
  • If you want to debug code and not have to recompile with every change you make, you want to pick an Interpreter


Programming Concepts

In this module we will be looking at Imperative languages, Imperative languages are languages that execute one line after another, take this example for instance

int x = 1;
x=x+1;
x=x+1;
x=x+1;
cout << "x = " << x; // print x

output:

x = 4

Declaring a variable then assigning a value to that variable is called Assignment

int x;
x = 45;  // this is assigning the value 45 to the variable x

There are other sorts of languages that you will meet in module 4, but for the moment you only need to know about imperative languages. You will not need to know a particular language for the exam but knowing the concepts behind them and how to understand the pseudo code is essential - pseudo code is close to a third generation language, which is understandable what it should do to you and me, but probably wouldn't run on a computer. This section will now outline a few of the concepts you need to understand

Type Definitions

You may have met datatypes in GCSE when using databases or spreadsheets. The idea behind them is to use a type of data to store information that best matches the data you want to store. In computers this is incredibly important as you are trying to make the best use of the computing resources available, so picking the data type that matches the information you are declaring will be the most efficient way of storing the data. For example if you want to store a number you don't want to use a data type that can also store letters and other characters as this would be a waste of space. e.g.

3 stored in ASCII is 0010 0011
3 stored in pure binary is 0011, thus saving 4 bits

In any programming language you generally have 4 different data types.

  • Integers
    Integers are whole positive numbers, but unlike in maths the integer range will have limitations to the maximum number. The limitations can vary greatly.
    e.g. 104
int x = 45;  //declares an integer called x and sets the value to 45
  • Strings (Characters)
    Strings are a collection of single block characters. e.g.
    e.g. as54sfgjf/.dfg4
string x = "herman";
  • Booleans
    Booleans are variables that are like on/off switches and generally can only equal two values.
    e.g. TRUE/FALSE ON/OFF 1/0
bool x = TRUE;
  • Pointers
    Pointers are an advanced variable type. A Pointer is a 32bit or 16bit or 64bit number (depending on the environment), this number represents a single block in your computer memory. In essence it points to this memory block because you know that it is th nth memory block. Pointers are probably the most useful variable type however you may or may not come accross them depending on what language you are using and how high/low level it is. You do not need to know about pointers for module 1.

There are also other datatypes that languages may possess, such as:

  • Character
    The Character data type is a single character.
    e.g. g
char x = 'g';
  • Real
    Real is a more advanced number system than integer, allowing for rational and irrational numbers, decimal places and negatives
    e.g. -12.3231
real x = -23.432;
  • Array
    Arrays are collections of other datatypes, generally able to store only one datatype, for example an array of type string may look like this:
    (red, green, orange, blue, brown)
array x = new array ("red", "green", "orange", "blue", "brown")// declare array with five elements, each of type string.  
  • Think of an array as a spreadsheet; you have the array (x), which is like a spreadsheet file, and you have the columns inside, e.g. x[2] (array x, 'column' 2). This is a one dimensional array. A two dimensional array would be where you have rows; e.g. x[2,3] (array x, column 2, row three). One can have, in theory, as many dimentions in an array as one likes.

Variables

In mathematics the idea of variables are introduced. Variables in a program are very similiar EXCEPT that they may equal different values at different times of the program (this is why indeed they are called variables, they vary). They are used to store values that may be needed for the program, you can declare variables of any of the data type declared above. Think of them as a box with a name, you can change the contents of the box and look inside to see the value at any time:

int x = 5;
print x;
x = 104;
print x;
x = 32;
print x;

output:

5 104 32

Depending on the programming language you may or may not have to declare variables (in Basic you don't in C you have to). Declaring variables is simply telling the compiler/interpreter that you want to use a variable with that name.

Global and Local Variable

Dependant on where a variable is declared,the variable can be seen by other elements of the program code. There are two types of variable declarations, that is the Global and the Local variables.

Global variables are declared in the root area of the program code, that may be right at the beginning of the code (in C for example). The values stored in these variables will be accessible from any area of the code. This can be useful if you need to access a varibale from anywhere in the program, but if you declare global variables when you don't need to access them all the time, they will sit and take up main memory, thus wasting precious computing resources. Use with care.

Local variables are declared in a sub area of the program code, this may be in a function or procedure. The values stored in these variables will only be accessible from the sub program they are declared in. This can be friendly on computing resources as they are declared when the sub program is called, used, and when the sub program is exited, destroyed. So you only use main memory when you need to store the variable and it does not waste main memory like global variables do. However if you think you will need to variable outside the sub program you should think of using a global variable.

An easy way to think about local and global variables is to think of them as local and global tv channels. Global channels such as Fox and MTV can be accessed from anywhere in the world, but local tv channels such as Channel 5 or Yorkshire TV, can only be accessed in certain areas.

Special cases could be where you declare a global variable called holder, if you then call a sub routine and in this routine there is a local variable declaration of another holder, you do not overwrite the global variable. What happens is for the duration of the sub routine the local variable holder is in charge, when the sub routine exits, the local variable is destroyed and the original value of the global variable now becomes dominant. Take this code for example

code:

main program code
 int holder = 4
 print holder
 ...
 subroutine caller
    int holder = 9
    print holder
 end subroutine
 ...
 run caller
 print holder
end main

output:

4 9 4

[[Rule of thumb:]] If you want to quickly tell the difference between a global and a local variable use these quick rules.

  • If a variable is declared inside a function or a procedure it is a local variable
  • If a variable is declared inside a iterative or selective statement it is local
  • If the declaration is indented from the left hand boundary it probably meets one of the above criteria and is local
  • If it meets none of the above statements and is declared in the main body of code it is a global variable

Constants

Constants are like variables in their declarations and the ability to look at the value stored inside them, however you can not change the values, the value of a constant remains, constant.

constant int x = 34;
print x

output:

34

Order of Operation

Program Design

There are several very useful programming statements that you can use. You probably use these in your everyday lives with out even thinking about it

Selection

An important part of programming is the use of selection, that is the ability to do something if a certain criteria is met. This may be as simple as increasing your health bar in a computer game if you eat a chicken drumstick or inserting the cooling rods into the nuclear reactor if the temperature exceeds a certain value.

The most common selection statement is the if statement, the idea is that you compare a value to some criteria, if the value and criteria match then you proceed in a certain way, otherwise you do something else. For example:

If Hungry Then
Eat
Else
'Go Out'
End

Image:CASE-IF-THEN-END_flowchart.png The other type is the Case statement, this can be summarised by several if statements where the value is compared to several criteria and the action of first criteria matched is performed, otherwise a default action may be performed.

Case Enter Restaurant and pick up menu
If Egg and Chips available Then
Order Egg and Chips
End If
If Pie and Chips available Then
Order Pie and Chips
End If
If Curry and Chips available Then
Order Curry and Chips
End If
If Pizza and Chips available Then
Order Pizza and Chips
End If
Default
Leave hungry
End

Iteration

An incredibly important part of computing is the idea of iteration, that is repeating the same thing again and again. You probably use iteration every day. Take writing lines in a detention for example; you write some lines, check to see if you have met the line limit, and if you haven't you write some more lines, check if you have met the line limit and so on, until you do meet the line limit and then you can stop. There are three main sorts of iteration.

The while loop: For example:

While Hungry Do
Eat
End

Another type of while loop is a Do-While loop. This is slightly different from the While loop in that you perform the task before you check that you have to perform the task:

Do
Eat
While Hungry
End

The most complicated tool you may meet is the for loop. This is a glorified While loop and don't be put off by how complicated it looks.

For (start with Empty stomach, Is stomach empty?, Eat)
 Wipe mouth

Procedural Code

Procedures and Functions are very slightly different. Functions return a value whilst Procedures do not. An easy way to remember this is by saying that functions are fun, if you call them they will send you something back, procedures return nothing.

Functions - note the return value

code:
a = addtogether(2,3) + 4
print (a)
output: 
9

Procedure - note the lack of value returned by the procedure

code:
addtogether(2,3)
proc addtogether(a,b)
 {
  print(a+b)
 }
output: 
5


To communicate between different parts of the program and to pass variables to the the functions and procedures we use Parameters. For example

Function addtogether (number1, number2)
 {
  return: number1+number2
 }

where this code will add together the numbers 1 & 2.

Object Oriented Code

Structural Concepts

Methods

Objects

Call Stack

FIXME Expand this article. NB I cannot guarantee the accuracy of the information here, nor how relevant it is to the A Level Syllabus. It is worth knowing, anyhow. if it makes no sense to you then there are plenty of tutorials out there!

Object Orientated code is code which forms resides in blocks. An object, such as a class is declared, similar to how one would declare a variable.


   class myClass {
     
     public:
     
     void SayHello(string text) {
       cout << text;
       return void;
     }
   
   } anInstanceofmyClass myClass;


The above code declares an object (of type class) called myClass.

Within myClass a function is declared called SayHello(text), with protection level public (as opposed to protected, or private. Protection layers are effectively the same thing as local and global terms as used for variables. 'Public' means that the function is global, and can be accessed wherever an instance (creation) of the class exists. An object (by which I mean a variable, class, structure or any defined thing in memory) declared with modifier 'private' can only be used, called or accessed by something in that class, e.g. if I declared a private variable in myClass called text it could only be accessed by another Object within myClass, such as the SayHello() function. Protected is the protection modifier inbetween public and private. It can only be accessed by something within the same class, or by an object within a class derived from its class. Derivation, or Inheritance, as it is more often called, is a powerful feature or Object Orientated Programming (OOP), which basically means passing on the objects in one class to a 'child' class. The child class can have its own objects, as well as the objects it recieved from as many 'parent' classes as required. It can also redefine these objects within itself, e.g. SayHello() no longer takes a variable, it prints the text "hello" on the screen without input. I hope this is all making sense to you!

After the class is defined, as instance (Object) of the class is created, called anInstanceofmyClass. One can create as many instances of a class as one likes, e.g. anInstanceofmyClass1, anInstanceofmyClass2, anInstanceofmyClass3 myClass; To call the SayHello() function, one would type anInstanceofmyClass.SayHello("Hello Text"); anInstanceofmyClass1.SayHello("") and anInstanceofmyClass2.SayHello("") both do the same thing.

Introduction to Information and Data Representation

What is Data and Information?

You may have used the words data and information to mean the same thing in everyday conversation, but it is very important that you know the difference between the two when it comes to computers. Roughly speaking data is the raw stream of 1s and 0s inside the computer and information is when the computer makes sense of this stream. It is interpretation of data in computers and different ways of storing information, that we shall now cover.

Consider data as an encoded form of information and information as any form of communication that provides understandable and useful knowledge to the recipient. - AQA[2]

Data

"Data consists of the raw facts and figures that a computer will process into useful information"

Sources of Data

Data can come from a wide variety of areas, but a good way to think about it is data comes from anywhere where there is an input into a computer. This may be from a keyboard, a scanner, a microphone or a disk drive, amongst many others.

Direct and Indirect Data

Data may be collected with a desired purpose in mind, for example collecting data from a weather station. This kind of data collection is called direct data collection. Other times data may become useful for reasons that it was not originally collected for. This is called indirect data collection. An example of this could be, "The data collected above is used to record where a particular video is" this would be an example of direct data and and example of indirect data would be "The data collected is used to build up a profile of the members for targeted advertising".

Information

Information is meaningful data




Denary Binary BCD ASCII
0 00000000 0000 0100 0000
1 00000001 0001 0100 0001
2 00000010 0010 0100 0010
3 00000011 0011 0100 0011
4 00000100 0100 0100 0100
5 00000101 0101 0100 0101
6 00000110 0110 0100 0110
7 00000111 0111 0100 0111
8 00001000 1000 0100 1000
9 00001001 1001 0100 1001
10 00001010 0001 0000 0100 0001 0100 0000
11 00001011 0001 0001 0100 0001 0100 0001
12 00001100 0001 0010 0100 0001 0100 0010

Consider data as an encoded form of information and information as any form of communication that provides understandable and useful knowledge to the recipient.

Number Representation Systems

Binary number system

Describe the representation of unsigned decimal integers in binary. Perform conversion from decimal to binary and vice-versa. Pure binary representation of decimal integers

Binary-coded decimal (BCD) representation

Describe the representation of unsigned decimal integers in binary-coded decimal. Perform conversions from decimal to BCD and vice versa. Explain advantages of BCD.

Information Coding Schemes

ASCII EBCDIC Unicode

Describe standard coding systems for coding information expressed in character form and other text-based forms. Differentiate between the character code representation of a decimal integer and its pure binary representation.

Introduction to Communication and Networking

Definition of this section is available at [3], page 19.


Communication Methods

Serial

Like a single lane road, all the cars arrive one after another. There is only ever one car going through the check point at any one time.


Parallel

Define both serial and parallel methods and illustrate where they are appropriate. Consider the effect of distance on the transmission of data.

Baud rate

The speed at which telecommunicated data is transmitted, measured in bytes-per-second (BPS).

Bit rate

The rate at which bits are transmitted over a communication path. Normally expressed in bits per second (bps). The bit rate should not be confused with the data signaling rate (baud), which measures the rate of a signal changes being transmitted.

bandwidth

A measure of information or carrying capacity of a signal, expressed as the width of the spectrum of that signal in Hertz..

Asynchronous data transmission

The ASYNCHRONOUS (ASYNC) format for data transmission is a procedure or protocol in which each information CHARACTER or BYTE is may be transmitted and received at irregular and independent time intervals. The characters or bytes may also be transmitted as a contiguous stream or series of characters.

Start and stop bits

Describe the purpose of start and stop bits in asynchronous data transmission.

Parity Bits

Parity is a system in which we use a parity bit to check for errors in a communicating system. Parity bits are generally the most simple way of checking for errors. At the end of a byte sent, an extra bit will be added to the end of the byte. We use two different types of parity bits. These are called even and odd parity bits. If we are using even parity, the bit on the end will ensure that the number of ones sent in the previous data is even. If we are using odd parity, then the bit on the end will ensure that the amount of ones in the sent data is odd.

Handshaking

Handshaking is an automated process of negotiation that dynamically sets parameters of a communications channel established between two entities before normal communication over the channel begins. It follows the physical establishment of the channel and precedes normal information transfer.

Protocol

A protocol is a set of rules which computers use to allow them to communicate. There are many different communications protocols, including WiFi (a low level protocol that stipulates how bits should be converted into radio signals), and IP (a higher level protocol which provides addresses for different locations on a WAN, such as the internet).

Modem

A modem is a piece of electronic equipment that takes data from computers and superimposes it onto the carrier signals of public telecommunications systems. This process is called modulation. The equipment also takes previously modulated data from the public telecommunications system and returns them to state that can be read by computers. This process is called demodulation. Modems can be either built-in units or plugged-in units

Networking

Local area network (LAN)

Bus

Image:Netzwerktopologie_Bus.png

Ring

Image:Netzwerktopologie_Ring.png

Star

Image:Netzwerktopologie_Stern.png

Wide area network (WAN)

The Internet

Intranet

Network adapter

Leased line

==Dial up== networking Candidates should be familiar with LAN topologies but will not be required to know details of their operation. Candidates should be aware of the advantages and disadvantages of each LAN topology. Candidates should be able to compare local area networking with standalone operation.

Uniform Resource Locator (URL)

Describe the term URL in the context of Internetworking. .

Domain names

IP addresses

Explain the term domain name and IP address. Describe how domain names are organised

Principles of Hardware, Software and Applications

A-level Computing/Principles of Hardware, Software and Applications

Practical Systems Development (Short practical project)

CPT3 as is the course reference is a practical based project, normally based upon a database of some description but a pure-coding or part-coding, part-database project are also acceptable. This is examined in the summer of the first year of study.

Processing and Programming Techniques

Contents