What is a computer?



Download 2.81 Mb.
Page8/8
Date15.10.2019
Size2.81 Mb.
#54234
1   2   3   4   5   6   7   8
Computer Notes for Grade 11 final copy

Weather forecasting

High-speed computers play a significant role in weather forecasting. They can process the gathered data and easily give the next few days' weather forecasts. The computers also support scientists to develop new weather models for improving the quality of weather forecast.


Computer in the home
Teach children

  • Play games- recreational activity for family members

  • Do word processing

  • Send e-mail

  • Research – use of electronic encyclopedias

  • Watch movies, play CD’s – use of a multi-media feature of modern computers

A new area where computers are having an impact in the home is the use of personal robots.

Law enforcement

Law enforcement agencies and organizations use computer technology to help them investigate crimes and misdemeanors and settle cases faster and more efficiently. The names, photos and details of criminals are kept on databases, and software is used to help solve crimes. Civil law enforcement is used to maintain general law and order. Traffic fines come under civil law enforcement.

Here are the software requirements:


  • database management systems that can store large amounts of data, such as photographs and fingerprints

  • software that can compare and collect forensic and other evidence relating to crimes, such as software that can analyse DNA results and software that can create an identikit image of a suspect

  • software for monitoring, such as phone-tapping software or software that the police use to track vehicles and people.

Here are some possible hardware requirements:

  • microcomputers and servers for databases

  • scanners and printers

  • fax machines.

Law enforcement workers range from police officers to trained investigators in forensic labs. Different workers need different skills but most law enforcement workers need these skills:



  • scan in thumbprints, photos and other information that can be used to to solve and prevent crime.

  • use basic forensic equipment such as software that performs DNA analysis and matching.

  • access database records, such as the details of known criminals

In many parts of the world law enforcement officers use software to help with forensic analysis

IMPACT OF IT IN THE WORKPLACE

This section considers how people use computer technology to do their jobs and how computer technology affects them.

Computer skills

Staff are expected to have or to learn the computer skills they need to do their jobs. Job advertisements often specify exactly what skills are required.


Loss of jobs

Computers now do a lot of work that used to be done by people. Robots and machines can do difficult tasks, dangerous tasks and repetitive tasks without losing concentration or getting tired. Computers have made many office workers redundant. Messengers used to deliver messages between offices and buildings in a city. Now people send e-mails. As computers are used more and more in the workplace, people with few computer skills may be replaced by people with many computer skills.


Retraining

Employees need to be trained how to use some software. They need to be retrained if the software is updated or replaced with other software. To keep up with the latest technology, people need to be trained at work, at school and in tertiary education. Training is often costly, especially in businesses,

Training materials can be expensive and the business loses productive hours from its employees. But properly trained employees can do their jobs better and will not struggle with unfamiliar programs and software.

Telecommuting

Computer technology allows many people to work from home instead of travelling to a workplace. These workers are usually people that need few meetings with clients or colleagues. Many writers and editors can work from home. They need to have a computer and internet access, and they may be able to connect to the office network. A person who works from home saves on travel time and travel costs. Working at home is less stressful than working in an office and there is no need to wear office clothes. But there is very little social interaction and it can be very lonely. It is very difficult for managers to monitor employees who work at home,



Creation of jobs

Computers have replaced jobs but they can also create them. All computer hardware and software has to be developed and manufactured, which creates jobs for software engineers and technicians. There are jobs for software experts and jobs for people who maintain hardware and troubleshoot problems.


Computer-related professions

  • Programmers: there are many programming languages and programmers are usually proficient in more than one. Programmers write code for a wide range of programs from business software to games.

  • Systems programmers: they design and write systems programs. Programmers may write small areas of a program, but systems programmers have a greater understanding of the whole program.

  • Systems analysts and designers: they understand and analyse how a system or piece of software works. They gather the information to create or modify a program, break the solution into components and communicate the exact requirements to the programmers. Analysts often produce the documentation that accompanies a program.

  • IT managers: managers oversee and coordinate the work of programmers and analysts. They ensure that everyone does the work they should, that deadlines are met and that a budget is met.

  • Database administrators: they create and maintain databases and control people’s access to them. IT companies and other businesses use databases to store information.

  • Network administrators: they set up new networks, add and remove users, monitor resource use over a network, and ensure that all users have the necessary software and hardware. Any business that has a computer network should have a network administrator.

  • File librarians: they handle the accumulation of data. They store, archive and retrieve data, as well as controlling the distribution of data.

  • Computer technicians: they assemble and set up computers and they fix computer problems. They tend to be hardware experts with some software knowledge.

  • Computer engineers: they design computer configurations and determine the cabling and power requirements for a network. They develop computer chips.

  • Software engineers: similar to analysts, they work on the overall design and creation of software systems. They use mathematical and scientific processes to develop software.

  • Software testers: they test all aspects of a program using test cases (like real-life scenarios) and many different combinations of data. Software must be tested for errors.

  • Web developers: they create websites for the Internet.

  • Web masters: they put a finished website online and look after it. They make sure it works properly and update it when necessary. Sometimes the web master is the web developer also

  • Software trainers: they teach people how to use software, at workplaces or on courses. They explain and demonstrate all aspects of the software that the trainee needs to understand.

  • Multimedia artists and graphic designers: they combine computer skills with artistic flair to create computer graphics, adverts, animations and other forms of multimedia.


Change of job skills

  • As the use of computers continues to grow in our society, jobs in every profession are being redefined. For example, twenty years ago the use of typewriters is a necessary skill for applying the post of secretary. Today, secretaries are required to know word processing software, e-mail and so on.

Here are some of other professions that might require computer knowledge:

  • Real-estate agents, lawyers, researchers and teachers need to use computers to search information.

  • Reporters and writers need to use word processing software to write and change documents.

  • Accountants, budget controllers, stockbrokers and insurance agents need to use spreadsheet software to analyze data.

  • Engineers and architects need to use CAD software to design products or buildings.


EFFECTS OF COMPUTERS ON SOCIETY

Information privacy refers to one's right to restrict or deny the collection and use of one's personal information.

Examples of ways personal information are collected through the Internet

Many web sites send cookies (a small file that allows a web site to record users' data) to the user browsers to collect personal information such as users' interests, preferences, and surfing patterns on the web sites.

In order to establish an e-mail account or become a member of a web site, you have to do a registration. In the registration process, you need to complete a questionnaire from which your personal information such as name, postal and e-mail addresses, telephone numbers and so on are gathered by the web site.



The misuse of personal information

New technology sometimes is not accepted by everybody. One may refuse to use e-mail or a credit card. The most common reason cited for this attitude is the fear of one's personal information being misused. Here are some examples of misuse of personal information:

A magazine publisher may sell subscriber lists to direct marketers, fund-raisers, and others.

An employee of a telephone company may be bribed by a loan collection company to provide addresses and telephone numbers of loan borrowers by performing computer searches.

A company may send employees to the Registrar of Marriages offices to gather publicly accessible information about people who will marry in the next few weeks. Then, this information is sold to restaurants, bridal photography salons, travel agencies, real-estate agencies and so on so that they can market their business.


Intellectual property

Software acquisition



Software license: when a buyer is purchasing software, he/she is not actually purchasing the software, but the license to use the software on a computer. The licensing agreement specifies how the software should be used. For example, the numbers of copies users are allowed to make.
Site license: it is an agreement that grants the buyer of the software the right to use that software on a given number of computers. The price is less than that of buying a separate copy for each computer.
Network version: it permits the buyer to purchase just one copy of the software (in network version) that can legally load into his/her network server.
Shareware: it is software distributed free for a trial period. If the user wants to use it regularly, he/she should pay for it on an honor system.
Freeware: it is software that is provided to users at no cost, but it is still copyrighted. It means resale of it is not allowed.
Public-domain software: it is a freeware with no copyright restrictions.
Here are two examples of committing a criminal offence after the amended law takes effect:

An IT training instructor buys one copy of software which is licensed for use in one computer only. But he installs this software in all the computers in the computer laboratory.

An IT manager of a trading company buys one copy of accounting software which is licensed for use in one computer only. But he asks his subordinate to install it in a LAN server for shared use by all the employees in the accounting department.

Ethical issues

What is ethics?

Ethics deals with what is considered right or wrong. In theory, one can distinguish between illegal acts and unethical acts. An illegal act breaks the law, but an unethical act may not break the law. In many cases, illegal acts are unethical as well.

Examples of ethical issues


  • A teacher reads a student's e-mail.

  • A student forwards an e-mail message to the whole class without permission from the e-mail sender.

  • Your friend, who is not studying in your school, asks you to borrow your password to get access to your school computer system.

  • The use of computers monitors the job performance of employees. For example, a computer program is used to monitor the typing speed of typists without the knowing of the typists.


Natural Language Processing

Natural language processing involves computers that recognize and understand human speech and generate speech to communicate with humans. The goal of the Natural Language Processing (NLP)is to design and build software that will analyze, understand, and generate languages that humans use naturally, so that eventually you will be able to address your computer as though you were addressing another person.


Expert Systems

Definition contains

An expert system is a computer system which emulates the decision-making ability and expertise of a human expert. An expert system knowledge derived from an expert in some area or field. This knowledge is used to help individuals using the expert system to solve problems. It is a computer application that performs a task that would otherwise be performed by a human expert. For example, there are expert systems that can diagnose human illnesses, Weather stations use software that can analyses the current weather conditions to predict what the weather will be like over the next few days.

Expert systems are important for tracking hurricanes and other natural disasters.

Sophisticated laboratories use software and equipment that can analyze blood samples and tissue samples.

Expert systems are very reliable because they cannot make biased or unsound judgments, but they have to be kept up to date with the latest scientific information.

INFORMATION SYSTEMS
Components of information processing

Data is raw facts and figures that may not make much sense on their own, such as a series of digits entered into a computer.

Information is the usable result you get after data has been processed. It is data organized into a meaningful format.

Information processing describes the many ways that data is gathered and interpreted. The output depends on the interpretation of the input. For example, an alarm system uses sensors to detect movement in a room. If there is movement, this data is processed to set off a siren.



BENEFITS

  • Information processing has many benefits that make our lives easier and more efficient:

  • It makes a lot of tasks easier and faster. For example, you are able to pay bills online or at a supermarket, which saves you going to the place that issued the bill.

  • A lot of data is stored during information processing. Stored data is quick and easy to access and it does not have to be processed or examined again. This results in automation. Multiple tasks are performed without you even knowing about them. These tasks require little or no control by humans. It enables sharing and analysis of information. Information is easy to pass along and stored

  • Information is easy to access and analyse. This means that trends can be spotted faster and people can share ideas on how to improve processes.

  • Once an information processing system has been set up, it is often easy to maintain

DISADVANTAGES

  • It can be very expensive to set up initially because of the hardware, software and technical requirements.

  • Depending on the system, it can be expensive to maintain. Hardware and software must be replaced and kept up to date, and specialists are often needed to operate these systems.

  • We are very reliant on information processing systems. When they fail or do not work properly, it can cause disruption and disorder. If an automatic teller machine (ATM) is not working, people will be unable to withdraw money and complete other transactions.


Forms of information processing

Information is processed in several ways:



Monitoring And Control Systems
Control systems regulate themselves or other devices; they are widely used in our everyday lives: Household appliances, such as microwaves and washing machines, use control systems to sense when they should start, how they should operate and when to stop.

Traffic lights are programmed to control the flow of traffic. Many traffic lights also contain sensors that can tell when there are cars waiting at a red light and change it to green.

Alarm systems use heat and motion sensors to determine whether an intruder is in a room.

Thermostats sense when the temperature is below a set value and switch the heating on. They switch off when the temperature reaches another set value.



Commercial information processing

In business and commerce, information processing is important to keep track of transactions and records. Shops use point-of-sale (POS) systems and bar code scanners to read prices on items and keep track of stock. Businesses use databases to store records about customers, employees and suppliers. Payroll systems are very important to calculate employees’ salaries and print payslips. You can do banking at ATMs without entering a bank. The ATM (automated teller machine) reads your personal ATM card and your secure personal identification number (PIN) to activate a session. The PIN prevents other people from using your card. Electronic banking is a very useful information processing system. Many banks offer an internet banking service, which allows you to conduct many transactions from your bank account over the Internet. You can also do an electronic funds transfer (EFT). EFT transfers money from one account to another without using cash or cheques. Many people pay for purchases at shops using their bank cards. This is a form of EFT. The customer’s card is inserted into a POS terminal and funds are transferred from the customer’s bank account to the shop’s bank account.


Industrial information processing

Information processing is a very useful and important tool in manufacturing and production industries. Computers automate tasks and do them more efficiently and effectively than humans. They control robots to package products or assemble cars and electronics. Electronic circuit boards are often assembled using computer systems.


Scientific information processing

Expert systems help scientist’s process data. Here are some more examples of scientific information processing:

Weather forecasting systems collect weather data all over the world and use the data to predict weather patterns.

Health-care professionals use automated processing systems to keep track of patient records. They also use robots to perform heart and eye surgery.

Laboratories have machines that can read and process data from samples. For example, a machine can analyze a blood sample and find its blood type.

Sources of data

To create useful information from data, you must get that data from a suitable source. Data can be captured using machine-readable or human- readable documents. Machine-readable documents are documents that a computer can read. Human-readable documents are documents that a human can read.



Source document

A source document is a document used to capture information by writing it down. Source documents are human-readable, which means that a person will read and enter information into that document. The best example is a form, which may be a hard copy (printed copy) or electronic copy (soft copy). A form contains spaces and blocks that allow a person to enter relevant details. The data is then entered into a computer. Forms are used for surveys, censuses, opinion polls, applications and market research, among other things.



Turnaround document

A turnaround document is human-readable and machine-readable. A machine creates it and a human adds more data or uses it as input for something else. The document is then read by a computer, which updates or processes records with the new data. Examples are utility bills, such as water bills, with the perforated section that is completed by the customer and then used as input.


Information retrieval and management

Data has to be captured before it can be processed. Data from source and turnaround documents must be entered into a computer. This can be done using direct methods or indirect methods. Direct methods of data capture are when a computer uses sensors or peripherals to capture the data directly from the document. Turnaround documents are designed for direct data capture. Data can be captured in several ways:



Optical Mark Recognition

Magnetic Ink Character Recognition

Bar Codes

Optical Character Recognition.(see Input Devices),
DATA VALIDATION AND VERIFICATION

Data can be collected using sensors. Data about weather, temperature, traffic flow, speed, noise, heat and much more can be captured using sensors. Remote sensors allow data to be captured from a distance. The data is transmitted via telephone cables or radio signals.

Indirect methods of data capture are when data has to be taken from a source document and physically entered into a computer. A person called a data capturer, or data entry clerk, types everything on the document into a computer. It does not require direct input technology but it is error-prone and quite time-consuming.
Validation and verification
You cannot assume that all data entered and used by computers is accurate. Humans can make mistakes and it can be very easy to enter incorrect or inaccurate data when you are tired, in a hurry or simply by accident. This may cause a program to malfunction or cause incorrect information to be stored about someone or something. Imagine you applied for a passport and the data capturer entered your birth year as 1903 instead of 1993. Your passport would say that you are over a hundred years old. A human error during data input can be accidental or deliberate:

Accidental errors are errors that are not made on purpose. The incorrect birth year on the passport was an accidental error. Another accidental error is when someone transposes characters to get, say, 1893 instead of 1983.

Deliberate errors are errors made on purpose, usually for gain or to cause disorder. To get a bigger loan, someone may enter false information about their salary on a loan application.

Types of Errors

A transcription\typographical error (often shortened to typo) is a mistake made in the typing process (such as a spelling mistake).

Transposition errors occur when two digits that are either individual or part of a larger sequence of numbers are reversed (transposed) when entering data. 

There are two ways to prevent data errors caused by humans: data verification and data validation.


Data verification

Data verification ensures that data entered into a computer contains no errors at all. It is a very thorough way of making sure the data entered is correct. Two methods of data verification are double-entry and proofreading.



Double-entry is where the same data is entered twice, sometimes by different people. If the data differs between the two entries, it does not get processed. It can be expensive and time-consuming to use this method, but it does ensure very accurate data capture. A simpler example of double-entry is when a program asks you to retype a password, such as when you set up an e-mail account. Double entry asks you to type the password twice and accepts the password only if the two versions match.
Proofreading checks the data entered against the data on the original source document. The person entering the data reads the source document and checks that it matches what he or she has entered into the computer. Sometimes a second person will check the entered data. This is very time-consuming.
Data validation

Data validation uses a variety of checks to make sure that data is as accurate and complete as possible. It does not check the complete accuracy of data, but it does help ensure that fewer mistakes are made. If data does not pass the checks, the program may return an error or the field will not be filled in. The checks compare the user-entered data against a rule. The check depends on the type or nature of data that is entered. Many databases such as Microsoft Access use a variety of the checks to ensure correct data is entered.


Range checks

A range check ensures that numbers entered fall within a specific range. If you are entering times of the day, you may need to check that the values for hours cannot go higher than 24. If someone enters 25hrs by mistake, that value will not compute.


Reasonableness checks

Reasonableness checks ensure that data is reasonable — not completely unrealistic. If you are entering salary information into a payroll system, a reasonableness check will ensure that you do not enter extra zeros by mistake.


Data type checks

Data type checks, or character checks, ensure that the right type of data has been entered. They may ensure that only numbers have been entered in a field for numbers. Eg, A field that captures the age of person may have a character check that rejects the input of letters or symbols.


Consistency checks

Consistency checks compare data you have entered against other data you have entered. If you enter a person’s year of birth and their age in separate fields, a consistency check will ensure that the two fields correspond with each other. Consistency checks can be used to make sure that false or dishonest data has not been entered.



Presence checks

Documents and forms have required fields and optional fields. A required field is one that has to contain a value whereas an optional field can be left blank. In setting up an email account, your username and password may be a required fields and your cell phone number may be an optional field. A presence check is used to ensure that the required fields contain data.


Length checks

Length check determines whether the entered data is the correct length the right number of digits. Area codes and phone numbers usually have fixed length. If a number is entered that is longer or shorter than this length, the program will return an error. An easy way to ensure that data is the correct length is to create a field that will not allow the user to continue less all the spaces for digits have been filled in.


Parity checks

If a computer needs to understand data, the data must be reduced to its basic form of 1s and Os. Data transmission is sometimes corrupted by changing a 1 into a 0 or a 0 into a 1. One change can be detected by adding a parity bit. In an odd-parity system the parity bit is set so the total number of is in a bit pattern is an odd number. In an even-parity system the parity bit is set so that the total number of Is in a bit pattern is an even number.

Suppose you want to send 10011 using odd parity, there are three 1s, three is an odd number, so the parity bit is 0.You send 100110, which consists of data 10011 and parity bit 0. Now suppose that one data bit is corrupted during transmission so the receiver gets 100010, which consists of data 10001 and parity bit 0. The received data contains two 1s, so the parity bit should be 1. The parity check has detected that a data bit was corrupted during transmission.
FILE ORGANIZATION AND ACCESS
Files and records need to be organized so they are easily accessible and easy to update when necessary. File organization and access relates to the use of records, fields and files. People and organizations capture and store a lot of data. A database is an organized collection of data.

. The database has several components:

A File is an entire set of data. A data file is a collection of records (such as a table in a database) holding the same types of information but about different objects or individuals.
Each row in a database table is called a record or tuple. A record is a collection of fields found in a file about a single person, object or event which is treated as a single entity for processing.
Each Column in a table is called a field or attribute. A field is a piece of data contained in a record. Each field has a field name or column heading. Eg supplier’s name, address, type of product they supply, payment details, and so on. A field contains a single data item, and many fields comprise a record. One field is the key field used to identify the record. There are several types of key fields. These include:
Primary Key uniquely identifies each record. Eg an Id number or a TRN number.
A foreign key in a table is the primary key from another table used to join or create a relationship between the two tables.
A candidate Key uniquely identifies a record. It could be used as a primary key, but it is not used. Eg an employye number is used as a primary key, but the employees TRN or NIS number could be used as primary key also, therefore they are considered candidate keys.
Composite key/Combination keys- This is where two or more keys are used as primary key. They are used to uniquely identify a record.
Secondary Key are not unique, but may assist in finding a record. For eample to find a student who lives in Bridgeport in a large database. The Town Brigeport may be located first then the students record could be searched for within that group.
Sequential File Ordering and Access

Sequential file ordering is where records are stored in a logical order. In an office environment many records are kept in sequential order, such as an alphabetical order. It makes sense to sort them in sequential order, so they are easier to understand if you have to view a large number of records at once.

Sequential accessing access means records one by one in the order that they are stored until the right one is reached. This type of access is used with sequential tile ordering. It can be slow if there is a lot of data to go through but it is very effective for accessing, viewing and modifying records in batches.
Serial File Ordering and Access

Serial file ordering is similar to sequential file ordering, except the records are not stored in any order. They are simply stored one after the other as they are added, similar to new items on a to-do list. This type of ordering is often used to capture transactions as they occur during the day. This is useful because it provides an easy way to go back and check a transaction. Serial access works in the same way — the records are read or one in the order they are stored until the desired record is found.


Random File Ordering and Access

Random file ordering, also known as direct access file ordering, is where files are stored in no particular order (randomly). The computer maps where all this data is stored so you can immediately access it when you search for it. This type of file ordering is useful if you want fast access to records, or if you want to store data that is unrelated or does not need to be in any particular sequence Random access, or direct access, allows you to access the record you want without having to go through any others. The computer locates the data item using the indices.


Index Sequential File Ordering and Access

Index sequential file ordering uses an indexed file to store records. In other words, records are stored in this file in sequential order and a set of indices are used to refer to each item stored in the file. Each record can be accessed via its index number. This file ordering is a combination of sequential and random file ordering and is used when records need to be sorted in sequence but individual records must be quickly accessible.

Index sequential file ordering uses both types of access to search for records, Sequential access is used to go through each record, and direct access is used to find a specific record.
Using methods of ordering and access

The way that records are stored and accessed depends on the types of record, what they are used for and even the form of storage, For example a bank may store data about its daily transactions using magnetic taps which stores data using sequential file ordering. Therefore sequential access is used to access those records.



Master and transaction files

Many files businesses and organizations regularly access, modify and store large amounts of files. These are given special names to identify their purpose. A master file is a permanent file which is kept up-to-date and stores the main information, summary data and key fields in the data.

The master file contains two types of data:

• Permanent data, such as employee personal data, payroll data employee status and job title

• Less permanent data, which is updated on a regular basis, such as hours worked and taxes deducted.

A master file is the most important file because it is the most complete and up-to- date version of a file and contains permanent information. If a master file is lost or damaged and it is the only copy, the whole system will break down.

A transaction file is a temporary file which is used to update the master file after a certain time (at the end of each day or week, for example).The transaction file updates the master file. The records in the transaction file are used to perform three important operations:

Add: put a new record into the master file.

Update: change the contents of a record or a field that already exists.

Delete: remove a record from the master file.

Transaction files are used to hold temporary information, which is used to update the master file. The same primary key is used to sort both files. Updates to the master file are done at pre-determined intervals. Transactions can occur in any order, so it is necessary to sort a transaction file into the same order as the master file before it is used to update the master file.

There is also another file, known as the change file or transaction log, which keeps a record of changes to the transaction file. This is important, as many businesses need to record the history of what transactions have taken place and not just the latest one. Transactions are bits of business such as placing an order, updating the stock, and making a payment. If these transactions are performed in real time, the data input will overwrite the previous data. Then it will be impossible to check past transactions, making it easy for people to commit fraud.

The transaction log file is a record of the transactions. It shows all the transactions made over a certain period. Using the log, you can see what the data was before the changes were made, what the changes were, and who made them. Transaction log files therefore maintain security and can also be used to recover transactions lost in a hardware failure

Backup or security files

Backup copies of files are kept in case the original is damaged or lost and cannot be used. Because of the importance of the master file, backup copies should be taken of it at regular intervals in case it is stolen, lost, damaged, or corrupted.



The grandfather, father, son principle

There is always a slight chance that the data contained on a master file might be destroyed by an inexperienced user, a power failure, a fire, or even theft. For a large company, the loss of vital data could prove disastrous. Using the grandfather, father, principle (it is possible to recreate a lost master file. The principle works like this. Three generations of files are kept. The oldest master file is called the grandfather file and is kept with its transaction file. These two files are used to produce a new master file called the father file. The father file and its transaction file are used to create the most up-to-date file, called the son file. When the process is repeated, the son becomes the father and the father becomes the grandfather. Only three generations are needed and the other files may be reused. This is called the ancestral file system and is usually used for magnetic tapes.


PROBLEM SOLVING

A problem is a discrepancy between what exists and what is required. Meaning that if the current situation could be improved on or requires a solution. Then a problem exists.

Problem Solving is the process involved in arriving at a solution to a problem.

Steps in Problem Solving


  1. Identify the problem

  2. Define the problem

  3. Analyze the problem

  4. Develop an Algorithm

  5. Test the algorithm

  6. Write the program in a programming language

  7. Test and Debug the Program

  8. Implement the program

Step 1 and 2

Identifying the problem means coming up with an idea of exactly what the problem is. This is usually followed by a problem definition which is a statement that tells exactly what the problem is.

Step 3


Analyzing the problem involves thinking about how to solve the problem. One way to do this is to break the problem down into smaller problems, (sub problems) then solving each sub problem, then combining the solution in order to solve the bigger problem. This is called Top Down Design.

Stepwise Refinement is a more precise method of problem partitioning; this is where the problem is broken down into smaller problems. Then each smaller problem is broken into even smaller sub problems.

IPO charts or defining diagrams are often used to break problems in their component parts.

Input- Data needed to solve the problem

Process- The actions that should be carried out on the data entered in

order to arrive at a solution.

Output- The result of processing.


Example. Write a program to read two numbers and calculate their sum.
INPUT PROCESS OUTPUT

Number1


Number2 Sum= Number1+Number2 Sum

Step 4


An algorithm is a list of instructions, procedures, method plan, approach or formula used to solve a problem
Types of algorithm:

Pseudocode- This is writing an imitation program using English like terms and mathematical notations to outline the steps involved in solving a problem. Pseudocodes are easily converted to a programming language.

Narrative: Writing the steps to solve a problem in full English sentences.

Flowcharts uses symbols to logically organize the sequence of steps used to solve a problem.
PSEUDOCODES

A Pseudocode is a series of step by step instructions written using English –Like terms and Mathematical Notations. It is an imitation programming language that can easily be converted to actual programming code.


Advantages of Pseudocodes

  • Helps programmers work out the logics of a program in a language they understand

  • Can be converted to programming code easily


Writing a Pseudocode

There are three basic types of statements used in pseudocodes:


Input Statements

Assignment Statement

Processing statements Conditional Statements

Loop Statements

Output Statements
An input statement is used to create a named location in memory. This location is used to accept users input. This named memory location may be a constant or a variable. It can store only one data item at a time
Categories of data used in a program or algorithm

Variables- this is the name given to a location in memory whose value may change during the execution of a program.

Constants- this the name given to a location in memory whose value will remain fixed, unchanged during the execution of a program.

Eg. Pi= 3.14

Once Pi is declared 3.14. it will retain that value during the execution of the program.

Literal- An actual value used in a program.

Eg. Sum= sum + 1

The number 1 would be a literal.


Data Types
Integers Negative and positive whole numbers.

Real Negative and positive floating point/decimal numbers.

String Two or more characters.

Char a single letter or symbol on the keyboard.


Input Statements
To write an INPUT Statement we use an Input keyword and a variable name.

The Input keywords are

READ

INPUT


GET
A variable name is created by the programmer. It can be a letter or word or a combination of letter and number or word and number. The number must come after the letter or word. A variable can store only one data item at a time. It is good programming practice to name the variable based on what it will store.
Examples of Input statements:
READ Number OR INPUT Number OR GET Number

Read Num1, Num2 OR INPUT Num1, Num2

OR GET Num1, Num2
Or READ Num1

READ Num2

Note: variables are listed across separated by commas or listed going down using a keyword for each line.
Assignment Statements are created using the assignment operator (=) or !. They are used to store the value or expression on the right (RVALE) in the variable on the left (LVALUE). Assignment statements are used to give value to a variable or to perform calculations.
Format

Variable =Value or expression


Example 1

Sum =5 or Sum 5 (this stores the value 5 in the variable/memory location Sum.)


Example 2

Sum←num1 + Num2 or Sum = num1 + Num2 (the values store in num1 and num2 are added and the result stored in the variable/memory location Sum.)


Output Statements

Output Statements are used to display the contents of variables or text enclosed in quotations.

To Display the content of a variable the output keywords:

Print, Display, Output and Write May be used.

Format

Keyword variable



Example

Print sum


Write Result

Output sum, product

Display Sum, Average
An output statement can be used to give and instruction or information to the user of the software. Text that gives instructions is called prompts. Both are usually enclosed in quotations and are displayed as is. This requires only a keyword and the text.
Example

Write “Enter a Number” (This would display the text: Enter a Number)


Both processes can be combined if separated by comma.
Example

Write “The Total is “, Sum (This would display The Total is 45 if the value stored in sum is 45).


Conditional Statements are used for the selection control structure that gives the computer the ability to make decisions. A condition may evaluate to either true or false.


  • if-then endif

  • if-then-else endif


The if-then endif Statement

The if-then endif statement tells your program to execute a certain section of code only if a particular condition or test evaluates to true. If the condition evaluates to false, the statement ends.


Format
IF condition then

Statement(s)

endif
Example: Write a pseudocode to read two numbers into variables A and B and print A if it is greater than B.

Read A, B

If A> B then

Write A

Endif
The if-then-else Statement

The if-then-else statement provides a condition and statements to be carried out if the condition is true and statements to be carried out if the condition is false.

Format
IF condition then

Statement(s) if True

Else

Statement(s) if False
Endif
Example
Write a pseudocode to read the grade of a student and output pass or fail for each student if the pass mark is 50.
Read Grade
If Grade >50 then

Write”Pass”

Else

Write “Fail”

Endif
LOOPS/ ITERATION/REPITITION

Types of Loops


  • For LOOP

  • While LOOP

  • Repeat Until LOOP


For Loop
The for loop is an definite loop meaning the steps are repeated a set number of times.
Format

For variable =1 to N do

Statement(s)

Endfor
Note:( N represents the number of times loop should be repeated)
Example: write a pseudocode to read 100 numbers.

For count =1 to 100 do

Write”Enter a number”

Read Number

Endfor

Accumulators are used to accumulate or continuously add, multiply values in a loop.

An accumulator has to be initialized ( given a starting value).

Values entered into the algorithm are then added to the accumulator, meaning the accumulator is equal to itself plus the value entered by the user.
Example: Write a pseudocode to read 100 numbers and calculate and output their sum.
Sum= 0

For count =1 to 100 do

Write”Enter a number”

Read Number

Sum=Sum+Number

Endfor
Sum is the variable used as the accumulator. It is initialized to zero, then the Number entered by the user is added to Sum then stored in Sum.
While Loop
Properties of a good algorithm

  1. It must contain a finite number of steps.

  2. It must be precise and unambiguous (clear, having one meaning).

  3. There must be a logical flow from one step to the next.

  4. It must solve the problem


Methods of Testing
Dry Run/Manual walkthrough/Desk Check this involves reading through the algorithm line by line in order to expose errors in logic or find out if the steps are complete and accurate.
Trace Tables are used to check an algorithm with loops. They are tables used to identify the changes in values of a variable as it passes through the different loops and calculations.

The data used to test or check an algorithm for accuracy is called Test Data.


Step 6
Programming languages have evolved tremendously since early 1950's and this evolution has resulted in over hundreds of different languages being invented and used in the industry.

Low Level Languages

Low level computer languages are machine codes or close to it. They are machine dependent, meaning program codes are written to a particular machine and, the code written, cannot be used on another machine, meaning it is not portable.


There are two types of low level languages:

  • Machine Language.

  • Assembly Language

The First Generation Language/Machine Language is basically the only language which the computer can understand. It is a String of binary digits (bits) 0 and 1. In order to write programs the programmer must have in depth knowledge of the internal operations of memory and the processor.

Example

1000 0001

1001 0010
Advantages of Machine Language


  • It makes fast and efficient use of the computer.

  • It requires no translator to translate the code i.e.Directly understood by the computer.

Disadvantages of Machine Language:

  • All operation codes have to be remembered

  • All memory addresses have to be remembered.

  • It is hard to amend or find errors in a program written in the machine language

  • These languages are machine dependent i.e. a particular

  • Machine language can be used on only one type of computer


Assembly Language/Second Generation Language
Assembly Language was developed to overcome some of the difficulties faced using machine language. It is another low level language as it in machine dependent. In Assembly Language all the operations are in the form of codes instead of 0’s and l’s. These are called mnemonic codes e.g. ADD for addition, SUB for subtraction, START, LABEL etc. The instructions of the Assembly language must be converted to machine codes by a language translator called an Assembler before they can be executed by the computer.




Example

ADD B,20


LOAD num

MULT 2,5


Advantages of Assembly Language

  • It is easier to understand and use as compared to machine language.

  • It is easy to locate and correct errors.

  • It is modified easily


Disadvantages of Assembly Language

  • Like machine language it is also machine dependent.

  • Since it is machine dependent therefore programmer should have the knowledge of the hardware also.


High Level Languages

High level computer languages give formats close to English language and the purpose of developing high level languages is to enable people to write programs easily and in their own native language environment (English).


Advantages of High Level Language


  • User-friendly

  • Similar to English with vocabulary of words and symbols

  • Therefore it is easier to learn.

  • They require less time to write.

  • They are easier to maintain.

  • Problem oriented rather than 'machine' based.

  • Program written in a high-level language can be translated into many machine language and therefore can run on any computer for which there exists an appropriate translator.

  • It is independent of the machine on which it is used i.e.Programs developed in high level language can be run on any Computer

Disadvantages of High Level Language


  • A high-level language has to be translated into the machine language by a translator and thus a price in computer time is paid.

  • The object code generated by a translator might be inefficient Compared to an equivalent assembly language program


Types of High Level Languages
Third Generation Languages

Third generation Languages refers to a high-level programming language such as FORTRAN, Java, COBOL, BASIC, Pascal and C that uses English words and symbols that is easier for humans to understand. They are machine independent, meaning the same program can be used on different types of machines.



 

Fourth Generation Languages

4GLs are more programmer-friendly and enhances programming efficiency with usage of English-like words and phrases, and when appropriate, the use of icons, graphical interfaces and symbolical representations. Many 4GLs are associated with databases and are based on the Structured Query Language (SQL).



Difference between Third Generation and Fourth Generation Programming Languages (3GL and 4GL)?

Third generation languages often followed procedural code, meaning the language performs functions defined in specific procedures on how something is done. In comparison, most fourth generation languages are nonprocedural.


Fifth Generation Languages

A fifth-generation programming language (abbreviated 5GL) is a programming language based on solving problems using constraints given to the program, rather than using an algorithm written by a programmer. Fifth-generation languages are designed to make the computer solve a given problem without the programmer. This way, the programmer only needs to worry about what problems need to be solved and what conditions need to be met, without worrying about how to implement a routine or algorithm to solve them. Fifth-generation languages are used mainly in artificial intelligence research. Prolog, OPS5, and Mercury are examples of fifth-generation languages



Difference between Fourth Generation and Fifth Generation Programming Languages (4GL and 5GL)?

  • Fourth generation programming languages are designed for a specific application domain, while fifth generation programming languages are designed to allow computers to solve problems by themselves.

  • 4GL programmers need to specify the algorithm in order to solve a problem, whereas 5GL programmers only need to define the problem and constraints that need to be satisfied.

  • 4GL are mainly used in data processing and database handling applications, while 5GL are mostly used for problem solving in AI field.

Compiler vs Interpreter

Compiler and interpreter, both basically serve the same purpose. They convert one level of language to another level.



Compiler

A compiler is defined as a computer program that is used to convert high level instructions or language into Machine code. After compilation a separate object code is generated. The Object Code is the Machine language version of the source code that is generated after compilation.


Interpreter

The interpreter translates high level language line by line into machine language. As each line is interpreted, the high level program is executed directly. That is the reason why some programmers use interpreters while making small sections as this saves time.

.

Difference between compiler and interpreter

• A complier converts the high level instruction into machine language while an interpreter converts the high level instruction into an intermediate form.

• Before execution, entire program is executed by the compiler whereas after translating the first line, an interpreter then executes it and so on.

• An independent executable file is created by the compiler whereas interpreter is required by an interpreted program each time.




Source code", is a term used to describe text that is written using the syntax of a particular programming language, such as C, Java, Perl, PHP, or others.

Step 7
Test and debug the Program

When a program has been completed, the programmer needs to execute or run the program. If it does not perform the tasks that it should then he needs to check for errors. An error in a Program is called a bug. The process of getting rid of errors is called debugging

Types of Errors

Logic Error- this is error that is caused by faulty reasoning, the programmer has not properly thought through the steps required to solve the problem.

Syntax Error- The rules governing the programming language is broken.

Run Time Error - As a program is running, it may encounter problems during execution. When a problem arises that the software cannot resolve then it throws a runtime error, which means, while I was running I had a problem I could not resolve. Eg. Division by 0.
Program Documentation
There are two types of Programming documentation:


  • Internal and External


Internal Documentation
Internal documentation involves the use of spaces, indentation that makes a program more readable as well the use of comments in a program that tells what each section of the program is doing.
External Documentation
External documentation consists of tutorials, user guides or manuals to instruct the user on how to use, operate or set up the software.

What are Arrays?

An Array is a powerful data structure that stores variable data having the same data type. It is just like a small fixed number of boxes linked together one after the other storing things that are related to each other

Format

Array[1..N] of ;
An array is declared/Named and 1 to N gives the size of the array, also given is the data type of the data that it will be storing.
Example

program Arrays;

var

Number : array[1..5] of Integer;



begin

end.
Storing data in an array (Manually).


We assign/store each piece of data using the number of the elements behind it in square brackets. Example

program Arrays;

var
a: array[1..5] of Integer;

begin
a[1 ]:= 12;


a[2 ]:= 23;
a[3 ]:= 34;
a[4 ]:= 45;
a[5 ]:= 56;
This can be tedious and it is a lot easier when you use a loop to store the values in an array. Here is another example of reading in 5 values into an array:
program Arrays;

var
a: array[1..5 of Integer;


i: Integer;

begin
for i := 1 to 5 do


Readln(a[i]);
end.

You just take the array in subject, specify the index of the variable of the array and assign it a value relevant to the data type of the array itself.


Displaying values from an array can be done as follows:

var
a: array[1..5] of Integer;

begin
Writeln(a[1]);
Writeln(a[2]);

Writeln(a[3]);

Writeln(a[4]);

Writeln(a[5]);

End.
OR
var
a: array[1..5] of Integer;

Begin


For i := 1 to 5 do

Writeln(a[i]);

Begin

End.
Step 5


Testing an algorithm involves checking to see if the solution is accurate, logical and complete.


Truth Tables

Essentially, truth tables allow you to evaluate every possibility for

a given logic statement. Each of the basic logical operators (AND, OR & NOT) has a truth table associated with it. The easiest way to explain is through examples. Let's form the truth tables for the set of operators listed above, and then build a truth table for an example logic statement.
Example 1: (Not P or ~P)
We only have one logic variable, p, which can either be true or false.

The first column of the truth table will contain all possible values

of P. The second column will give the appropriate value for ~p.
P | ~P

-----------

T | F

F | T
That is the truth table. If P is True, Not P is false. If P is false, Not P is True. It is always the opposite of the operand.


Example 2: (P AND Q or P^Q )
Now there are two logic variables, P and Q; therefore, our truth table

will have 4 rows, since there are four possible arrangements of P and

Q. In general, if there are n logic statements involved, there will be 2^n rows in the truth table.
P Q | P^Q

--------------

T T | T

T F | F


F T | F

F F | F
So we see that P^Q is only True if both P and Q are True - it makes sense.

Example 3: (P OR Q or P\/Q)
P Q | P\/Q

---------------

T T | T

T F | T


F T | T

F F | F
We see that P\/Q is True if either P or Q is True.





Download 2.81 Mb.

Share with your friends:
1   2   3   4   5   6   7   8




The database is protected by copyright ©ininet.org 2024
send message

    Main page