Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 21

IST Yearly Notes

Data bases
Components of a Database
File - A file is a block of related data stored on a storage device (such as an employee database). A file in a database is divided into a set of related records. Record - A record is a collection of facts about one specific entry in a database. All the information about one employee is a record. A record is divided into one or more related fields. Field - A field is a specific piece of data in a record. Fields for each employee include the employee ID, last name and first name. A field is also known as a data item or category and is made up of characters. Character - A character is the smallest unit of data that people can handle and includes letters, numbers and special symbols.

Data Dictionaries
A data dictionary is a comprehensive description of each field in a database. It contains information about the characteristics of each item entered in the database, such as the field names, data types, field sizes and field descriptions see below

Field name is the name of the field; they should be short, clear and avoid the use of punctuation. Field size or field width, is the number of characters allowed in each field. Description specifies the contents of the field.

iRuler 2008

Data Types
Data type or field type is the kind of data in the field. Each field stores data of a single data type. Some common data types include: o Text - used for text or numbers that do not require calculations o Memo - used for lengthy text and numbers such as descriptions o Number - used for numeric data to be included in mathematical calculations o Currency - used for currency values o AutoNumber - Used to create a number automatically when record is added o Yes/No Used for data that can only be of two values, cannot be empty or null o OLE object - used for data created in other programs such as a spreadsheet, graphic or sound o Hyperlink - used for hyperlinks o Date/Time - used for dates and times. The organisation of data often involves a key (field to sort and retrieve information). A primary key is a field in which each item is unique and must have a value. AutoNumber is a good choice for primary key.

Purpose of:- Form


o A form or label displays data for every field of a single record and the layout can be changed. The user can position fields, headings, instructions and graphics. A well-designed form provides information explaining the required data and any data entry rules that apply to particular fields. For example, a field name Sex (M/F) leaves no confusion about its required data. Size, stroke weight and colour of the font impact on the user and the accuracy of the data entered. After one record has been completed the next record appears until all data is entered.

- Table

- Query

o A table or list displays data using columns (fields) and rows (records). You can scroll up & down to view more columns and rows. Good for Several Records or entering new data in only one field. Screen Layout can be changed by adjusting width, height and hiding columns. Data in a table is usually entered using a form, retrieved using a query and printed using a report. o A query is a search of a database for records that meet a certain condition. It is a question you ask of the database. The results of a query are displayed in a table but can be used as the basis for a form, report, graph or another query.

- Report
o The purpose of the report will determine its content, format and style. Before creating a report the user may need to select the required records by constructing a query. iRuler 2008

Difference between Searching and Sorting


- Searching
o Searching is the process of locating data and information. For small databases the Find or Search commands are adequate but for large databases you should construct a query.

- Sorting

o Sorting is the process of arranging data in a particular order (organising data). Sorts can be performed in either ascending or descending order

Methods of Editing Data


Editing is changing data. (Inserting, Deleting, Changing or Modifying Data structure) - Inserting Data. New records can be inserted by the correct command. Records can be rearranged by sorting. - Deleting Data. To delete a record, the user selects the records and then presses the Delete key or chooses an appropriate command. - Data is moved and copied using the Cut, Copy and Paste commands. - The structure of the database can be edited to meet new requirements. This involves changing the data dictionary.

Internet
Difference between Internet and Intranet
- Internet
o The Internet is a connected set of networks using the TCP/IP standard with millions of computers linked all around the world. Provides intstant access to information (news, weather, sports, share prices and educational materials). Also provides services - Sending messages, banking, shopping, playing games and listening to music. Access to the internet is available from almost anywhere around the world through an ISP. o An intranet is a private network that uses a similar interface to the Internet existing within an organization. Intranet supports email, newsgroups, file transfer, web publishing with access through a web browser.

- Intranet

Parts of a URL
A URL (Uniform Resource Locator) is the address of a file or resource on the Web in a lower case, single unbroken line without spaces.
http://www.hi.com.au/heinneman/default.htm

There are three parts to a URL:


-

Protocolindicates access to a particular resource on the Web. For most cases the protocol will be http://. It allows access to web pages based on hypertext. Domain nameaddress of the specific computer where the resource is located such as www.hi.com.au. The domain name is interchangeable with the IP address.

iRuler 2008

File pathfull path to the file to be retrieved. It may be a simple file name or a directory path, such as /heinneman/default.htm. The domain name and the file path are separated by a forward slash (/). The file being retrieved in this example is default.htm.

Main Parts of an Email Header


Tomain person receiving the message Cccarbon copy sends the same message to other people just as information for them Bccblind carbon copy sends a copy to other people without revealing who else got the message Subjectis the topic of the message or brief descriptionthis is very useful for the receiver of the message, also displayed outside for the person to click on.

Email attachments
An attachment is a file in its original condition and format that is sent with the email message. When sending an attachment it is important to include a brief explanation in the main body of the email message. The file name and the format of the attachment should be easily understood. Netiquette is a code of acceptable behaviour users should follow on the Internet. It covers rules for all aspects of the Internet such as the email, chatting, newsgroups and discussion groups. Some of the rules for netiquette include: o keep messages short and to the point o be polite and avoid offensive language o avoid sending abusive or insulting messages (flames)do not participate in flame wars o avoid using all capital letters as it is considered shouting o use emoticons to express feelings such as :) for happy or :( for sad o use abbreviations and acronyms such as IRL for in real life or BTW for by the way o Make the email subject line as meaningful as possible. A search engine is a program that finds websites and web pages. It accesses a database of indexed websites that can be searched using a keyword. This index is built by regularly scanning for new websites and accepting submissions from website authors. A web directory organises the Web into categories and then smaller subcategories. This allows the user to browse through the categories until they find a relevant site. Most search engines allow users to search for specific items such as images. Some search engines allow a search to be restricted to just Australia Advance search options provide users with more accurate results. (Such as restricted to files that were updated recently, particular file formats or sites without certain words) A protocol is a set of rules that governs the transmission of data between computer devices; protocols include TCP/IP, HTTP, FTP and SMTP.

Netiquette
-

Search Engines and how they work


-

Internet Protocols
iRuler 2008

Transmission Control Protocol/Internet Protocol (TCP/IP) is a common language for data transmission and error detection across the Internet. It works by breaking information into smaller packets of data. Each data packet contains the information and the address of the receiving computer. The TCP tells what is in the packet and IP tells the receiving computer where and how to send the packet. Hypertext transfer protocol (HTTP) is a standard for transferring the contents of a web page into a browser for viewing. Does not download files that make up the web page. HTTP is a one-way system as data is only transferred from the web server to the browser. File transfer protocol (FTP) is a standard to upload and download files. An FTP server is a computer that allows users to upload and download files using FTP. FTP is a file server not a web server. Simple mail transfer protocol (SMTP) is a standard for outgoing email. Most email messages are sent using SMTP. POP3 (Post Office Protocol) is a standard for incoming email.

Cookie
A cookie is a file that is stored on the hard disk after the user visits a website. It is used to measure a users behaviour and work flow habits. Cookies store the information about the web pages visited and the transactions completed. However, most cookies are designed to improve your experience and allow organisations to target advertisements to your tastes. Users have the option to block or accept cookies. A proxy server is a barrier to the Internet to ensure users are securely and productively accessing network resources. It lets administrators limit access to objectionable content by filtering URLs. Proxy servers distribute and manage information reducing network traffic and user wait times. Traffic time is reduced as the proxy server caches frequently accessed documents or entire websites. Firewalls are used on the Internet or any network to check all incoming data for the purpose of verification and authentication. It aims to protect a computer system from hackers trying to access sensitive information. Firewalls are an important security measure on an intranet. All messages entering or leaving the intranet pass through the firewall. It examines each message and blocks those that do not meet the specified security criteria. Anti-virus software is used to scan a file or disk for a range of known viruses. A virus is a small program that attaches itself to an application. There is no guarantee that anti-virus software will stop every virus, as new viruses are constantly appearing. However, if users download the latest virus definition files and regularly use the anti-virus program, it will minimise the problem

Proxy Server
-

Firewalls
-

Antivirus Software
-

Website Development
- Types of Web Pages and Purpose o Home Page
iRuler 2008

Home page (index page) is the first page viewed by a visitor and provides information about the purpose and subject matter of the website; it provides a link to other web pages. An intermediate page is the next level down from the home page. It provides link back to home page. They provide structure and assist in the navigation of the website. Way of grouping Content pages. Content pages contain topic details and are usually accessible from intermediate pages. Content pages usually contain a link to home page.

o Intermediate Page

o Content Page

Features of a Website
Contact informationInformation such as address, phone, fax and email. TextLook and style is important. Should display the essential content. GraphicAdd interest and attraction. Most common formats are JPEG and GIF. Thumbnail imagesmall preview of the real full size image. Downloads faster than the full size image. Viewer can click the thumbnail to view full size image. Rolloverpicture, icon or button that changes when the mouse is moved over it. A rollover is 2 images. GIF is mostly used as it needs to be changed quickly. Animationa flashing object to get visitors attention. Animation is used to direct the visitor to an area of the screen or an interesting feature. Streamed audioused to provide background music or sound effects. Streaming audio is heard before the entire file has been transferred. Streamed videovideo clips that play before the entire file has been transferred. It is more dependent than streamed audio on a high bandwidth. Hyperlinklink to another part of the same web page or web site. Hyperlinks are made using text (hot word) or image (hot spot). Hyperlinks are usually underlined or coloured. Often arranged in horizontal rows or vertical columns to form a navigation toolbar. Tablesrows and columns of cells that are filled with characters or graphics. Used to arrange information in row and column format, borders and shading can be applied. Listsunordered lists do not have a numbered sequence. Entry in an unordered list is usually shown with a bullet. Ordered lists use a numbered sequence. Framesspace or boxes that hold an object. Each frame is considered a separate window and could be a separate HTML document. Frames allow a banner, advertising message or animation to be held in place while the visitor navigates the website. Web formsare tools to collect information, such as orders for goods and services and results from surveys. Web forms have an invisible part that processes the data and stores it in a database. Information is entered using text boxes, option buttons, check boxes, list boxes, spin boxes.

Design Considerations for a website


o Consistencylayout, format and style should be the same throughout the website unless different data types demand a change. Readability is improved when similar items are grouped. iRuler 2008

o NavigationColouring different areas of the page, using visual symbols (icons and arrows), inserting clear page headers and creating simple hyperlinks improves navigation. o Simplicitydo not overuse design elements as this will create visual clutter and confuse the visitor. The overuse of colour, sound and animations can be distracting. First impressions on the Web are important. A visitor often forms an opinion of a website within the first minute of accessing the home page.

- Design Factors

o Textclear and legible text using at most three different fonts. Care should be taken using font styles such as bold and italic. Underlining is only used for hyperlinks. Long lines of text are difficult to read. o Colourmany different colours can be distracting and reduce readability. A colour scheme should not interfere with the main message of the web page. Dark text on a light background or vice versa usually works well. Blue is often preferred for unused links and purple for used links. o Graphicsare used to create interest, however, they are slow to download. When using graphics consider the size of the graphic, recognisable icons and whether the graphic fits easily on the screen. o Animationvisitors seeking information from a website are distracted by inappropriate animation. A small creative animation such as a comet-type effect can be effective. o Audio and videoshould not be an essential part of a web page as some visitors might not have the right hardware or plug-in. It is good practice to advise visitors about the size of audio and video files.

Networking
Advantages and Disadvantages of setting up a network
- Advantages
o Sharing peripheral devices: Share Printers, Hard disks and Internet access. o Sharing applications: Networks enable users to share applications. Usually a network licence is cheaper and can be installed faster. o Sharing data: Networks provide a very fast method for sharing and transferring files. Many networks have a file server to store data which can be accessed from any computer on the network. This increases productivity and efficiency. o Security of information: Networks secure files by restricting access to only authorised users. The entire network is backed up on a regular basis. Firewalls are used to protect data on the network from hackers and unauthorised users. o Improved communication: Networks enable users to work together in ways that otherwise would not be possible with Email and messaging systems. There is also a range of software designed for groups of users on a network. One example of this software is project management iRuler 2008

software. It is a tool to efficiently plan, manage and communicate information about a large project. Disadvantages o Expensive to install: Servers, network devices, cables and network software are expensive. Technician will be required to setup a network but saves money over time. o Administrative time: Maintenance requires time and a person called a Network Admin to be employed for looking after the network. o Server failure: If the server fails no one can access the network and its devices and productivity can be lost. o Damaged equipment: One network cable can stop the entire network from functioning. A faulty network Interface card will stop a user from accessing the network. o Maintaining security: Networks are targets for hackers and viruses. The files stored on a network can be accessed, stolen and edited more easily than files stored on an individual computer. A virus that enters the network can spread to every computer on the network. Appropriate procedures need to be implemented to maintain security such as corporate anti-virus software and powerful firewalls.

Protocols used over Networks


TCP/IP (Transmission Control Protocol/Internet Protocol) is a standard for data transmission and error detection across the Internet. The TCP standards inform the receiving computer what is inside the data packet and the IP standard tells the computer where and how to send the data packet. IPX/SPX (Internetwork Packet Exchange/ Sequenced Packet Exchange) is a standard used for data transmission in local area networks (LAN) that use the Novell NetWare operating system. NetBEUI (NetBios Extended User Interface) is a standard used for data transmission in local area networks that use Windows NT and LAN manager. AppleTalk is a set of local area network standards for Apple Macintosh computers. It is built into all Apple computers and Apple laser printers.

Types of Wire Transmissions


Twisted-pair cable consists of pairs of insulated copper wires, twisted to form a spiral. Twisting reduces the amount of interference from other cabling. Unshielded twisted-pair (UTP) is used on a network. There are two common standards for UTP called 10Base-T (10 Mbps Ethernet) and 100Base-T (100 Mbps Fast Ethernet). UTP is preferred as it is cheap and easy to install with a maximum distance of 100m. - Coaxial cable has a single copper wire surrounded by an insulator, grounded shielding and an outer insulator. The shielding allows data to be transmitted with little distortion. It is more dependable than UTP, however, it is more expensive and less flexible. The most common standard for coaxial cabling is 10Base2 (10 Mbps Ethernet). It is suitable for a maximum distance of 200 metres. - Optical fibre cable is a very thin fibre of clear glass or plastic that carries light waves. Optical fibre cable is becoming the standard for wire transmission. Optical fibre cables are free from electromagnetic and radio interference, very secure, light and transmit data at high speeds without errors. Optical fibre cables can, in theory, transmit data in excess of 10 Tbps. However, they are iRuler 2008 -

more expensive than other types of wire transmission. Optical fibre is suitable for long distances.

Transmission Modes
Simplex mode allows transmission in one direction only, from the sender to the receiver such as - radio, television or a school broadcast system. Remote sensors send information to a computer using simplex mode. Half duplex mode allows transmission in both directions but not at the same time. This means the sender and the receiver take turns. An example of half duplex mode is an intercom or walkie-talkie. Disk drives and printers transfer information using half duplex mode. Full duplex mode allows transmission in both directions at the same time. Most communications systems use full duplex mode, such as the telephone or email. A computer uses full duplex for most of its communication.

Bits per second


Bits per second (bps)number of bits transmitted in one second also called bit rate.

Baud Rate
Baud ratethe maximum number of electrical signals transmitted in one second. Baud Rate can transmit more then one Bit a second, for example 1 baud rate = 2 bps.

Wireless Transmission
Radio waves are used to transfer data by connecting a small radio transmitter to each device which transmits across the air. Most common wireless networking standards are 802.11b (11 Mbps) and 802.11g (54 Mbps). Radio Waves have bad security and can be intercepted by anyone. Microwave is a high frequency radio signal sent through space in a straight line from one antenna to another and can send both voice and data. Antennae are placed on high grounds to transmit over long distances. Microwaves are mostly error free but weather conditions, trees or building will obstruct the signal. Microwaves are commonly used with satellites for long distances. Satellites are specialised receivers and transmitters that are launched by rocket and placed in orbit around the earth. A signal is sent from one ground station to the satellite, which receives and re-transmits the signal to another ground station. Each ground station uses a satellite dish to send and receive the signals. Satellites can transmit large amounts of data over long distances and at great speeds. There are hundreds of satellites currently in operation. They are used for weather forecasting, television broadcasts, radio communications and Internet communications.

Difference between LAN, WAN and VPN


A local area network (LAN) is a network on one site, such as within a building or group of buildings. A LAN is often a collection of computers and peripheral devices. LANs enable users to share resources and communicate with each other more effectively. These tasks are completed using a network operating system (NOS). The physical arrangement of the devices on a LAN is called the

iRuler 2008

network topology. There are many possible network topologies, such as star, bus and ring. A wide area network (WAN) is a network that covers a very large area. It is often made up of a collection of LANs. A WAN may use a private leased line, the normal telephone network or a combination of both. A private leased line is dedicated to the network. It offers higher transmission speeds and more accurate transfer of data than those available through the Public Switched Telephone Network (PSTN). PSTN links are relatively cheap if computers do not require constant connection. However, the link is not guaranteed and can be interrupted. A virtual private network (VPN) is a private network carrying encrypted data across the Internet. It uses the PSTN and the Internet to create an organisations network. A VPN aims to provide an organisation with the same capabilities as a LAN but at a much lower cost. It uses encryption and other security measures to ensure only authorised users have access to the VPN. Encryption is the process of coding data and decryption the process of changing it back. Data is coded, transmitted and then converted back to its original form. Encryption is used to prevent data from being intercepted during transmission and to maintain the privacy of the VPN.

Types of Servers
A file server is a controlling computer in a network that stores the programs and data shared by users. The files stored on this server can be retrieved by authorised users. A print server is a computer in a network that controls one or more printers. Print servers have printers attached to them and are accessed by authorised users. If the printer is busy the data to be printed is stored in the print server and placed at the end of a queue. A print server can be used with or without a file server. A mail server is a computer in a network that provides email facilities. It stores incoming mail for distribution to users and forwards outgoing mail to appropriate devices. Some mail servers can be accessed from the Internet. A web server is a computer in a network that stores and distributes web pages. When a network user accesses a web page from the Internet it is stored in the web server. Websites are downloaded and stored on web servers. When you browse the Internet you are travelling from one web server to another.

Network connection devices


A workstation is a personal computer on a network. It has memory, storage and processing capabilities. Workstations can operate independently of the network. They access a server for files and applications but process the data themselves. A hub is a central connecting device in a network. Each node is connected directly to the hub. Most hubs were initially dumb. They receive a data packet from one node and send that data packet to all nodes on the network. This created a lot of unnecessary network traffic, as most of the nodes will ignore the data because it is not addressed to them. A better type of hub is called a switch. A switch is an intelligent hub that only sends data to a specific node. The switch looks at the address of the data packet and sends it to that address. A switch reduces the volume of traffic on a network compared to a hub.

iRuler 2008

A router is a very intelligent hub that directs (routes) data packets to and from other networks. It makes its decision on its current understanding of the networks. A router maintains a table of the available routes and their conditions. It uses this table to determine the best route for a given data packet. Routers are often used to connect to the Internet. A bridge is a device to link two similar networks. It often connects networks that use the same protocol such as Ethernet. A bridge examines each data packet on a network and forwards any data packets addressed to a connected network. A gateway is a link between two different types of networks. It converts different protocols and transfers data between the two networks. For example, a gateway could be used to convert a TCP/IP packet to an IPX packet. A gateway acts as the door between the networks. All the data must pass through the gateway to reach the other network. Gateways are not necessarily separate devices but rather are often pieces of software running on servers or in routers. A repeater is used to rebuild a fading signal to its original strength and shape before transmitting it onwards. For example, the data sent along a UTP cable becomes unreadable after about 100 metres. A repeater would be installed every 100 metres to rebuild the signal. A repeater ensures that the data is received as it was sent. A network interface card (NIC, pronounced nick) is an expansion card that allows a device to be connected to a network. NICs are installed into servers, workstations and some other devices. Each device must have a driver to communicate on the network. A NIC is usually given a unique address so that it can be identified on the network. Most NICs require a network cable connection and have connectors on the card for different types of cables.

Client Server
A clientserver network is a network that uses one or more computers as servers and all the remaining computers as clients. Each server is a powerful computer that contains resources to be shared with clients. Most organisations use the clientserver network for their LAN. A clientserver network involves using a network operating system (NOS). A NOS allows the server to complete requests from clients for resources. The majority of the NOS is installed on the server but each client has NOS client software. The NOS client software is used to send requests to the server.

Peer-to-Peer Network Server


A peer-to-peer network is a network where there is no central server but each computer is both a server and a client. It is a simple network that usually connects less than ten computers. A peer-to-peer network is used in homes and small offices to share files, peripheral devices and one Internet connection. In a peer-to-peer network each computer is considered a peer because it is equal and shares resources with others without a server. Each user determines which resources on their computer are to be shared. Operating systems such as Windows XP and Mac OS have the software to operate a peer-to-peer network. A P2P is an Internet peer-to-peer network on which users connect directly to each others hard disks and exchange files over the Internet.

Network Topologies
iRuler 2008

Network topology is the physical arrangement of the devices on a LAN. The type of network topology is not determined by the shape but by how each node is connected to other nodes. There are many possible network topologies: o A star topology has a central node with each device connected directly to it. The central node is usually a hub, switch or router. The central node receives messages and sends them to the destination device. Star topology requires extra cabling as each device needs a cable to the central node, not the nearest device. If one device or cable is broken the network can still operate. However, if the central node fails then the network fails. o A bus topology is an arrangement where all the nodes are attached to a cable called the bus. Each device has a unique identity and can only recognise those signals intended for it. Nodes check the bus, and retrieve their messages as data travels along the bus. Each node is considered to be connected to every other node and can communicate directly along the network to any device. Bus topology is one of the easiest and cheapest to set up. It can still operate if one node fails and nodes are easily added. However, a faulty bus will stop the network and data collisions can occur on the bus. o A ring topology is an arrangement where all nodes are attached in the shape of a closed loop. Each device in the ring has a unique address. Data flow is in one direction, moving from node to node until it arrives at its destination. Ring topology is dependent on the ringif it is faulty

the network will stop.

Network Operating Systems and tasks


Network operating systems control the flow of data between the devices on the network and the requests for data. The network operating system organises messages from nodes until the network is ready to process the message. The tasks performed by a network operating system and the administrator of the network include: o Administrationadds, removes and organises users. Groups of users are often given the same permissions and rights. Permissions and rights allow access to particular files and resources. o File managementgives users access to the remote hard disks on the server. It provides a file system and the ability to manage a network directory. Drives and directories are mapped for users. o Applicationshandles requests from users to share applications. The NOS is used to install software. It is easier for network administrators to comply with software copyright laws using a network. Access to the application files is restricted.

iRuler 2008

o Resource managementallows network devices such as printers and modems to be shared. It assigns users to printers and orders print jobs. The NOS is able to track the use of resources. This assists with budgeting. o Securitymonitors and restricts access to network resources. It is often much easier to secure data on a network compared to securing data on a large number of computers. Anti-virus software is used to protect the network from viruses. Regular backups are implemented for data stored on the network.

Programming
Six Basic Programming Concepts
Function (or keyword) - is a reserved word for a particular purpose such as class, public and private. Some functions are very powerful, such as if and while. Constant (or literal) - is an item of data with only one specific value. Constants are either numbers or strings (numbers and letters). Variable - is an item of data that may take different values, one at a time. They are storage containers used to hold data of the same type. Identifier - is the name of anything in a program such as a variable. There are some restrictions on the use of identifiers, such as always starting with a letter. Separator - is a symbol for grouping sections of the program such as { and }. The correct use of separators is essential otherwise the program will not work. Assignment statement - gives a value to a variable such as: x = 9. The general form of an assignment statement is: variable = expression. The expression can contain other variables such as: y + 1. This will result in the assignment statement: x = y + 1.

Data Types
Data type is the kind of data that can be stored in a variable. To create a variable it must be declared. Variable declaration involves stating the data type of the variable and an identifier or unique name for the variable. Most programming languages have the following data types: o Integer number is a whole number without fractional parts o Floating-point number is a number with the fractional parts o Boolean is used to store values that have one of two possible states such as true or false o Character is used to store one character such as a letter, number or symbol o String is used to store more than one character.

Data Operators (used to represent an action such as calculation)


Arithmetic operatorperforms a calculation such as addition (+), subtraction (), division (/), multiplication (*), powers (^) and modulus (%). Calculations are carried out using the standard order of operations. Relational operatorcompares two values and returns a boolean (true or false) result. Relational operators include less than (<), greater than (>), less-

iRuler 2008

than-or-equal-to (<=), greaterthan- or-equal-to (>=), equal-to (= =) and notequal-to (!=). Logical operatorcompares two values and returns a Boolean (true or false) result. Logical operators include AND (&&), OR (!!) and NOT (!).

Algorithms, Pseudocode and flow charts


An algorithm is a series of steps designed to solve a problem in a finite time. An algorithm can be used to solve many types of problems. Algorithms are not programs but are an important part in the development of a program.
Algorithm to make a phone call: Pick up the phone. Dial number. Deliver the message. Hang up the phone.

Pseudocode uses indented lines and keywords to describe an algorithm. Pseudocode is written using a word processor and is similar to many programming languages. There are different standards of pseudocode for different purposes; however, there are some generally accepted rules. The flow of control in pseudocode is always from the top to the bottom. The keywords are highlighted in capital letters (or bold) to emphasise them and to indicate the type of action being performed. These keywords are grouped together in pairs. For example, for every BEGIN there is an END, for every IF there is an ENDIF. Indentation is used to show the structure of the algorithm. A flowchart is a pictorial or graphical method of describing an algorithm. Flowcharts often make it easy to see the structure of the solution. However, it is very easy to draw a flowchart that is complex and difficult to change into a programming language. The basic elements of a flowchart are a set of symbols that contain messages and interconnecting lines. A set of standards for flowcharts has been established for a number of different applications. Most common Symbols Shown Below

iRuler 2008

iRuler 2008

Low-level Programming Languages


Low-level languages are the lowest level of computer languages and depend on the hardware of the computer. Programs written using low-level languages are often called machine code or assembly code. They process calculations much faster than high-level languages.

High Level Programming Languages


High-level languages use English-like codes where each statement corresponds to several lines of machine code. Programming languages such as Java, Visual BASIC and C++ are high-level languages. A compiler or interpreter translates a high-level program into machine code so the computer can implement the solution.

Sub Programs
iRuler 2008

A subprogram is a self-contained section of code that performs a particular task. In Java, subprograms are called methods. For example, the code below is a method in Java. It adds two integers (parameters) and returns the result to the calling program (larger program).
Public int add2Int (int x, int y) { Int result; result = x + y Return result; }

Subprograms have a single entry point and suspend the calling program until they have finished. Subprograms have the added advantage of being reusable. Programmers may use the same subprogram many times in different problems. This reduces the time required to program. Programmers keep a library of subprograms they have written.

Data Structures
A file is a block of related data stored on a storage device. Programs are stored as files. A data structure used in many programming languages is called a record. A record is a collection of facts that are related in some way. Records are a fixed length and are divided into one or more fields. A field is a specific piece of data in a record. Shown below is a record that consists of 17 characters: eight for field 1, seven for field 2 and two for field 3. Each record, irrespective of the data, would have a fixed length of seventeen characters. A record is usually a combination of other data types. The record below has a string data type and an integer data type. The ability to have different data types distinguishes records and arrays.

An array stores a list of elements of the same data type. An array is used to efficiently store large quantities of data. Each element within an array is numbered and accessed based on their number. To use an array the data type and the number of items must be declared. For example, array declarations in Java are shown below.
Int[] score = new int[10]; char[] vowel char[5];

The first statement creates an integer array score with up to ten elements. The second statement creates a character array vowel with up to five elements. After the array is declared each individual element can be used to store data. In the example below vowel[1] is storing the letter E.
vowel[0] = A; vowel[1] = E; vowel[4] = U;

Program Errors and ways of Detection and Correction


Logic errors result from an incorrect series of steps to solve the problem. The program with a logic error produces incorrect or unexpected results. Logic errors can occur if the algorithm does not solve the problem correctly.

iRuler 2008

The algorithm should be tested before coding to eliminate logic errors. It is often a difficult task to find and correct logic errors. Syntax errors are made when the programmer has failed to follow the rules (syntax) of the programming language. A syntax error may be a spelling error or a symbol that cannot be translated. When the program is compiled or interpreted, an error message will appear if the program contains any syntax errors. Correcting any syntax errors is usually a simple task. Run-time errors occur when it is impossible for the computer to carry out the instruction. For example, if a calculation attempted to divide a number by zero it would be a run-time error. The instruction has the correct syntax but it is not possible to carry out the instruction. Incorrect data can often produce a run-time error. There is a range of strategies to detect and correct errors: Desk checking involves the programmer checking each line of code. Desk checking takes place after the algorithm has been written and again after it has been coded in the programming language. The programmer executes the program the same as the computer. Desk checking provides a way to see exactly what code is being executed and the flow of execution through the program. A desk check usually involves watching the variables. A list is constructed containing the names of variables and their values. The list of variables is updated after each step of the desk check. If the desk check is performed by somebody other than the programmer it is called a peer check. Breakpoint is a roadblock in the execution of the program. When the program reaches a breakpoint it stops. Breakpoints are useful in isolating sections of the code and analysing them. Software debugging tools are available for most programming languages. A debugger is a program that will perform the desk check electronically. They are often used with a breakpoint to watch the variables in a section of code. Debuggers are only tools to find problems and do not provide the solution to the problem.

Control Structures
Programmers solve a problem by designing an algorithm and then coding the algorithm into a programming language. Algorithms and programming languages consist of control structures. Control structures are the building blocks of the program. There are three basic control structures: sequence, selection and repetition.

Sequence
Sequence is the order the steps are executed. In pseudocode, the steps are placed between BEGIN and END (see the problem below). The sequence of four steps is indented to show structure and to improve the readability of the algorithm. The flow of control is top to bottom, starting at the first step and finishing at the last step. Flowcharts always start and finish with a terminal symbol (oval). The steps are placed between these symbols and joined by flowlines. The direction of flow is down the page between the terminal symbols.

Problem: Design an algorithm to wash your hands.

iRuler 2008

Pseudocode solution BEGIN Wet hands Clean hands with soap Rinse off soap Dry hands END Flowchart for this shown

Selection
Selection is used to make a logical decision. It requires a choice to be made between two or more options. The choice is made depending on the answer to a condition. There are two types of selection: binary and case. - Binary selection involves two choices. In pseudocode, the keywords IF THEN ELSE are used for binary selection (see the problem below). The condition is put after the IF keyword. There are only two possible answers to the condition, true or false. If the condition is true then the process after the THEN keyword is executed. If the condition is false then the process after the ELSE keyword is executed. The ELSE statement is not always required and can be omitted. In a flowchart the selection is made using a decision symbol (diamond). The condition is placed inside this symbol and the answer must be true or false. It is very important that the two flowlines from the decision symbol are labelled with true or false to determine which path to follow. The two flowlines join together to complete the binary selection.
Problem: Design an algorithm for turning on the lights. Pseudocode solution BEGIN IF night THEN turn lights on ELSE turn lights off ENDIF END Flowchart solution shown

Case selection (or multiway selection) involves more than two choices. In
pseudocode, the keywords CASEWHERE ENDCASE are used for case selection (see the problem below). The condition is put after the CASEWHERE keyword. Careful thought is required to cater for all possible answers to the condition. The possibilities are indented under the CASEWHERE keyword with a process to be executed only if the answer is true. In the problem below there are three options: green, amber and red with a colon specifying the process to be carried out if the option is true. In a flowchart the case selection is made using a decision symbol (see below). The condition is placed inside the decision symbol with the answers above each process. The flow lines join together to complete the case selection.
Problem: Design an algorithm for a set of traffic lights. Pseudocode solution

iRuler 2008

BEGIN signal CASEWHERE colour of Green : Pass through lights Amber : Slow down vehicle Red : Stop vehicle ENDCASE END Flow Chart Solution Shown

Repetition
A repetition or loop allows a number of steps to be repeated until some condition is satisfied. The steps to be repeated are referred to as the body of the loop. It is very important that each loop contains a condition to stop the loop going on forever. There are two types of repetition: pre-test or post-test. In a pre-test repetition or guarded loop the condition is checked at the beginning of the loop before the steps to be repeated are executed. In pseudocode the keywords used for a pre-test repetition are WHILE ENDWHILE (see problem below). The condition is put after the WHILE keyword and the body of the loop between the WHILE and ENDWHILE keywords. In a flowchart the pre-test repetition is made using a decision symbol and flow lines. The condition is placed inside the decision symbol and checked before the body of the loop.
Problem: Design an algorithm for using seat belts in a car. Pseudocode solution BEGIN WHILE car is moving keep seat belts on ENDWHILE

END Flowchart solution shown below

In a post-test repetition or unguarded loop the condition is checked at the end of the loop after the steps to be repeated are executed. In pseudocode the keywords iRuler 2008

used for a post-test repetition are REPEAT UNTIL (see problem below). The body of the loop is underneath the REPEAT keyword and the condition is after the UNTIL keyword. In a flowchart the post-test repetition is made with a decision symbol and flowlines. The body of the loop is executed before the condition is met in the decision symbol.
Problem: Design an algorithm to cut the grass. Pseudocode solution BEGIN REPEAT Use lawn mower UNTIL grass is cut

END Flowchart Solution shown

iRuler 2008

You might also like