teaching programming - university of...

258
Teaching Computer Studies By Geoffrey Kavanagh ©1999-2008 No part of this document may be copied without permission of the author. Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 i

Upload: buidieu

Post on 29-May-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Teaching Computer Studies

ByGeoffrey Kavanagh

©1999-2008

No part of this document may be copied without permission of the author.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 i

Contents

Teaching Programming Guidelines 1Teaching Programming 2The concept of a program 3Types of programs 4Programs that are used by people 4Programming languages 4Application programs 4Programs that are used by computers 5Operating systems 5Compilers 5BIOS 5The teaching sequence of Programming and Applications 6Teaching about Applications Programs 7The Evolution of Word Processors 8Word processors 9Spreadsheets 11Databases 14Basic application software concepts 16Types of programming languages 17Modular programs 18General modules for programs 19General objectives in teaching a high level language 20Good programming practices 21Topics in Computer Science 23Program Layout 25Sample layouts 26Output statements 27Calculations 29Formatting of output 31Data types 32Values and variables 33Declaration of variables 35Assignment Statements 36Tracing Variables 38Input commands 39Errors in programs 41General Advice to students on debugging 43Algorithms and Pseudo code 44Loops 46Counted Loops 46Conditional statements 50

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 ii

Programming in PASCAL - Lesson materials 54Calculations in PASCAL 55TURBO PASCAL (V 6.0) menu and command interface 56Format (style) of PASCAL programs 57Rules for identifiers in PASCAL 58Clearing the screen of the output from previous programs 59Output Statements In PASCAL 60Calculations In PASCAL 63Formatting Output 65Formatting Values – numbers with decimal points (REALS) 67Formatting Strings and Values 67Comment Statements 68VARIABLES 69VARIABLE DECLARATION 70PLACING INFORMATION IN MEMORY 71Tracing Values in a program 72LOOPS 78Arrays in Pascal 88Textfiles in Turbo Pascal 97

ALGORITHMS 104Programming Algorithms 105Common Algorithms for senior programming courses 111

Other Computer Studies Topics (work sheets, assignments and exams) 124Binary Number Exercises 125Binary Arithmetic 126Hexadecimal Numbers 127Binary Number Test 128Computer Careers 131Ergonomics 136Boolean Logic Problems 154The History of Computers 156Computer and Information Science, Final Project/Presentation 159History of Computers - Some important people and events 163The R S FLIP-FLOP 168

A discussion of items of concern to the students of EDU 1040Y 170Teaching - General 171Teaching - Computer Science 178

Other reference materials 181

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 iii

Teaching Programming:

Guidelines

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 1

Teaching Programming

A major challenge of teaching programming is in bringing students to the realization that they are creating programs in such a way that others can use them easily.

There are two reasons for this: the first being that many of students are unfamiliar with programming as a discipline and second, most students are not used to the idea of putting themselves in the roles of creator and consumer. The idea that there are potential consumers for programs that are created by the students must be stressed throughout the subject of programming.

Additionally, students may not be fully aware of the different classes of software that are used in the operation of a computer. Because of this, when starting the teaching of programming it is important not only to stress what a program is, but also that there are different types of programs.

This information should be presented after a discussion of the main (or theoretical) parts of the computer. Students should be aware of the structure of the computer as being composed of: INPUT, Processing Unit, Memory, and OUTPUT.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 2

The Concept of a “program”

At the beginning of this unit, establish a connection between everyday processes that are familiar to the student and the notion of a “program”. These processes should not be computer related in order to facilitate the internalization of this information. The idea is to build a link between the idea of a program and past experiences of the students.

A “program” can be explained as “any set of instructions to perform an ordered series of actions”.

Examples of these sets of instructions (“programs”) can then be elicited from the class.

Examples of “programs”:- a recipe- a dress pattern- directions on how to get somewhere

Similarly, the idea of software can be linked to non-computer related examples from the lives of the students. Software can be defined as “a program (or programs) that has been recorded so that the information does not have to be entered by hand (manually)”. This recorded information requires machinery in order for it to be useful – that is, for some action to be performed. Once again examples of “software” can be elicited from the class.

Software Device- a recorded videotape - a video cassette recorder- a music C.D. or tape - a C.D. or tape player- a telephone number - a telephone

Students should be asked to give further examples (non-computer related) that illustrate the difference between “programming” and “using software”. For example:

- entering a telephone number - using a special key or button to reach that number

- entering instructions into a - pressing a button to have the microwave microwave perform preset instructions

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 3

Types of programs

Programs can be divided into two general types: those used by people and, those used by computers.

Programs that are used by people:

Programming Languages – software which allows a person (a programmer) to give instructions to the computer in order to accomplish a task.

Applications – a broad class which includes everything from games to databases. These are programs designed to allow a person to accomplish specific tasks. Programmers using programming languages create these.

Operating Systems - instructions that allow the user to control and make use of the components he computer system.

- allow software to function on different hardware brands.

Programming languages

Programming languages are systems of commands that can be used to instruct the computer to perform a series of tasks.

Application Programs

These are sometimes known as “packaged” or “off the shelf”. These programs contain the necessary instructions for the computer to perform certain tasks. The user of the application enters information into the program, which then processes it in order to perform the tasks.

Application programs are designed (usually) to allow the user to do this without having to know a programming language.

Application programs are divided into the following general types: Productivity Software

- Word processors, Spreadsheets, Databases- Electronic mail, Graphics

Education and Reference Software Entertainment Software Business Software

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 4

Operating Systems

A set of routines (a set of instructions directing the performance of a specific task) that manages the operations of the computer. They allow software to function on different hardware brands.

Generally in introductory courses the emphasis in on the Productivity Software category (in particular Word processors, Spreadsheets, and Databases) of Applications.

In introductory courses that contain units on both application programs and programming a decision must be made as to which one is taught first.

Programs that are used by computers:

Operating Systems

See above.

Compilers

Programs that prepare machine language instructions from instructions written in high level languages (e.g. PASCAL, BASIC, C, Turing).

BIOS (Basic input/output system)

The BIOS translates the commands found in the software into the signals that a particular computer requires in order to carry out the commands. BIOS is stored in ROM chips installed on the motherboard by the manufacturer.

The concept of BIOS can be taught by relating it to the more common concept of driving a car. BIOS can be considered to be the controls of a car, which allow you to control the vehicle without actually having any direct contact with the parts of the vehicle such as the engine.

The information about the types of programs should be placed into the context of the previously taught information about the parts of the computer. The following points should be made (or reiterated):

- programs which are being executed are stored in the main (or primary memory) - programs not currently being executed but which need to be available are stored in

secondary memory- some parts of the operating system remain in main memory all the time (while the

computer is operating)- operating system routines bring into main memory the routines and programs to be

executed (these could be compilers or “applications”)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 5

The teaching sequence of Programming and Applications

In many instances applications are taught prior to the introduction of programming. This has the following benefits for the students, should they not be already familiar with these concepts:

- they become familiar with an editor and menu system- they learn the uses of basic application software

Teachers can use this section to emphasize both of the following: the role of the students as consumers (“users”) of computer programs and, the idea that these programs have been created by other people (“programmers”). The history of computer technology can be introduced in this part of the course to facilitate further discussion of how the changing needs of users have prompted changes in software and to emphasize that one does not need to be a programmer to successfully use applications.

There are two possible negative aspects of teaching applications prior to programming. The first is that some students, who are looking for an introduction to application programs and not programming, may choose to leave the introductory course after they have learned how to use these programs. Teachers of introductory courses must be careful to stress that programming is only one aspect of these courses that are designed as an overview of the subject of computers. The second problem is potentially more serious. During the teaching of spreadsheets, in particular, teachers must stress the interconnected role of variables and cells (as holders of data). These concepts become vital later when teaching programming.

Teaching programming first also allows students to become familiar with an interface. Students become aware of the effort involved in producing a well-structured program. This in turn allows them to appreciate the existence of application programs. They develop a familiarity with the types of information that are used in programs.

The major problems with teaching programming first are:

- students may become bored with the process of programming (i.e. the idea that many instructions are required to produce a useful program).

- if students are not well versed in problem solving skills they will have difficulty in producing the sequence of instructions necessary to solve a problem

Both of these are issues that need to be addressed no matter which order the topics are taught. However in this situation what may occur is that students may choose to drop the course before experiencing other aspects of the course.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 6

Teaching About Application Programs

The eventual goal of teaching about applications is to have the students understand that all application programs allow the user to manipulate data in some fashion.

1. Wordprocessors manipulate “words” in order to produce documents2. Spreadsheets manipulate numbers in order to perform calculations3. Data bases allow us to manipulate different types of data in sort and select from

this information

In general all application programs allow the user to perform the following tasks in an easier fashion than by manual methods:

- correct information- store information- retrieve stored information- modify stored information- produce copies of information

Even though databases are usually taught as the last topic in applications, it should be pointed out to the students that this type of application is perhaps the most important one used in business. As teachers we tend to teach the other two first because they have greater utility for the students.

At this point, in order to reinforce the idea of users as consumers of software, it is useful to discuss with the students how application programs evolved starting with word processors.

In each of the following sections, suggested exercises are given for those students who are not familiar with a particular type of application. Students should be assessed prior to the start of a topic as to their familiarity with each application.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 7

The Evolution of Word Processors

Originally word-processing programs were not developed for, or run on personal computers. These programs ran on mainframe computers or on dedicated mini-computers. These first wordprocessors, designed to work the same way as typewriters, were page oriented. Information was presented on the screen in a similar way, as it would be shown on a sheet of paper. The user had to deliberately move from one page of text to another. If new text was added to an existing page causing it to move to another page, the user had to direct the wordprocessor to repaginate.

These early wordprocessors, particularly the dedicated machines, cost as much ten times as much as a modern personal computer. If the user needed to use another application program, then another dedicated machine had to be used. The specific word-processing software used on these machines could not be exchanged for any other word-processing software. As personal computers developed, these dedicated wordprocessors became unpopular. Students can be asked at this point to discuss these developments and to list the advantages and disadvantages of personal computers and word-processing software in the context of these developments.

Historical note: the first word-processing program for personal computers was WordStar developed by Seymor Rubenstein in 1978. The first spreadsheet program for personal computers (Apple) VisiCalc was introduced in 1979. Bob Frankston and Dan Bricklin developed this software. Wayne Ratliff developed the first database software, Vulcan, in 1979. This was marketed with the assistance of George Tate in 1980 as dBase II.

For approximately a decade word-processing software was linked to the typewriter in terms of the style of the documents produced (especially typefaces). Despite this they gained a firm foothold first in the workplace and then the home.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 8

Word Processors

To help students understand why word processors are used in the production of documents, the class should examine the following methods of creating documents:

1. by hand2. using a typewriter3. using a word processor

with regard to the following:

1. Corrections to documents2. Copying of documents3. Storage of documents4. Modification of documents

This examination should begin with a discussion of how a document is produced by hand. Students should be guided towards realizing that there are essentially two categories of activities taking place when a document is “written”. These are editing (changes that affect the content of the document) and formatting (changes that affect the appearance of the document). This would be followed by a similar examination of the production of a document using a typewriter and then a wordprocessor.

A chart can be produced allowing the students to see how these developments (i.e. typewriters and wordprocessors) assisted the production of documents.

Following this a discussion of more recent changes in word-processing software can take place:

- the proliferation of fonts- the inclusion of both spelling and grammar checkers in wordprocessors- the inclusion of a thesaurus- the ability to include drawings (from inside and outside the program)- the ability to include information from other (application) programs- the ability to use documents produced as a web page- the ability to direct or send these documents electronically without ever actually

producing a paper (hard) copy

As part of this discussion it should be noted that these changes did not magically appear rather, that they were the products of programmers responding to the needs of users.

Students who are not familiar with word-processing should be given the opportunity to modify an existing document by both editing it and formatting it according to instructions from the teacher.

Following this, they should create a document and produce a document according to guidelines established by the teacher. This work could be an autobiography, a magazine article or a resume. The assignment should allow the student choice in terms of the content

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 9

but the style (or format) should be established as part of the assignment. This particular work could lead to other assignments in other topics (Computer History, Careers, Ergonomics etc.).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 10

Spreadsheets

Providing connections between the experience of students and the use of word-processors is relatively easy since all students have experience in writing in some form (specifically handwriting). Most students do not have experiences that can readily be drawn upon to provide the connection to spreadsheets. One of the challenges of teaching the basic concepts of spreadsheets is in providing a connection to the experiences of the students.

Most students do have experience in budgeting money to be spent on a variety of items. This is probably the best starting point for teachers in terms of teaching spreadsheets.

The following are the main spreadsheet concepts that students should understand:

- information is arranged in rows and columns- the intersection of a row and column is known as a cell- cells are used to hold values- calculations are performed by using formulas (or formulae) that contain references

to cells- if values in cells that are referenced in formulas are changed, then this will

automatically result in changes in the calculations based on these formulas - labels are used to describe parts of a spreadsheet

There are two main ideas that carry over from spreadsheets into programming. The first of these is that all data can generally be divided into two types: data that is to be used in calculations and, data that is not to be used in calculations. Second that named locations (on the spreadsheet or in memory) are used to hold information. In order to use that information, we refer to the name (or address) of the location and not the specific value. This allows the information in the location to be changed without the reference to it (a formula in this case) being changed.

Prior to starting any exercises on spreadsheets, the students should review the definition of an application program and of wordprocessing software.

Following this review background information should be given as to the beginnings of the idea of spreadsheets in general. The style of the electronic spreadsheet is based on large sheets of paper containing rows and columns that were originally used to display calculations. Because of the size of these sheets of paper they were known as spreadsheets. Since students do not usually have experience in using a paper spreadsheet this experience should be provided in the classroom.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 11

This concept of performing budget style calculations on a sheet divided into these rows and columns is an ideal starting point for students being introduced to electronic spreadsheets.

There are two main goals of the following exercise:- to have the students become familiar with the basic concepts and terms involved

with spreadsheets in general- to have students realize some of the difficulties involved with a “pencil and paper”

spreadsheet

At the start of the exercise students, using paper divided into a grid, are asked to do the following:

- label the rows and columns on the sheet- place titles (labels) in certain cells on this sheet- place numeric information (values) in certain cells on the sheet- calculate a totals based on the values in certain cells and place them in specific

cells on the sheet

When preparing this exercise for the students, teachers should keep in mind the following points:

- prepare grid sheets where the cells are sufficiently large enough to hold a label of a useful length

- students can be told to perform the work either in pencil or pen- the number of values to be used in the calculations should be kept small ( around

five)- the items that are listed on the spreadsheet should be ones that will appeal to a

large number of students (these items could be solicited from the class in order to create an inclusive exercise)

- student work should be checked for accuracy, not only in terms of calculations but also in terms of placement on the page, prior to continuing the exercise

Once the first part of the exercise has been completed, students are asked to change certain values on the spreadsheet and to recalculate the results based on these values. A sufficient number of these changes should be given in order to have the students appreciate the difficulties (and frustrations) involved with having to make changes to a spreadsheet of this type.

These experiences can then be used in a discussion similar to the one that was used during the teaching of word-processing (i.e. comparing a manually prepared spreadsheet with an electronic one).

Based on their experiences with wordprocessing documents, students should be asked to give what they believe are some of the advantages of using spreadsheet software. During

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 12

this discussion the teacher or students who have used electronic spreadsheets, would provide the information concerning the features of spreadsheet software that the students of which may not be aware (such as the automatic recalculation of results based on changed values).

Student work involving (electronic) spreadsheets can be divided into two basic categories:

- practice in placing particular information in specific areas on the spreadsheet- the creation of spreadsheets to solve various problems involving calculations

These exercises would be followed by a summation of the general features of spreadsheets and their relationship to the general idea of application programs.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 13

Databases

The major database concepts to be understood by students:

- database files are composed of records- records contain fields into which information to be stored is entered (a concepts

that can be linked to cells in a database)- fields are the smallest unit of information in a database- fields are identified by field names- records can be viewed in two ways: either individually (as forms) or, as a whole (in

a list)- databases can be used to sort files of records in various ways (based on certain

criteria)- records can be selected from a file based on certain criteria

The use of student information cards by schools to store, filled in by students at the start of a school year, are an ideal starting point for the explanation of the concepts involved in databases.

A set of these cards may be used to illustrate various concepts about databases. The cards used for each student are the records of the database. The areas in which the students enter information are the fields of the database. The words alongside each of the lines on which information is written are the field names. These sets of cards are usually grouped in some way, such as classes, that represent files.

Other topics that can be discussed using these cards:- these cards can be sorted in ascending or descending order based on criteria,

such as by name or by age, determined by the user - records may be selected from the file based on specific criteria (greater, less than

or equal to certain values)- the notion of creator versus consumer can be reinforced by discussing the fact that

the layout of the fields on the cards must be designed

Students should also be aware of the idea that it is possible to summarize the information from a database file in a table or list form. This allows the user to compare a large number of records at one time.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 14

Before actually using the database software students should go through the process of designing a record on paper and collecting information. The easiest way to implement this in a classroom is to inform the students that they have to collect several pieces of information from each of the other students in the class. The class as a whole can be canvassed to determine some or all of the types of information to be collected. A record or form must be designed by each student to allow the other students to give the information to the collecting student. In order to promote the idea of designing useful records (ones that do not have to be changed) graph paper should be used to assist the students in creating the forms. Students entering information on these forms must be told that they can only use the space allowed on the form for their information. This will allow the teacher when discussing the creation of forms in the database software to remind students of the importance of leaving sufficient space for the entering of information.

Following the collection of information from the other students in the class, students can be asked to sort the information in various ways as well as to select records from their files based on specific criteria. These selection criteria should be phrased in a similar way to the one that will be used to select records from the database software. For those students who are not comfortable with some of the necessary concepts (less than or greater than and so on), this will provide an opportunity for the teacher to review this material.

After these exercises have been completed with the “pencil and paper” databases, students can be introduced to the particular database software to be used. This should take relatively little time, particularly if the database software is part of an integrated package. As a first assignment students can be asked to transfer their handwritten database material to the computer and then complete various tasks (e.g. sorting and selecting records).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 15

Basic application software concepts

Regardless of the actual software used, students should become familiar with the following concepts.

General properties of application (productivity) software

These programs allow the user to enter, store, manipulate, and retrieve information.

Word-processor

Used for the manipulation of written information.- editing- formatting

Spreadsheet

Used for the manipulation of numeric information- allows the creation of formulae that can be used with different information to

examine various scenarios

Database Management

Used for the manipulation of all types of data- information can be sorted or selected based on criteria entered by the user

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 16

Types of programming languages

Prior to teaching of a language, students should be made aware of the differences between high level and low level (or machine) languages.

Students should be able to do the following:

- explain the purpose of both types of languages- state how the “appearance” of these languages differ

Teachers may wish to introduce the notion of “portability” at this time (the idea that programs written in high level languages are relatively independent of the machines on which they are written) – this is one of the objectives of structured programming.

Objectives of a structured or disciplined approach to programming

In order to teach students the skills required to produce a “good” program, it is important to make them aware of the goals of this style of programming.

1. Meet the needs of the user.2. The production of error-free instructions.3. Error resistant operation.4. Maintainable programs5. Portable programs

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 17

Modular programs

Just as students are taught that when written an essay there is a structure that should be followed in order to present information to the reader, they must also be taught that there is a structure that should be used when constructing a program.

Most commonly this is known as “modular design of programs”. The units that compose a program are also sometimes known as blocks. A block is a group of statements that is treated as a single statement for the purposes of the control flow of program. In some cases they are marked explicitly by the use of “begin” and “end” statements. In other cases they are implied by the keywords of a command (e.g. For in Pascal).

Just as each part of an essay has a particular function, so do these modules. Students must be informed that programs should be constructed in such a fashion that each of these units performs a separate function. As programs become more complex this notion can be extended to “procedures” and “functions”.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 18

General modules for programs

1. Initialization2. Input3. Input validation4. Processing5. Output6. Closing

For complex programs an additional module, “Error handling” should be introduced. This type of module is especially suited to the notion of “procedures”.

Structures

In programming there are three structures that can be used to compose (or code) programs.

1. Simple sequence2. Repetition3. Selection

The teaching of these three concepts simplifies the process of writing programs. The students learn that: these three structures are common to all high level languages, each structure has only one point of entry and one point of exit, using these allows the program to be “read” from the top down.

Students must become familiar with each of these in order to produce programs that are effective. These ideas should be discussed prior to the teaching of any language dependent code.

Generally, each of these topics is taught one at a time until students reach a mastery level.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 19

General objectives in teaching a high level language

1. The learning of the instructions and other elements of the language being taught.2. Learning how to apply the rules of the high level language to compose a clear,

understandable program.3. Learn how to submit a program to be compiled and executed on the available

computers.

These general objectives can be met by the following on the part of the teacher:

1. A description of the instructions or rules and examples to illustrate their use.2. Complete programs with documentation. These should illustrate not only the

proper style but they should include documentation and where appropriate error controls.

3. Providing problems to be: programmed, run and, debugged.

A connection can be made between the topics of computer languages and the topic of the history of computer technology by giving a timeline of major high level languages (including reasons for their development). The major operating systems could be added to this to further illustrate the rapid changes that have taken place in the latter part of the 20 th century. Both of these will serve to illustrate the general ideas being presented in this unit.

- the general types of programs used in computers do not change even though specific ones go in and out of fashion

- the acquisition proper programming techniques are more important than the learning of specific languages

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 20

Good programming practices

Students should be exposed to good programming practices from the start of the programming section. Teachers must ensure that each program sets an example for the students to follow.

Programs should include the following (even if the language being used does not strictly require them):

Program nameProgrammer’s nameDate of submission/creationVariable declarationsMeaningful identifier namesProper layout (indentation)Suitable documentationInitialization of variables

Students should be encouraged to include the first three of these items as soon as possible. Further internal documentation can be included when there are recognizable blocks within their programs. At that point teachers must discuss the need for brief (useful) comments that will assist the reader, who may not be a programmer, in understanding the purpose of both the blocks within the program as well the program as a whole.

Additionally, as students write more complex programs (especially at the grade 11/12 level) students should avoid “magic” values – these are values that appear in a program with no explanation. If the language being used supports named constants, they should be used. If named constants cannot be used global variables should be used. Avoiding these “magic numbers” has the following advantages:

Changes can be made more reliablyChanges are easier to makeThe program will be more readable

Students should be made aware that there are times when “hard coded” values should be used, such as when assigning the initial value to a loop control variable.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 21

Students, particularly at the senior level, should also be made aware of the following (see the section on Errors):

Divide by zero errorsMixed type comparisonsInteger overflowRounding errors

These basic “rules” will allow students to create programs that will be easier to read (both for you and the student) and potentially have fewer mistakes.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 22

Topics in Computer Science

The following represents the major topics that are taught in high school programming courses. The columns indicating the grades in which these topics are taught represent a general guide to indicate the levels at which these topics are taught. While there is a general consensus as to when these topics are taught, the actual order may vary not only from school to school but also from class depending on the composition of the class. Another factor is the actual language taught. Teachers must be aware that students moving not only from secondary to post secondary education and employment, but also from school to school will likely experience different languages. For this reason it is extremely important that proper programming techniques be emphasized and reinforced whenever possible – even in cases where a language does not require structure.

Programming topics Grades10 11 12

Program structure *

Program Layout *

Output statements *

Calculations *

Formatting of output *

“User friendly” output *

Internal documentation *

Data types *

Values and variables *

Assignment statements *

Input statements *

Algorithms *

Counted loops *

Selection statements * *

Errors in programming *

Conditional loops * *

Nested selections *

Programming topics Grades

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 23

10 11 12

One dimensional arrays *

Random Numbers *

String manipulation * *

Nested loops * *

User defined procedures * *

User defined functions * *

User defined data types *

Two dimensional arrays * *

Sorting * *

Searching * *

Files (text) *

NOTES:1. Graphics may be integrated at any suitable point depending on the class.

2. Many schools use the 12th course to allow students to develop software (even though this is not specified in the course outline).

3. Time must be allocated prior to teaching programming commands to allow students to become familiar with the programming language editor.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 24

Program Layout

The main purpose of the layout of the program is to show the logical structure of the code. In order to achieve this both: indentation and, white space are used.

How both of these are used is not always consistent from school to school however they should at least be consistent within a department. The ultimate goal is to have students write consistent representations of logical structures.

The strategy used for the indentation of programs must be one that allows both you and the students to read the program easily. This must be constantly emphasized especially when examples are given in class (either by the teacher or by the students

White space is a valuable tool in increasing the readability of programs. Students must be encouraged to use blank lines, spaces and tabs. Perhaps the best way to get this idea across is to give as examples programs that do not have these elements in them. The class is then given the task of modifying the layout of the program to increase its’ readability. The first time(s) this can be done as a whole class exercise with the aid of the teacher. Later students can be given similar problems to work on in small groups (allowing students to produce a consistently readable version) and finally, they can work on other problems individually.

Connections can, and should be, drawn between the organization of a program and the organization of writing in general. Both must allow the reader to organize the information that is presented. If the organization is not evident, then the information may be misinterpreted. In the case of programs, this leads to students having difficulty modifying or correcting their work.

The analogy of a program as a piece of writing is also useful in explaining to students the following: how to group statements, blank lines, alignment and, indentation. Just as paragraphs contain statements that are related, programming statements that accomplish a single task should be grouped together. Blank lines are used to separate unrelated statements. Alignment is used to allow the reader to determine, visually, which statements belong together.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 25

Sample layouts:

The two examples below represent different ways to indent a counted loop routine. Both will work but the one on the right makes the structure appear more complex than it actually is.

The following version gives a misleading impression of which statements are subordinate to each other (it is not clear where the structure begins and ends).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 26

&&&&&&&&&&&&& &&&&&&&&&&&&&&&&& &&&&&&&&&&&&&& &&&&&&&&&&&&&&&& &&&&&&&&&&&&&&& &&&&&&&&&&&& &&&

&&&&&&&&&&&&&&&&&

&&&&&&&&&&&&&&&&

&&&&&&&&&&&&

Output Statements

Statements producing output provide an opportunity to discuss with students the basic structure of high-level language commands. Additionally, students have an opportunity to write simple structured programs.

The main objectives of this unit:

1. First, to familiarize students with the idea that these languages have statements composed of two parts. The first being a command the second being something to be acted upon by the computer using the given command.

2. Second that there are commands that instruct the computer to show output on the screen.

These commands, in general, can be defined as those that allow the computer to give information to the user.

Along with the teaching of the actual command, students should be introduced to the concept of a string. That is, something that is shown as output without any other processing taking place. One way of explaining this, particularly to students at the introductory level, is that there are statements that there are two types of data associated with output statements:

- those that do not require calculations (‘strings’)- those that require calculations or those representing the results of calculations

In this unit the following sequence of exercises should be considered:

1. single lines of output with no calculations2. multiple lines of output not requiring calculations

A useful series of exercises is to have the students produce patterns that require several lines of output. These patterns can be developed on graph paper first and then coded. This will give the students the opportunity to realize that output statements must be used as a group to produce useful or pleasing images as output.

In order to minimize confusion, teachers should not give output assignments that appear to require calculations prior to having discussed how to perform calculations in the high level language.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 27

The following should be done following a discussion of calculations in the high level language

1. single lines of output requiring calculations (not requiring the order of operations2. single lines of output with calculations requiring the order of operations3. multiple lines of output requiring calculations4. single lines of output using both strings and calculations5. multiple lines of output using both strings and calculations

During the discussion of calculations the following should be mentioned:

- the order of operations is followed- the proper symbols must be used to produce a result- “=” is not used in programming calculation statements- division by zero will result in an error message- the output produced may be in an unfamiliar form- division produces a real valued result

The last point can be considered as the introduction to the data types used in calculations– specifically real (“with a decimal point”) and integer (“without a decimal point”) type values. In order to facilitate the introduction of the concepts of “value” and “variable” at a later time, students, given a list of data, should be able to distinguish which of the three data types each value belongs. They should also be able to state the data type of a calculation result.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 28

Calculations

Calculations are a necessary part of programming. Because of this students must understand the rules for calculations in high level languages. These calculations are sufficiently similar that students having sufficient math background should have little problem understanding the mathematics behind the calculations. There are however some differences relating to the syntax of calculations in high level languages that tend to cause some confusion amongst students.

Potential areas of confusion:1. Equal signs are not used in calculations.2. All products require a multiplication sign (or operator)3. Calculations involving division must be written on one line (e.g. 2/3)

Additionally some languages use "=" to indicate an assignment statement.

In order to minimize these difficulties, students should be given practice in class translating mathematical expressions to and from the high level language being used.

NOTE: Additionally teachers must be careful to avoid the use of “equal” when referring to “assignment” statements. This tends to lead to a misunderstanding of the meaning of “assignment statement” and confusion when comparisons are introduced.

Teachers may find it useful to discuss with the students the rules for the order of operations prior to starting this unit. Because of the nature of some school programs (especially in semestered schools where it is possible for students to not have taken mathematics for a year or more) students may require some preliminary exercises involving arithmetic.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 29

Sequence of topics within the calculations unit:

1. Review of the rules for the order of operations (suggested)2. Explanation of the syntax for calculations in the high level language3. Translation of "mathematical" expressions to the high level language4. Translation of high level language calculations to "mathematical" expressions5. Programs involving calculations not based on "word" problems 6. Translations of calculations or mathematical expressions in words to expressions

in the high level language with an intermediate step of first converting to a mathematical expression

7. Translations of calculations or mathematical expressions in words to expressions in the high level language without any intermediate steps

8. Programs involving calculations based on word problems

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 30

Formatting of Output

Formatting allows a programmer to produce output that is easier for the user of the program to understand. Once again it must be stressed that even if the programmer understands the output it must be displayed in such a fashion that the non-programming user is able to understand it.

The sequence of topics in the teaching of Formatting:

- strings- integers- real values- combinations

Strings are introduced first because they do not require any mathematical background and therefore they allow the teacher to determine whether or not the students understand the computer related concepts without any confusion based on lack of previous mathematical knowledge.

There are two ways of approaching the teaching of this topic. The first is the traditional teacher centered method of presenting examples and explanations. The second way is to present the students with carefully sequenced examples within a program and then having the students attempt to develop the “rules”, either individually or in small groups, for formatting within the language under consideration. This method will take longer than the ”traditional” presentation but it has several advantages. Students tend to develop a better understanding of a topic if they are allowed to explore it in a structured manner. Teachers can also use this exercise to determine whether or not students have understood previous topics (such as output commands and calculations) prior to proceeding on to the next topic.

At the end of this section students should be able to write a program that will give formatted output, from strings and values, that can easily be understood by the user. Having a student examine another student’s programs and informally commenting on the output of that program can check this.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 31

Data Types

Prior to the teaching of the concepts of value and variable a review should take place of the types of information used in the previous output exercises. These should now be defined as “data types”.

At this point students should be able to recognize and to state the difference between the following data types:

- strings- integers- real numbers

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 32

Values and Variables

In order to introduce this topic and to help students realize the need for programs to include variables, they must be asked to write a series of programs that are the same but with different values. These values can be numerical (i.e. integers and/or reals) or alphanumeric (strings). In order to illustrate the point to be made, teachers must design programs as examples that use the same values many times throughout the program. Students are then asked to change the values within the program.

After examining these programs and discussing them as a class, with the assistance of the teacher, they should realize that they are “wasting” time and effort by repeating code. The point can be made by the teacher, if it is not advanced by the students, that this may not be a significant amount of time when dealing with short programs but as the programs become larger it does become significant. An analogy can be drawn between writing programs and writing documents (such as a letter). If the same document is to be sent, with very few changes, to a large group of people it is inefficient to keep retyping the complete text. In the same way, it is inefficient to keep retyping programs over and over if the same code could be reused with small changes.

At this point the concept of a “variable” can be introduced. A careful distinction must be made between the variable and the information that it contains. In general a variable can be defined as a location in memory that is used to store a single piece of information (or datum) of a particular type. A connection can be drawn between the cells of a spreadsheet and the fields of a database. In each case in order to retrieve or to examine a piece of information, the name of the “place” where the information is to be stored must be known. Another analogy that can be used (especially if applications have not been taught first) is that of building. Buildings serve as residence for individuals or organizations (which may change) and in order to locate these buildings an address must be known.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 33

Students must be able to explain the difference between the following concepts:

- value- variable- variable identifier

Term Spreadsheet Database Building

Value value Data resident

Variable cell field structure

Variableidentifier

address of the cell

field name address

Another analogy that works well is that of a mailbox. A mailbox has an address and can only contain a certain size of "package".

Further analogies could be drawn at this point, however they would depend on a greater range of knowledge on the part of students. For instance, the declaration of variables could be introduced as being similar to zoning regulations. As a rule these further analogies do not tend to enhance the understanding of the students.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 34

Declaration of variables

Once students are familiar with the concepts: value, variable and, variable identifier, the declaration of variables can be introduced.

In order to store information in the memory of the computer variables must be declared. Declaration of variables serves two purposes:

1. it makes the name of the variable (the variable identifier) known to the compiler2. it states the type of information to be stored in this variable

Students must be reminded that each variable can store only one piece of information. Also once the type of a variable has been declared it (as a rule) cannot be changed. Teachers may wish to mention the concept of “simple data types” at this time for students who plan to continue further in programming. This can also be discussed by saying that variables that can hold more than one piece of information will be discussed at a later time.

At this time if string variables must be declared as an array rather than a simple (single valued) variable, they should not be part of this section of the course and they should be left to a later time when students proficient in the use of simple variables.

The syntax of the declaration of variables in the language under discussion would take place at this time. Included in this would be the proper placement of these statements in the layout of the program.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 35

Assignment Statements

Assignment statements should be introduced to the students as having the following purpose:

an assignment statement allows the programmer to show what value is to be stored in a particular variable

All assignment statements take the following form:

Variable identifier <assignment symbol> value

or

Variable identifier <assignment symbol> expression

where the expression results in a value.

In both cases the value should be of the same data type as the Variable identified on the left side of the statement.

Students must be told the correct way to “read” these statements. Examples of ways of interpreting the statement

price <assignment symbol> 25 would be:

the value 25 is given to the variable called pricethe value 25 is assigned to the variable called pricethe value 25 is put into the called price

The key concept that the students must understand about these statements is:

the information shown on the right hand side of the statement is placed into the variable named on the left of the statement

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 36

The first examples given to the students should involve first values then expressions. It is useful at this time to remind students that what is shown on the left side of the statement is a variable name not the actual variable. This serves to reinforce the difference between the concepts “variable” and “variable identifier”. Teachers must be careful not to use, or reinforce the use of; the phrase ”is equal to” rather than “is assigned to”. The misinterpretation of the assignment statement will lead to misunderstanding when quantities are compared using “equals”. It is also incorrect because the information in a variable is not “equal” to the variable (i.e. the location in memory).

To demonstrate the usefulness of variables a program that was previously modified by students (from one set of values to other sets of values) can be rewritten using variables. The values being assigned to the variable identifiers early in the program allowing the information stored to be changed easily. This in turn can be used to introduce the idea of a “constant”.

As an assignment, students can be asked to state what the output is from a given program as well as to write programs, using variables that will solve problems. These problems could take the form of calculations involving perimeter, area and volume as well “bills of sale”. These will allow the students to make use of all the concepts previously taught. These problems can be re-introduced and modified in the section on “input” commands.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 37

Tracing Variables

To introduce the concept of tracing (sometimes called tracing the execution of a program) students should be reminded that information stored in a variable can change (or vary). For this reason it is useful to have a method which allows us, as the programmer, to examine the information stored in the variables of a program as the program is executed.

Tracings should take the following form:

Program variable 1 variable 2 etc.

statement value valuestatement value value

NOTES:If there is no value stored in a variable at a particular point in the program then students should be instructed to use “-“ or “empty” to indicate this rather than “0”. The value in the variable is considered to be “undefined”. The objective is to reinforce the notion that the programmer must ensure that a value is stored in the variable, rather than allowing the compiler to do so.

Some languages automatically initialize the value in a variable to “0”. This is however not a consistent practice. Putting a value of “0” into a variable prior to a value being assigned to the variable may not give a true indication of what is happening in the program. It may also lead to problems when the student uses another language.

If there is output resulting from a program it should be placed away from the tracing chart, preferably underneath it using the heading “Output” so as not to give a misleading impression of the appearance of the output (especially when tracing loops).

Students must understand that the only statements that can change the value of a variable in the memory of the computer can “cause” changes in the values of a variable in a tracing. It is useful to have the students think of programs as containing two basic types of statements: those that can change the value in a variable and those that cannot change the value in a variable. Tracing assignments, in order to reinforce this concept, must involve both assignment and non-assignment type statements.

Assignments in this section should involve the tracing of previously written programs as well as programs where the values in the variables change many times. Students at the end of this topic should be able to correctly trace a program of sufficient length (up to twenty statements) containing multiple (up to four) variables.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 38

Input Commands

The teaching of input commands allows the teacher to reinforce the idea that programs are written not only for the programmer to use but also for other users.

The definition of input statements should parallel the definition of assignment statements:

an input statement allows the user to show what value is to be stored in a particular variable

Input statements are used by programmers not only to allow other non-programmers to make use of the program but, also to allow new information to be entered into a program while it is being executed. The result is that these programs, if they are written properly, can be easily and repeatedly used. These points must be stressed when discussing the concept of an input statement with students.

The discussion of input statements can take the form of a whole class or small group examination of previously written programs (using assignment statements). A question similar to '‘What would make these programs easier to use for the non-programmer?” can be posed to the students. As part of this discussion, examples should be presented that only include input statements with no direction given to the user through output statements. The goal to have students understand that users require clear instructions as to the type of input to be entered along with the ability to enter the information. As part of the classroom work, students can be asked to give examples of output statements that would assist a user in entering information. Some students may be able to give examples of ambiguous statements. If this is not possible, the teacher should be prepared to give examples of this type of output. This can be extended later to the inclusion of error checking and error trapping statements within the program.

Students can also be asked to discuss under what circumstances an input statement would not be needed. During this discussion students should become aware of the fact that in order for programs to be “useful”, they generally require some input from the user.

As an assignment (or series of assignments) students should be given the task of modifying previously written programs, examined in the discussion above, to include input statements.

Other assignments should consist of writing new programs that allow output to be determined by information entered by the user.

The sequence of assignments of this type:

- allow the user to input numerical values- allow the user to input strings- allow the user to input both strings and numerical values

The last type should represent the majority of the assignments, as they are more realistic. It is not necessary for these programs to longer than number of lines that will fit on the screen.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 39

Towards the end of this series of assignments, they should contain elements of all the topics previously taught in programming.

As with the programs containing assignment statements, students should be given assignments to trace the execution of programs containing input statements.

The following is the suggested sequence for tracing assignments:

- programs with input statements for variables of one type where only one value is given as input for each variable

- programs with input statements for variables of one type where the program is run several times each time with different values as input

- programs with input and assignment statements for variables of a limited number of types (either numerical or alphanumerical) where with only one value as input

- programs with input and assignment statements for variables of a limited number of types (either numerical or alphanumerical) where the program is run several times each time with different values as input

- programs with containing both input and assignment statements for variables of different data types where the program is run several times each time with different values as input

These tracing assignments, like those previously mentioned should include output that has to be indicated by the student.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 40

Errors in programs

The correction of errors, or “bugs”, in programs represent one of the biggest costs in the production of software. In a 1983 study by Gerald Weinberg, the three most expensive programming errors cost: $1.6 billion (U.S.), $900 million (U.S.) and $245 million (U.S.).

Historical note: According to the late Rear Admiral Grace Hopper, the word “bug” as an expression of a cause of computer error goes back to the first large scale digital computer, the Mark I (completed in January 1943). A circuit malfunction was traced back to the presence of an insect that had entered the computer. This lead to the term “bug” as a word referring to a computer problem. By 1949 this word was in wide use.

In order to assist students in creating error free programs, they must understand the types of errors that can occur in a program. In general there are three types of errors:

1. Syntax errors2. Logic or semantic errors3. Run-time errors

Syntax errors

The programmer violating the rules of syntax for the particular language being used causes syntax errors. Since the compiler during the compilation of the program detects syntax errors this section can also provide an opportunity to review the functions of the compiler. The majority of syntax errors are the result of ”clerical error”; the programmer has mistyped a statement. Having the students carefully read the program before running it can catch these mistakes. Should the student not catch these errors prior to attempting to run the program, here is some advice that should help them determine where the syntax errors are in their program:

- Do not assume that the line indicated in the error message is the line that has the error. The lines immediately before and after the statement indicated by the error message should be checked.

- Use the error message given by the compiler only as a guide. The actual error may be quite different from what is indicated in the message. This also applies to multiple messages.

- Divide the program into small sections and examine each section carefully.- Three of the most common errors are: extra comments, extra quotation marks and

typing “I” instead of “1”.

Time in class should be set aside to discussing common syntax errors and the resulting error messages. A review of the syntax of the language can also be useful at this time.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 41

Logic or semantic errors

The compiler can determine syntax errors however the compiler cannot find logic or semantic errors. These are errors that take place when the statements in a program are syntactically correct but they produce unexpected or unwanted results. The programmer must correct these errors.

These mistakes are generally of these types:

- errors in the construction of parts of the program and how they work together- solving the incorrect problem

To assist in the determination and correction of these problems the students should use the following techniques:

- write an algorithm and/or pseudo code before writing the program code- trace the execution of the program subsequent to the writing of the program code

Run-time errors

These errors occur during the use of the program. They generally are not syntax errors. Most times they are logic errors. Students should know the most common run-time errors and how to avoid them:

- division by zero- mixed type comparisons- overflow errors

The students can usually correct these errors if they use the same techniques as for logic errors.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 42

General Advice to students on debugging

Students should be encouraged to follow the following practices:

- produce an algorithm (and/or pseudo code) prior to writing a program- check program once they have been corrected- once an error has been found, check for similar errors- choose variable names that have a large number of differences to help the detection of errors

Students should be strongly discouraged from the following debugging practices:

- Inserting output statements at random in the program- Changing statements in the program until something works- Not keeping a copy of the original program while attempting to debug- Not attempting to understand the cause of the problem and using the most obvious

fix for an error- Making several changes to the program at one time

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 43

Algorithms and Pseudo code

The writing of algorithms and pseudo code allows students to concentrate on the processes that must occur in order for a task to be completed. This topic can be examined prior to the teaching of programming or at the point in the teaching of programming where problems are sufficiently complex to require the writing of an algorithm (and/or the pseudo code based on that algorithm) to help in the writing of the program. If algorithm writing is taught prior to programming, then the class during the programming unit can review it and a pseudo code can be developed from the algorithms.

One way to introduce students to the concept of an “algorithm” is to have them produce instructions, as a class, to accomplish a task. After this has been done, other examples of sets of instructions can be obtained from the students. Students, even if they are not familiar with concept of “algorithm”, have all had to get or to give instructions at some time. Following this discussion a definition for an algorithm can be given:

a sequence of instructions used to accomplish a task

Even if students have a great deal of experience giving instructions they may not be aware that they are making assumptions about the receiver of the instructions. When students create algorithms they should also be asked to list the assumptions that they are making about the user of their instructions. Once again this relates to the notion of a “creator” and a “consumer” of programs (in this case, instructions).

Here are some suggestions for the introductory teaching of algorithms:

- as a whole class have the students write an algorithm for an everyday task (such as making: a cup of coffee or a slice of toast with jam)

- divide the class into groups and have each group produce an algorithm, first for the same task and then for different tasks (these should include tasks such as finding a particular name in a telephone directory as well as finding the mean value of a certain number of values)

- each group in the class produces an algorithm for a task or series of tasks that connected with the other algorithms accomplishes a more complex task

The following sequence can be taught once students are familiar with the basic commands of the programming language that they will use:

- sample problems are given followed by the algorithm and the pseudo code for this task

- exercises where the students must follow the algorithm or pseudo code without a computer to accomplish the task

- exercises where students, either in groups or individually, attempt to write algorithms and pseudo code for a given program

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 44

To reinforce the use of algorithms and pseudo code as an aid to writing programs, students should be asked to submit them prior to writing a program. Teachers can suggest changes to the algorithm when returning them to the students. This process does lead to fewer errors in programming but it is often lengthy. An alternative to this method is to develop the algorithm (and the pseudo code) as a whole class under the direction of the teacher prior to the students writing the code for their programs. In either case, the algorithms can be included in the program as internal documentation (or comments). This should assist the students in the writing of their programs and the teachers when discussing the program code with students.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 45

Loops

The teaching of looping structures to beginning programmers is usually done in the following order:

- counted loops- conditional loops

The reason for this order is, that the student can easily modify counted loops and that knowledge of additional material (i.e. conditional statements) is not necessary. As a result, only counted loops are taught to students who do not plan to take further courses in programming.

Counted Loops

Reason for use

In order to introduce students to the concept of looping structures, a need for repetition in programming is first shown. To demonstrate this, students as a class are asked to write a program that will perform a small number of tasks several (three to five) times. This program is then expanded to perform the same task more times (e.g. ten to twenty times). Following the completion of this program, the students are asked what the program would look like if this task were to be performed a large number of times (e.g. two hundred). This exercise serves the dual purpose of both reviewing the previous programming material and introducing looping.

After a need for a statement that instructs the computer to repeat an instruction or a series of instructions a certain number of times is established, then the students are introduced to the counted loop statement.

In the counted loop statement students should be familiar with the following:

a) loop control variable – this is the variable named in the counted loop statement that is used to hold a value which is used to determine the number of times that the loop will repeat

b) the initial value of the loop control variable – the value at which the computer is to begin the “counting” sequence

c) the final value – the value that represents the end of the “counting” sequence

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 46

Types of values used in the loop control statement

Students also need to understand the type of data that can be assigned to the loop control variable. This is usually a discrete, or “countable” type of information.

Students should be introduced to integers as an example of the type of information assigned to loop control variables. However since integers are not the only type of values that may be used (characters may also be used), teachers must be careful in their definition of the types of information that may be assigned to loop control variables. While integers are used to illustrate how counted loops work, emphasis should also be put on the characteristics of integers and why they are used in this situation. This will allow students to understand how other types of information may be assigned to the loop control variable.

Characteristics of integers:a) each value has a predecessorb) each value has a successorc) values are discrete - there are no values “in-between” values (i.e. no fractional

values)

To illustrate why this type of data (discrete) is used in the loop control statement, students must review how they count a definite number of objects. This can be done with a short teacher directed discussion on how to count various items around the class. During this discussion, the students should realize that “whole numbers” are used to count these items.

Following this, students can be introduced to counted loops where the value in the loop control variable is incremented and, integer type values are assigned to the loop control variable.

Examples can then be given of values assigned to the loop control variable:

1. positive values greater than zero where the initial value is equal to 12. positive values greater than zero where the initial value is NOT equal to 13. positive values where the initial value is equal to zero4. the initial value is negative and the final value is positive5. the initial value is negative and the final value is zero6. both the initial and final values are negative

For students to whom this does not present a difficulty, the concept of using character type information in the loop control variable can be introduced. In this case both the initial and final values would be characters. In order for the students to understand why a character is “greater” than another character, a brief discussion of the ASCII table must take place.

After these exercises students can be introduced to loops that decrement and situations that require the use of this type of counted loop.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 47

Here is a suggested order for student exercises on counted loops incremented by a positive value:

1. running previously written programs containing a counted loop and examining the output

2. modification of a counted loop in an existing program to change the number of repetitions and then examining the output

3. writing a program segment containing a counted loop that will repeat a set of statements a certain number of times

4. writing a complete program containing a counted loop that will repeat a set of statements

5. writing a complete program where some statements are to be repeated (i.e. are contained in a loop) and others are not

These exercises can then be followed by similar exercises where the loop control variables are incremented by a negative value.

Following these exercises student should be able to:

1. explain the need for repetition structures in general2. explain when counted loops should be used in a program3. examine a program containing a loop and state which statements are repeated by

the loop (“are contained in the loop”) and which are not4. state the types of data that can be assigned to the loop control variable5. state when “backwards” counted loops are used

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 48

Function of the Counted Loop statement

An understanding of the three functions of the counted loop statement is necessary in order for students to use this structure properly and to later understand conditional loops when they are introduced. This discussion should take place prior to the introduction of conditional loops.

The three functions of the counted loop statement are:

1. assign an initial value to (and sometimes declare) the loop control variable and state the final value of the loop control variable

2. increment the value in the loop control variable

3. check the value in the loop control variable and terminate the loop when a value greater than the final value, given in the counted loop statement, is reached

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 49

Conditional Statements

Conditional statements, sometimes called selection statements, are used to direct the actions of the computer depending on the circumstances. The simplest form of the conditional statement can have one of two different results: if the condition is true, a set of actions is performed, if the condition is false, these actions are not performed.

The general form of this type of statement is as follows:

If <Boolean expression> then <statement(s) to be performed if the Boolean expression is TRUE>

Boolean expressions are those that can have either a TRUE or a FALSE value.

To introduce students to the conditional statement, first they should be asked to examine everyday situations where they have to make a decision to do something based on the circumstances. For example:

If <it is raining today> then <I will take an umbrella>

When the expression <it is raining today> is TRUE, then the person will take an umbrella with them. If the expression is not true (its value is FALSE) then the person will not take an umbrella.

The teacher could give this example (or any other similar one) and both the condition (Boolean expression) and the action to be taken based on this condition being true explicitly stated. The class can then be asked whether or not this condition is true (given the actual circumstances at the time) and then based on that, whether the statement of action will be performed. Teachers must be very careful to word conditions in these examples so that they are clear-cut, the students must be able to clearly determine whether or not the condition is true or false.

Following examples of statements of this type created by the teacher, students (either as a whole class or as a group) can be asked to give further “everyday” examples of this type where an action is performed if the Boolean expression is TRUE.

When the students are familiar with simple selection statements using conditions based on “everyday” events, conditions based on other events can be introduced. These events will involve the comparison of quantities and therefore, the students should be familiar with how these comparisons are performed in a computer program.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 50

Operators used in Comparisons

The following operators are used in comparisons of information of the same type:

- equal- greater than- less than- not equal

These may be combined as follows:

- greater than or equal to- less than or equal to

To illustrate to the students how these operators are used everyday numerical examples should be used. For example:

- the amount of money in my wallet is equal to $10- the amount of money in my wallet is greater than $10- the amount of money in my wallet is less than $10

The idea here is that what is contained in the wallet is money and therefore it can be compared with the amount “$10” which is also money.

Following a discussion of this example, the students can give further examples with a discussion as to whether or not items of the same type are being compared. If necessary the examples can be revised to ensure that the items compared are of the same type.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 51

Compound Statements

After students are familiar with the examples of comparisons from above, the idea of compound comparison statements can be introduced. These compound statements are the result of using what are known as conjunctions in grammar to connect two comparisons.

For example:

- the amount of money in my wallet is greater than $10 or the amount of money in my wallet is equal to $10

- the amount of money in my wallet is less than $10 or the amount of money in my wallet is equal to $10

- the amount of money in my wallet is greater than $10 and the amount of money in my wallet is less than $25

- the amount of money in my wallet is less than $10 or the amount of money in my wallet is greater than $25

For each of the examples above the students, as a class, can be asked to give examples of situations where the statements are true. The objective is to have the students start to develop the rules for Boolean algebra.

Boolean Algebra

And Or

A B A and B A B A or BT T T T T TT F F T F TF T F F T TF F F F F F

Conditional statements having one of two possible outcomes

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 52

The general form of this type of statement is as follows:

If <Boolean expression> then <statement(s) or actions to be performed if the Boolean expression is TRUE>

else

<statement(s) or actions to be performed if the Boolean expression is FALSE>

For example:

If <it is raining today> then <I will take an umbrella>

else

<I will take my sunglasses.>

When the expression <it is raining today> is TRUE, then the person will take an umbrella with them. If the expression is not true (its value is FALSE) then the person will take their sunglasses.

This example (or another similar one) could be given by the teacher and both the condition (Boolean expression) and the actions to be taken based on this condition being true or false must be explicitly stated. The class can then be asked whether or not this condition is true (given the actual circumstances at the time). Based on their answer, the students should be able to state which action will be performed. Once again, teachers must be very careful to word conditions in these examples so that they are clear-cut, the students must be able to determine whether or not the condition is true or false.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 53

Programming in PASCALLesson materials

This is a selection of exercises, assignments, projects and tests taken from the Computer and Information Science courses.

(Note: that most of these are taken from overhead screens and may require supplemental material to be complete lessons.)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 54

Calculations in Pascal

Arithmetic Operations PascalAddition + +

Subtraction - -

Multiplication X *

Division ÷ /

Examples of Mathematical Statements Pascal 3 + 2 = 3 + 2

3 - 2 = 3 - 2

3 x 2 = 3 * 23 (2) = 3 * 2

3 ÷ 2 = 3 / 2

3 (2) + 4 = 3 *(2) + 4

3 (2 + 4) = 3 * (2 + 4)

3 ( 2 + 4 ) = (3 * ( 2 + 4))/ (5 – 1) (5 – 1)

N.B. (“note well”):

1) The “equal” (=) sign is NOT required for calculations in PASCAL.

2) The order of operations (BEDMAS / BODMAS) is the same as in Mathematics.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 55

Programming in PASCAL

TURBO PASCAL (V 6.0) uses a menu and command interface:

Menu Command

To make a new file File New

To save a file the first time File Save As

To save a file that has been saved before File Save

To look at a previously saved file File Open

To see the result of a program Run Run

When you are finished working with a file Window Close

To see the output of a program on the Window Outputscreen

To see the program listing again Window Previous

Similar lists can be prepared depending on the editor that is used.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 56

Format (style) of PASCAL programs

All PASCAL programs should have the following format:

Program sample:

Begin

body of the program

End.

The Program Header

The program header must start with the word “Program” and this must be followed by a name. There must be at least one space between the word “Program” and the name of the program. Following this there must be a semi-colon.

The Main Body of the program

The instructions to the computer are contain in the (main) body of the program. The body of the program must have a “Begin” prior to the first statement and an “End.” after the last statement.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 57

Rules for identifiers in PASCAL

Identifiers (names) must not have blank spaces or special characters in them (except for an “underscore” (_).

A number may not be the first character of an identifier.

The following are illegal identifiers:

My program Sample! 1example

The following are legal identifiers:

My_program MyProgram Sample2

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 58

To clear the screen of the output from previous programs:

Program sample;

uses crt;

Beginclrscr;

body of the program

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 59

These two statements must be in the program!

OUTPUT STATEMENTS IN PASCAL

Output - information the user gets from the computer.

The command write is used to display (or show) information on the screen (which is an output device).

Syntax (the grammatical rules) of write:

Note the single quotation marks around the string (‘ ‘).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 60

write (‘ ‘);

commandinformation to be displayed on the screen

semi-colon

end of a statementcalled a string

(any characters inside ‘quotation marks’or any information NOT used in a calculation)

Output Statements in Pascal

Examples of output statements:

1) write (‘Hello’);

This will give as output on the screen:

Hello

Top left corner of theoutput area.

2) write (‘Hello’);

write (‘bthere’);

b means a blank space

This will give as output;

Hellobthere

3) A complete program using output statements:

program an_example;

begin write (‘Western’); write (‘bTechnicalb’);write (‘Commercial’);end.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 61

WesternbTechnicalbCommercial

OUTPUT

OUTPUT STATEMENTS IN PASCAL (2)

writeln command

The body of a program:

Begin

write (‘hello’);write (‘there’);

End.

will give as output:

To put the output on two lines the body of the program must be changed to:

Begin

writeln(‘hello’);write(‘there’);

End.

This will give as output:

The writeln command puts the output of the next statement on a new line.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 62

hellothere

left edge of the screen

hellothere

CALCULATIONS IN PASCAL

Example program with calculations:

program calculations;

uses crt;

begin

clrscr;writeln(2+3); writeln(2-3);writeln(2*3);writeln(2/3);

end.

REMINDER - Do NOT use an equal (=) sign in a calculation statement!!!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 63

5-166.666666667E-1

This is the output after we run the program.

OUTPUT

CALCULATIONS IN PASCAL

If a user sees output such as the following on the screen:

This output is not useful. Another way or saying this is that the output is not USER FRIENDLY.

To make the output user friendly we use output statements containing strings and calculations.

Program user-friendly;

Uses crt;

Begin

Clrscr;Writeln(‘2+3=‘, 2+3);Writeln(‘2 - 3=‘, 2 - 3);Writeln(‘2 * 3=‘, 2 * 3);

End.

The output from the calculation is shown next to the output from the string.Strings and calculations are separated by a comma (,).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 64

5 -1 6 6.666666667E-1

2 + 3 = 52 - 3 = -12 * 3 = 6

OUTPUT

FORMATTING OUTPUT

Format - the appearance of the output.

One way of formatting output (changing the appearance of the output) is to change where the output appears on a line.

Example:writeln(‘Hello!’);

gives the output Hello!

To move this output away from the left margin:a) count the number of symbols (or characters) in the string ‘Hello!’

There are 6 characters in the string.

b) add to this answer the number of spaces that the string is moved away from the left (margin) edge.

e.g. 2 spaces from the left6 + 2 = 8

c) format the statement:

Output: bbHello!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 65

Two blank spaces.

This tells the computer to put the string into 8 spaces and to ‘fill’ these spaces from the right.

writeln(‘Hello!’:8);

FORMATTING OUTPUT

Formatting Strings

Example:

writeln(‘WTCS’:6);writeln(‘has’:5);writeln(‘great’);writeln(‘computer’:11);writeln(‘courses!’:12);

Formatting Values – numbers without decimal points (INTEGERS)

Example:

writeln(234:5);writeln(234:6);writeln(234:7);writeln(2 + 3:6);writeln( (4 - 1) * 3:7);

Formatting Values – numbers with decimal points (REALS)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 66

OUTPUT

bbWTCS

bbhasgreatbbbcomputerbbbbcourses!

OUTPUT

bb234

bbb234bbbb234bbbbb5bbbbbb9!

Example:writeln (2345.678 : 8 : 3); 2345.678

The first value represents the total number of spaces given to the complete real number (INCLUDING the decimal point). The second value indicates the number of spaces given to the fraction portion of the real number.

writeln (2345.678 : 8 : 2); b2345.68

The extra space is to the LEFT of the number and the decimal fraction portion of the number is rounded-off if the number of spaces is less than the number of digits in the fraction portion.

writeln (2345.678 : 8 : 1); bb2345.7

writeln (2345.678 : 7 : 2); 2345.68

writeln (2345.678 : 7 : 1); b2345.7

Formatting Strings and Values

It is possible to use two (or more) formats in an output statement:

Example:writeln(‘Together!’:12, (8 * 2):4);

will give the output:

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 67

bbbTogether!bb16

PROGRAMMING IN PASCAL

Comment Statements: { ...................... }

Comment statements are used in a program to explain parts of the program (and sometimes how they work) to someone who reads the program. This person reading the program may not be a programmer. Because of this, comments must be understandable (clearly written ).

The computer does not follow any instructions that appear in a comment statement. Comments are only for a person reading the program.

An example of a program with comment statements:

Program letterA;

{This program shows the letter A on the screen.}

Uses crt;

Begin

{This is the start of the program.}

Clrscr; Writeln(‘bbbA’);Writeln(‘bbAbA’);Writeln(‘bAAAAA’);Writeln(‘AbbbbbA’);

{This is the end of the program}End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 68

Explanations of

the program for

the reader.

VARIABLES

A variable is a place in memory that is used to store information.

To distinguish one variable from another we use a variable name or a variable identifier.

The information stored in a variable is called a value. Variables hold one value.

Here is one way to remember what these terms mean!!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 69

Variable

AVariablevariable

name

AVariablevariable

name

value

3

Mail box

letter (or package)

125 Evelyn Crescent

Variable

data

A

VARIABLE DECLARATION

Before we can place information in memory we must declare a variable.

There are two purposes of declaring variables:

1) to give the name of the variable

2) to give the type of information that will be stored in the variable.

var -This command is used to declare a variable.

Example:

These var statements must appear before the main body of the program, ahead of any other command statements in the program (except for comment statements).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 70

var first: integer;

second: integer;

variablename

variable type

The type of information that will be given to (or stored in) the variable.

PLACING INFORMATION IN MEMORY

One way of placing information in memory is by using an assignment statement.

This type of statement allows the programmer to assign (to give) a value to a variable.

Example:

This is read “time is assigned the value of 3”.The result, in terms of our ‘mailbox’ analogy, looks like this:

Here is an example of a program that uses the assignment statement:

Program example;Var time : integer ;

Begintime := 3;Writeln ( ‘The time is ’, time, ‘ hours.’);End.

The output of this program is:

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 71

Time := 3;

variable name assigned value

TIME

3

The time is 3 hours.

Tracing Values in a program

Trace the values in the following program:

Program Trace;

VarNum1,Num2,Num3: Real;

Begin

Num1:=5;

Num2:= Num1 * 2;

Num3:= Num2 + 1;

Writeln(Num1,’ ‘,Num2,’ ‘,Num3);

Num1:= Num3 – 5;

Writeln(‘Num3 has the value ‘,Num3);

Num2:= Num1 + Num2;

Writeln(Num2);

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 72

Tracing Values in a program

Tracing values in the variables of a program is used to keep track of the information in a program and to understand how the program works. Because of this, TRACING is a valuable tool in the DEBUGGING (or correcting) of programs.

Steps in tracing values in the variables of a program:

1. Make a chart with one column for each variable in the program.2. Label each chart with name of a variable (usually with the first named or

declared variable first).3. All variables have no value (‘-‘) unless a value is assigned to the

variable in a statement.4. Only one value may change in a line of the chart.

Tracing table or tracing chart for the program Trace:

PLACING INFORMATION IN MEMORY (2)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 73

Another way of placing information in memory is by using an input statement.

This type of statement allows the user to assign (to give) a value to a variable.

Example:readln(Time) ;

The command readln tells the computer to stop the program and to wait for the user to type a value using the keyboard.

When the user presses the ENTER key the value that was typed by the user is placed in the memory of the computer in the variable named in the brackets.

Here is an example of a program that uses the input statement:

Program another_example;Var time : integer;

Beginreadln(time);Writeln ( ‘The time is ’, time, ‘ hours.’);End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 74

3_

The time is 3 hours.

The value entered by the user (the cursor is now beside the value).

When the user runs the program, a flashing (blinking on and off) cursor _ is shown on the screen as a signal that the program is waiting for information. If the user typed the value 3 at the cursor, then this would be the output:

The value typed by the user is stored in memory:

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 75

TIME

3

Tracing Variables

Example:

Trace the values in the variables of the following program.

Program Try_this;

VarFirst,Second,Total : real;

Begin

First:=0;Second:=10;Writeln(‘The sum of these values is ‘,First + Second);Total:= First + Second;Writeln(First, Second, Total);First:= Second / 2;Second:= First – 4;Total:= Total + Second – First;Writeln(First, Second);Total:= Total * Total;Writeln(Total);

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 76

Tracing Values

Trace the values in the variable of the following program if the user enters first 6 then 8.

Tracing

Program Another_one;

VarVal1, Val2: Real;

Begin

Writeln(‘Please enter the first value.’);Readln(Val1);Writeln(‘Please enter the second value.’);Readln(Val2);Writeln(‘The sum of these values is ‘,Val1 + Val2);Val2:= 3 * Val1;Val1:= Val2 – 3;Writeln(‘Val1 is now ‘,Val1);Writeln(‘Val2 is now ‘,Val2);

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 77

LOOPS

Repeating instructionsOne way to have the computer repeat instructions is to use the same instruction as many times as we want the computer to execute the instructions.

Example:

writeln(‘WTCS’);writeln(‘WTCS’);writeln(‘WTCS’);writeln(‘WTCS’);writeln(‘WTCS’);

If we needed to have the instructions many times, then we would have to repeat the instructions many times.For example, if we wanted to see ‘WTCS’ as output on the screen 1000 times, we would have to repeat the output statement 1000 times!Because this takes too much time and work, there is a shorter method of doing this.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 78

WTCSWTCSWTCSWTCSWTCS

Output

LOOPS

Counted Loops

The following program segment has the same output as the example above:

Example:

For x:=1 to 5 do begin writeln(‘WTCS’); end;

The COUNTED LOOP begins with the “For” statement.

This statement has several parts:1. the LOOP CONTROL VARIABLE, in this case x;2. an INITIAL VALUE, 1, assigned to the loop control

variable;3. the FINAL VALUE, 5, of the loop control variable.

To change the number of times that the loop will repeat the instructions after the “For” statement, we can change the final value.

e.g. For x:=1 to 1000 do

This would repeat the output 1000 times!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 79

WTCSWTCSWTCSWTCSWTCS

Output

LOOPS

Other examples:

For w:=1 to 4 do Begin Writeln(‘ Hello,’); Writeln(‘how are you today?’); End;

For w:=1 to 4 do Begin Writeln(‘ Hello,’); End;Writeln(‘how are you today?’);

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 80

Hello,how are you today?Hello,how are you today?Hello,how are you today?Hello,how are you today?

Output

Hello,Hello,Hello,Hello,how are you today?

Output

LOOPS

How the COUNTED LOOP works:

1. At the start of the loop, the loop control variable is assigned the initial value.

2. The statements (if there is more than one, they must be between “begin” and “end;”) following the “For” statement are executed.

3. The program returns to the “For” statement and the value in the loop control variable is incremented by 1 (1 is added to the value already in the variable).

4. The new value in the loop control variable is compared with the final value in the “For” statement. If the value in the loop control variable is less than or equal to the final value, the statements after the “For’ statement are executed. If the value is greater than the final value, the program continues with the next statement after the loop.

When this type of counted loop statement

For <loop control variable> := initial value to final value do

is used then

initial value <= final value

the initial value must be less than or equal to the final value.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 81

LOOPS

Other Counted Loops

The initial value in the counted loop statement may be any integer value.

e.g.For a:= 0 to 7 do

This counted loop will repeat 8 times.

e.g.For n:= -3 to 5 do

This counted loop will repeat 9 times.

e.g.For t:= 3 to 3 do

This counted loop will repeat 1 time.

In each case, the initial value is less than or equal to the final value.

It is possible to have the value in the loop control variable decrease each time. To do this, we replace the “to” with “downto”.

e.g.For num:=5 downto 1 do

This loop will repeat 5 times. The value in the loop control variable is incremented by –1.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 82

Tracing Values – COUNTED LOOPS

Trace the values in the following program.

Program Something_different;

VarCount:integer;

Begin

Writeln(‘Here is a program with a loop.’);

For count:= 2 to 6 doBeginWriteln(‘Count=’, count);Writeln(‘Count * 2=’, count * 2);End;

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 83

Tracing Values – COUNTED LOOPS 2

Trace the values in the following program.

Program Another_one;

VarWhat,Sum:integer;

Begin

Sum:=0;

Writeln(‘This is program number.’,Sum +2);

For What:= -1 to 3 doBeginWriteln(‘What=’, What);Sum:=What + Sum;Writeln(‘Sum=’, Sum);End;

Writeln('The final value is ',Sum);Writeln('The program is now finished!');

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 84

LOOPS

Conditional Loops - While

While <condition (or Boolean statement)> do

Begin Statements to be repeated End;

Example1:Convert the following counted loop into a conditional While loop.

For x := 1 to 25 do

BeginStatements to be repeated

End;

To do this we must make sure that the new loop performs the same actions as the counted loop.

X := 1; { The loop control variable must be given an initial value.}

While (x <= 25) do {The loop must check that the value of the variable is less than or equal to 25.}

BeginStatements to be repeatedX := X + 1; {The value of the variable

x must be incremented.} End;

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 85

LOOPS

Conditional Loops

Example 2:

Readln(number); {The user must enter a value to be used in the Boolean expression.}

While (number>=0) and (number<=30) do

BeginWriteln(‘Your number is ‘, number);Total := number + Total;Readln(number); {The user must enter another

value to make sure that the loop either continues or ends!}

End;

Writeln(‘The total of the values is ‘,Total);

This program will calculate the total of the values that the user types as long as they are between the values of 0 and 30. When the user enters a value not in this range then, the loop ends and the total value is given.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 86

LOOPS

Conditional Loops - Repeat

Repeat Begin Statements to be repeated

End; Until <condition (or Boolean statement)>

Example1:Convert the following counted loop into a conditional Repeat loop.

For x := 1 to 25 do

BeginStatements to be repeated

End;

To do this we must make sure that the new loop performs the same actions as the counted loop.

X := 0; {The loop control variable must be given an initial value.}Repeat {The start of the loop.}

BeginX := X + 1; {The value of the variable

x must be incremented.} Statements to be repeatedEnd;

Until X > 25 ; {The condition that will stop the loop.}

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 87

LOOPS

Conditional Loops - Repeat

Example 2:

Total := 0;Number := 0;Repeat {The start of the loop.}

BeginTotal := number + Total;Readln(number); {The user must enter another

value to make sure that the loop either continues or ends!}

Writeln(‘Your number is ‘, number);End;

Until (number<0) or (number>30); Writeln(‘The total of the values is ‘,Total);

This program will calculate the total of the values that the user types as long as they are between the values of 0 and 30. When the user enters a value not in this range then, the loop ends and the total value is given.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 88

Arrays in Pascal

A variable can only hold one piece of information. If we want to store several pieces of information, then we must use several different variables.

What is the output of the following program if the user types the values 5,10, 15, 20, 25?

Program sample;Var

Count: integer;What: real;

Begin

For Count:=1 To 5 DoBeginReadln(What);End;

Writeln;

For Count:=1 To 5 DoBeginWriteln(What);

End;

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 89

510152025

2525252525

Output

Consider the following program:

The user enters the same values as for the previous program (5, 10, 15, 20, 25): Program sample2;

VarCount: integer;

Numbers: array[1..5] of real; Begin

For Count:=1 To 5 Do

Begin Readln(Numbers[Count]); End;

Writeln;

For Count:=1 To 5 DoBegin

Writeln(Numbers[Count]); End;

End.

The values entered by the user are stored in the ARRAY called Numbers.

The array looks like this:

Numbers

1 2 3 4 5

5 10 15 20 25

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 90

510152025

510152025

Output

The parts of the array are indicated by the INDEXES, in this case the values 1 to 5. Information (5, 10, 15, 20, 25) is stored in the ELEMENTS of the array.

The name of the array, range of the indexes, and the type of information to be stored in the array is shown in the declaration statement:

NOTES:- an array can only be declared as only ONE holding type of

information- an array can only have as many elements as is indicated by

the range of its indexes

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 91

Numbers: array[1..5] of real;

Name Range of index Type of information to be stored stored

Arrays in Pascal

Show your answers to your teacher

1) Type and run the following program. Write down the output if the user types the values:

10, 20, 30, 40, 50

Program sample;Var

x: integer; y: real; Begin

For x:=1 To 5 DoBegin

Readln(y); Writeln(y); End;

For x:=1 To 5 DoBegin

Writeln(y) End;

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 92

Output

2) Type and run the following program. Write down the output (enter the same values as in question 1.).

Program sample2;Var

x: integer; y: array[1..6] of real;

BeginFor x:=1 To 5 Do

Begin Readln(y[x]); Writeln(y[x]); End;

For x:=1 To 5 Do Begin Writeln(y[x]); End;

End.

2a) What is the difference between the output of 1) and the output of 2)?

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 93

Output

3) Write a program that will read and store and then print all of the following data (use the program in 2) as an example): 34, 45, 64, 12, 78, 98, 100

4) Arrays can be used to compare two lists of data. For example if we want to compare two lists of numbers:

List a List b25 4613 7681 5962 1334 5220

The two lists have one value in common: 13.

The following program will compare these two lists and find any data that is the same in both lists:

Program sample3;Var x,y: integer; a: array[1..6] of real; b: array[1..5] of real;

BeginFor x:=1 To 6 Do Begin Readln(a[x]); End;

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 94

For x:=1 To 5 Do Begin Readln(b[x]); End;

For x:=1 To 6 Do Begin For y:=1 To 5 Do Begin If a[x]=b[y] then writeln('The value that is the same in both lists is:',a[x]); End; End;

End.

5). Insert comment statements and output statements into the program in question 4) to make it user friendly.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 95

6) Alter the program in question 4) so that the search for the same value will end when it is found (i.e. there is only one value in each list that is the same).

Hint: use a conditional loop (see the file ______________ for an example).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 96

Textfiles in Turbo Pascal

Table of contents

Number Topic Page

1. Declaring Text Files 98

2. Linking file variable names and external files 98

3. Opening a new text file (Rewrite) 98

4. Opening an existing text file (Reset) 98

5. Writing to a text file 99

6. Reading from a text file 100

7. End of line marker – Eoln( ) 100

8. End of file marker Eof( ) 100

9. Closing a file – Close( ) 101

10. Summary - Turbo Pascal textfiles 101

11. Program to read an uncompiled Pascal program as a text file 102

12. Program to search a textfile for a character 103

Textfiles in Turbo Pascal

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 97

In PASCAL the term “file” is used to refer to a “logical device” that can transmit or receive data.

Files declared as text are structured into lines of characters. Each of these lines ends with a special character, the end-of-line marker. Each file ends with a special character, the end-of-file marker.

1. Declaring Text Files

To declare a text file called Information the following statement would be used:

VarInformation:text;

(Names for files follow the same rules as for other identifiers in Pascal.)

2. Linking file variable names and external files

In the body of the program a file variable must be linked to an external file using the Assign statement.

To link the file variable called Information with the external file Info.txt we would use:

Assign(Information,’Info.txt’);

3. Opening a new text file (Rewrite)

To create a new empty file called Info.txt, the above Assign statement would be used along with:

Rewrite(Information);

(Note: Rewrite is also used to open an existing file so that it can be overwritten.)

4. Opening an existing text file (Reset)

If a file has been previously created (e.g. Old_stuff) then the following statement would be used to open it:

Reset(Old_stuff);

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 98

5. Writing to a text file

The word “write” means to transmit data from a program to a file. In the following statements, the first parameter in the statements is the file variable name. This ensures that information is written to the file instead of the screen. (Note: see Rewrite)

a) using Writeln

The following statement can be used:

Writeln( ) adds an end-of-line marker to the end of the characters that are added to the file.

(Note that information can be written to a file using a format. For example, if user_info is a string, then the following could be used:

Writeln(Information,user_info:20);

this would write the string to the file Information in a space of 20 characters. Any blank spaces would be to the left of the string.

b) using Write

The following statement can be used

Write( ) only adds characters to the file. These characters are added to the same line until an end-of-line marker is added by using:

Writeln(Information)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 99

Writeln(Information,user_info);

file variable name variable of the same type as the information in the file

Write(Information,user_info);

file variable name variable of the same type as in the file

6. Reading from a text file

“Read” means to transmit data from a file to a program.

The values from the file Information would be stored in the variable Material (the variable must be of the same type as the information in the file).

Read( ) will read characters until it reaches the next character that is illegal, for the type that the variable Material has been declared, and will stop at that position. Any subsequent calls of Read( ) will start at that position. The first legal piece of information will be stored in the variable. If Read( ) encounters an end-of-line marker, it moves to the next line and continues to read from there.

Readln( ) moves beyond the end-of-line marker when it has stopped reading.

If the first piece of information is of an incorrect type, an error will result.

7. End of line marker – Eoln( )The function call:

Eoln(Information);

will return a value of True if the end-of-line marker has been reached. A value of False is returned otherwise.

8. End of file marker Eof( )The function call

Eof(Information);

will return a value of True if the current position is beyond the last item in the file (otherwise it will return a value of False).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 100

Readln(Information,Material);

file variable name variable used to store values

Read(Information,Material);

9. Closing a file – Close( )To close a file the following procedure call is used:

Close(Information);

NOTE: if files are not closed:a) operations performed on the file will not take effectb) files must be closed before you can switch between operations – after

writing items to a file you must close it and then open it before you can read any items

Also, if a file is closed, items in that file cannot be accessed until the file is re-opened.

10. Summary - Turbo Pascal textfiles

Files allow information to be permanently stored on storage media. Other data structures lose data once a program terminates. Files may contain any number of items and they may vary in size while a program is running.

When using textfiles in Turbo Pascal:

1. A link must be created between the program and the file to be processed.

2. Files must be opened to allow processing to occur.

3. After processing files must be closed.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 101

11. Program to read an uncompiled Pascal program as a text file

program tryfile;

uses crt;

const

path=' ';{this can be the path to any Pascal file}

var indata:text;

line:string; i,element : integer; New : array [1..200] of string;

beginclrscr;Assign( indata, path );reset ( indata );

element := 0 ;

While not EOF( indata ) do begin readln ( indata, line ); element := element + 1; New [ element ] := line; end;

Close ( indata );

for i:=1 to element do writeln ( New[i] );

readln;

end.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 102

12. Program to search a textfile for a character

If we wanted to count the number of occurrences in a textfile of a particular character, for example “i”, then we could add the following statements (note: Txt_file is the name of the file that has been read):

Reset(Txt_file);counter:=0;While not Eof(Txt_file) do

beginWhile not Eoln(Txt_file) do

beginRead(Txt_file,Ch);write(Ch); {optional.}If Ch=’i’ then

counter:=counter + 1; end;

Readln(Txt_file);{To read the next line in the file.}writeln;{To give output on the next line – optional.}end;

writeln(‘The letter “i” occurs ‘,counter,’ times.’);close(txt_file);

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 103

ALGORITHMS

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 104

ProgrammingAlgorithms

DefinitionA logical sequence of events in solving a problem.

(A sequence is “a following of one thing after another”.)

The word algorithm comes from the name of al-Khwarizimi, a 9th century mathematician in the court of al-Mamun (son of the famous “Arabian Nights” caliph, Harun al-Rashid) in Baghdad.

An everyday example of an algorithm is a recipe. A recipe gives a series of steps, or instructions, that must be followed in a certain order to make a dish.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 105

ProgrammingAlgorithms

Example of an algorithm showing how to enter a locked room:

1. Walk to the room.2. Stop at the door.3. Take the keys from your pocket.4. Choose the correct key.5. Put the key in the lock.6. Turn the key.7. Open the door.8. Take the key out of the lock.9. Walk into the room.

With each algorithm the writer must make certain assumptions that the writer believes are true about the situation and the person who will be following the instructions.

In this case the assumptions are:

1. The person can find the correct door.

2. The person has the correct key with them.

3. The person can tell which key is the correct key.

4. The person knows how to use a key to open a lock.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 106

ProgrammingAlgorithms

Example of an algorithm showing how to find the mean (average) of five numbers:

1. Get the five numbers.

2. Add the five numbers together to get a total.

3. Divide the total by five to get the result.

4. Write down the result.

Assumptions:

1. There are five numbers to be averaged.

2. The person understands arithmetic.

Write an algorithm that will find the mean of any number of values.

1. Get the values.

2. Count the number of values.

3. Add the values together to get a total.

4. Divide the total by the number of values.

5. Write down the result.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 107

ProgrammingAlgorithms

Algorithm: how to find the mean (average) of three numbers.

1. Get the three numbers.

Value 1 is 25, value 2 is 20, value 3 is 45.

2. Add the three numbers together to get a total.

Total=value 1 + value 2 + value 3= 25 + 20 + 45= 90

3. Divide the total by three to get the result.

Average = Total / 3 = 90/3 = 30

4. Write down the result.

The mean of the three numbers 25, 20 and 45 is 30.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 108

ProgrammingAlgorithms

Program: finding the mean of three numbers.

Value1:= 25;

Value2:= 20;

Value3:= 45;

Total := Value1 + Value2 + Value3;

Average:= Total / 3;

Writeln( ‘The mean of the three numbers ‘, Value1, ’,’ ,Value2, ‘ and ‘, Value3, ‘ is ‘, Average, ‘.’);

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 109

ProgrammingAlgorithms

The complete Turbo Pascal program to find the mean of three numbers:

Program mean;

{This program will find the mean (or the average) of three numbers that the programmer has entered into the program.

Written by: Mr. Kavanagh, May, 1998}

Var

Value1,Value2,Value3,Total,Average : real;

BeginValue1:= 25;

Value2:= 20;

Value3:= 45;

Total := Value1 + Value2 + Value3;

Average:= Total / 3;

Writeln( ‘The mean of the three numbers ‘, Value1, ’,’ ,Value2,‘ and ‘, Value3, ‘ is ‘, Average, ‘.’);

End.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 110

COMMON ALGORITHMS FOR SENIOR PROGRAMMING COURSES

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 111

Searching

Search: To find a particular value in a list of values.

Searching Algorithms

Linear or sequential search

In this type of search each item in the list is examined to see if it is the required value.

For example, given the list:

10 30 15 20 40

If we use a linear search to find the value 20:

1. Check the value in position 1. If this value is the same as the value that is to be found, then "remember" the position and stop searching.

The value in position 1 is not the same as 20.

2. Repeat step1 for all values in the list.

The value in position 2 is not the same as 20.

The value in position 3 is not the same as 20.

The value in position 4 is the same as 20.The position is 4.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 112

This method will not work if the value to be found is not in the list (e.g. 50):

1. Check the value in position 1. If this value is the same as the value that is to be found, "remember" the position and stop searching.

The value in position 1 is not the same as 50.

2. Repeat step1 for all values in the list.

The value in position 2 is not the same as 50.

The value in position 3 is not the same as 50.

The value in position 4 is not the same as 50.

The value in position 5 is not the same as 50.

NO MORE VALUES TO CHECK -- ERROR

To solve this problem, the first step can be changed to the following:

Check the value in position 1. Stop searching if the value is found and "remember" the position. If all the values have been checked then "remember" the position as 0.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 113

Binary Search

Linear searches will allow us to find a particular position of a value in a list. To do so however, we must compare each value in the list to the value that we are seeking. This is a time consuming process.

A way of reducing the amount of time is to use a Binary Search.

Binary Search

In order to perform a Binary Search, the list must first be sorted.

For example, given the list:

10 30 15 20 40

Find the position of the value 40.

This could be sorted using any of the previously mentioned methods:

10 15 20 30 40

Following the sorting these are the steps used for the search:

1. Find the value in the middle position of the list (the "middle value" in the list).

Method of finding the position of the middle value:

(first position + last position) div 2= (1 + 5) div 2= 6 div 2= 3

The "middle value" in position 3 is 20.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 114

2. Compare the value that is to be found with the "middle value".

If the value to be found is less than the "middle value" then, the list becomes the values to the left of the middle value.

If the value to be found is greater than the "middle value" then, the list becomes the values to the right of the "middle value".

If the value to be found is equal to the "middle value" then, remember the position of the middle value.

If the value is not found in the list, then position is 0.

40 > 20

30 40 --> the new list

3. Repeat steps 1, 2 until the value is found.

1. (4 + 5) div 2 = 9 div 2 = 4

The "middle value" in position 4 is 30.

2. 40 > 30

Use the values to the right of 30 as the list.

The new list is 40.

3. (5 + 5) div 2 = (10) div 2 = 5

The "middle value" in position 5 is 40.

4. 40 = 40

The position of the value is 5.

The Linear or Sequential search for a value in a list of 5 values requires up to 5 comparisons. Using a Binary search this is reduced to a maximum of 3 comparisons.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 115

Sorting

Sorting:The process of putting a list of items (usually in an array) in order. This order can be either numerical or alphabetical.

Sorting Algorithms

Selection Sort

An unordered list of numbers

10 30 15 20 40

Algorithm to put a list in order from the highest value to the lowest value:

1. find the lowest value and exchange it with the last value

40 30 15 20 10

2. ignore the last value (the previous lowest value) and find the lowest value and exchange it with the new "last value"

40 30 20 15 10

3. repeat 2. until the number of items in the list is one

40 30 20 15 10 (20 20)

40 30 20 15 10 (30 30)

40 30 20 15 10 40 is the "last value"

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 116

Bubble sort

Using the same list as previously used.

An unordered list of numbers

10 30 15 20 40

1. Compare values in positions 1 and 2 and put the lowest value in position 2

30 10 15 20 40

2. Compare values in positions 2 and 3 and put the lowest value in position 3

30 15 10 20 40

3. Compare values in positions n and, n+1 and put the lowest value in position n+1 until the n+1 is the same as the position of the "last value"

30 15 20 10 40 (20 and 10 exchanged)

30 15 20 40 10

4. go back to position 1 and repeat step 3.

30 15 20 40 10 (30 and 15 not exchanged)

30 20 15 40 10 (15 and 20 exchanged)

30 20 40 15 10 (15 and 40 exchanged)

30 20 40 15 10 (15 and 10 not exchanged)

5. repeat step 4

30 20 40 15 10 (30 and 20 not exchanged)

30 40 20 15 10 (40 and 20 exchanged)

30 40 20 15 10 (20 and 15 not exchanged)

30 40 20 15 10 (15 and 10 not exchanged)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 117

6. repeat step 4.

30 20 40 15 10 (30 and 20 not exchanged)

30 40 20 15 10 (40 and 20 exchanged)

30 40 20 15 10 (20 and 15 not exchanged)

30 40 20 15 10 (15 and 10 not exchanged)

7. repeat step 4.

40 30 20 15 10 (40 and 30 exchanged)

40 30 20 15 10 (30 and 20 not exchanged)

40 30 20 15 10 (20 and 15 not exchanged)

40 30 20 15 10 (15 and 10 not exchanged)

8. repeat step 4.

40 30 20 15 10 (40 and 30 not exchanged)

40 30 20 15 10 (30 and 20 not exchanged)

40 30 20 15 10 (20 and 15 not exchanged)

40 30 20 15 10 (15 and 10 not exchanged)

At this point the sort is complete since no further exchanges have taken place.

Steps 4 - 8 could be replaced by the following:

- go back to position 1 and repeat step 3 until no exchanges take place between any of the elements in the list.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 118

Insertion Sort

Using the same list as previously used.

An unordered list of numbers

10 30 15 20 40

1. Compare the values in positions 1 and 2, put the higher value in position 1.

30 10 15 20 40

2. Compare the value in position 3 with the values in positions 1 and 2. Put this value to the left of the value that is less than it.

30 15 10 20 40

3. Repeat step 2 for each remaining value. Compare each value in position n with the values in the positions (n – 1), (n - 2) …, 1. Put the value from position n to the left of the value that is less than it.

30 20 15 10 40

40 30 20 15 10

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 119

Efficiency of Sorting Algorithms

For an list of n values:

Bubble Selection Insertion

Exchanges

Comparisons

Passes

NOTES:

1. The formulas for the insertion sort are based on the worst possible case (i.e. the numbers are in the reverse order to that required).

2. The Insertion Sort can be made more efficient by the use of a binary comparison or search. This will make the number of comparisons log2n.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 120

Recursion

Recursive routine:

1. A routine that calls itself directly, or that calls itself indirectly through an intermediate routine.

from New Webster's Computer Dictionary

2. A procedure that repeats itself, with each repetition based on the results of the previous one, so as to reduce a complex problem into a series of progressively simpler problems until a solution is reached.

from Webster's New World Dictionary of Computer Terms

Factorial

Definition of N! :

N! = N x (N – 1) x (N –2) x (N – 3) x … x 1

In general N! = (N - 1)! x N

And 1! = 1

Example:

For 4! :

4! = 3! x 4

= (2! x 3) x 4

= (1! x 2) x 3 x 4

= (1) x 2 X 3 x 4

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 121

Recursion

A function in PASCAL to calculate N! :

Function Factorial(N: integer) : integer;

beginif N = 1 then

Factorial:=1

elseFactorial:= Factorial(N - 1) x N;

end;

The function “Factorial” is recursive because it calls itself in order to perform the calculations.

A program using the function “Factorial” to calculate the factorial of a number:

Program Calculate;

varresult : integer;

Function Factorial .......

begin

result := Factorial(3);

writeln (result);

end.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 122

Recursion

Steps in the process of calculating the factorial of a number (in this case 3):

result Factorial(3)

Factorial(3) Factorial(2) x 3

Factorial(2) Factorial(1) x 2

Factorial(1) = 1

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 123

Other Computer Studies Topics

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 124

Binary number exercises

1. Convert the following binary numbers to decimal numbers.

a) 10 b) 11 c) 101 d) 111

e) 1010 f) 1100 g) 1011 h) 1001

i) 1110 j) 1111 k) 10000 l) 10101

m) 11001 n) 11100 o) 11110 p) 11111

q) 10011 r) 10110 s) 11011 t) 10001

2. Convert the following decimal numbers to binary numbers.

a) 2 b) 5 c) 10 d) 12

e) 20 f) 25 g) 28 h) 32

i) 35 j) 42 k) 50 l) 64

3. Add the following binary numbers.

a) 10 b) 101 c) 10101 d) 110110 01 011 1100 11001

e) 101010 f) 11100 g) 110011 h) 110001 011010 1011 11101 011011

i) 110010 j) 101010 k) 1101010 l) 1000111 01110 110011 0111110 101010

m) 1111111 n) 11110000 o) 11001101 p) 101100101 0101101 01001101 01101001 111111101

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 125

BINARY ARITHMETIC

1. Find the sum of the decimal numbers 18 and 23 in binary. Verify that the result is the decimal number 41.

2. Add the following binary numbers. Check your results for a), b) and, c) by expressing in base 10 the numbers in both the question and the answer.

a) 1001 b) 101111 c) 11011 101 1011 10011111

d) 111111 e) 11111111111 f) 1111111111 111111 00000000001 1000000000

3. Find the product of the decimal numbers 7 and 3 in binary. Verify that the result is the decimal number 21.

4. Multiply the following binary numbers. Check your results for a), b) and, c) by expressing the numbers in the question and the answer in base 10.

a) 01 b) 10 c) 11011 d) 1010 10 1010 111 1001

e) 111 f) 11101 g) 11011 h) 111111 111 1011 1110101 100000

5. Find the difference between the decimal numbers 115 and 41. Verify that the result is the decimal number 74.

6. Subtract the following binary numbers. Check your results for a), b) and, c) by expressing the numbers in the question and the answer in base 10.

a) 11 b) 101 c) 110011 d) 10110000 1 10 1101 1

e) 1000000000 f) 1011000010 g) 110010111 1 10000101 1111010

h) 10110001000 100010001

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 126

Hexadecimal Numbers

NumbersDecimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

Converting from Hexadecimal to Decimal:

1B9 0001 1011 1001 110111001 (1*256)+(1*128) + (0*64) + (1*32) + (1*16) + (1*8) + (0*4) +

(0*2) + (1*1) = 441

Note that each hexadecimal digit corresponds to four binary digits!

Converting from Decimal to Hexadecimal:

(97)10 =64 + 32 + 1 1100001 0110 0001 6 1(61)16

1. Complete the following chart:

Decimal Binary Hexadecimal

12 1100 C

15 1111 _______

_______ 10111011 BB

_______ _______ ABC

_______ 1101110 _______

43 _______ _______

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 127

Computer and Information ScienceBinary number Test

Name: ____________________

Mark: ____/____

Show all work.

1. Convert the following binary numbers to decimal numbers.

a) 1010 b) 10101 c) 110101 d) 10110111

2. Convert the following decimal numbers to binary numbers.

a) 7 b) 22 c) 425 d) 1320

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 128

Computer and Information ScienceBinary number Test

Name: ____________________

3. Add the following binary numbers.

a) 10 b) 1100110 01 101001

[3 marks]

c) 110001 d) 1010101 011011 0101101 011110 1110011

[4 marks]

4. Find the product of the following binary numbers.

10101101 1011

[3 marks]

5. Find the difference between the following binary numbers.

a) 101110 b) 101011011 10111 11100110

[5 marks]

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 129

Computer and Information ScienceBinary number Test

Name: ____________________

6. Find the sum of the decimal numbers 18 and 23 in binary. Verify that the result is a binary number that is equal to the decimal number 41.

[6 marks]

7. Find the difference between the decimal numbers 115 and 41 in binary. Verify that the result is a binary number that is equal to the decimal number 74.

[6 marks]

Hexadecimal numbers

1. Convert the number (2DE)16 to a decimal number.

[4 marks]

2. Convert the number (213)10 to a hexadecimal number.

[4 marks]

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 130

Grade 10 Computer StudiesComputer Careers

Research Assignment

Definitions:

job: a particular task

occupation: a means (way) of making a living

profession: an occupation that requires training and specialized study.

career: a person's progress in their chosen profession

Assignment:

1. Form groups as instructed by your teacher.

2. After reading the document “Careers, Challenging Computer Careers “, choose as a group one of the Computer Science career areas listed below.

3. By researching or rereading the “Careers…” document find one job that is part of the career area that you have chosen.

4. Using further research, complete all items on the sheet “Grade 10 Computer Studies Career Research Assignment”.

5. Produce a final copy of your work on the worksheet “Grade 10 Computer Studies Career Research Assignment” that can be distributed to the other students in the class. This copy must be clean and legible.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 131

Grade 10 Computer StudiesComputer Careers

Research Assignment

Marking scheme:

Career 2 marksJob description 2 marks

Education and, or 10 marksTraining required

Other related skills 5 marks

Work environment 3 marks

References 6 marks

Useful web address(es) 2 marksand other sources of information

FINAL copy 10 marks

Due date: ________________________

NOTE: this work may form the basis for a presentation or a test/exam question.

Computer science career areas:

Taken from: “Careers, Challenging Computer Careers “

1. Operations2. Programming3. Systems4. Data communications5. Database administration6. Technical7. Other

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 132

Grade 10 Computer Studies

Career Research Assignment

Name(s):_________________________________________

Career

Job description

Education and, or training required

Other related skills

Work environment

Salary range

References

Useful web address(es)and other sourcesof information

Other comments

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 133

Grade 10 Computer Careers Research AssignmentPart 2 - Creating a classified job advertisement

Using the information that your group has gathered for Part 1 of this assignment, create a classified job advertisement for a position based on the job that you have researched.

Form of the advertisement:

The job ad must be presented in a style similar to that of one in a national newspaper.

Content requirements of the classified advertisement:

1. The name of the company (make up your own name).

2. The position for which your are seeking an employee.

3. The educational requirements of the position.

4. Previous work experience required for the position (if any).

5. Other skills required for the position.

6. The salary range of the position.

7. Whether or not the position is a permanent one. The length of the contract if it is a contract position.

8. The responsibilities of the position.

9. The work environment.

10. Benefits (such as: medical insurance, paid vacation, on site banking, profit sharing plan, career counseling, etc.).

11. Application information (in person, by phone, by facsimile, by e-mail, with resume, with a portfolio).

12. Name and title of the contact person.

13. Contact information (mailing address, e-mail address, telephone number, facsimile number, web site address).

14. The date by which the application must be received.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 134

Grade 10 Computer Careers Research AssignmentPart 2 - Creating a classified job advertisement

Marking Scheme

Form

For a group to achieve the top mark, the job advertisement must be one that could be submitted to a newspaper as being "ready to use". A minimum passing mark will be assigned to a group that submits a neat hand written listing of the information required.

Content

Two (2) marks for each section for a total of 28.

On time marks

If the assignment is handed in completed by the EARLY completion date the group will receive 5 marks. If a group hands in the assignment on the ON TIME completion date (any time during class) 0 marks will be assigned. After the ON TIME completion date assignments will be considered late (see LATE completion date) and 10% per day will be deducted from the total mark.

EARLY completion date: _______________

ON TIME completion date: _______________

LATE completion date: after class on ___________

Marks assigned

Form ____/12

Content ____/28

On time ____/05

TOTAL ____/40

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 135

Ergonomics

What is Ergonomics?

The inter-disciplinary science of ergonomics explores human capabilities and limitations and uses this knowledge to improve the design of things that people use and the ways in which they work. Contributing disciplines include psychology, industrial engineering, computer science, biomechanics, safety engineering and a host of others.

Data and methods developed by the ergonomics profession are widely used to improve such things as office equipment and systems, technology for assisting disabled individuals, power plant control rooms, spacecraft, educational and training materials, medical devices, and consumer products.

Is Ergonomics a 'Real' Scientific Discipline?

Yes. Ergonomics is a globally recognized science with a body of validated research findings and practices, and a worldwide community of scholars. The International Ergonomics Association, a federation of national ergonomics societies, has 29 member organizations, representing 16,000 ergonomists worldwide. In the United States, the profession publishes in numerous peer-reviewed journals including the quarterly journal, Human Factors, which began publication in 1957. There are more than 75 graduate and undergraduate ergonomics programs in accredited universities in the U.S. and Canada.

How Did Ergonomics Get Started?

In the United States, ergonomics -- also known as human factors engineering -- became a real concern during World War II for improving the performance and safety of military systems such as aircraft, naval ships, and large-scale weapons. Based on work conducted by early researchers, designers began to recognize the importance of reflecting the characteristics of the operator in the equipment they designed. Post-war research expanded into the commercial sector to include space systems, consumer products, industrial and office settings, and computer systems.

In Europe, ergonomics began with an emphasis on human productivity and work physiology. As the discipline matured, other fundamental objectives were recognized, such as the provision of safer and healthier working environments and the improvement of the quality of life. Today, the global ergonomics community is equally concerned with improving the design of products and systems, and with improving conditions in industrial and office workplaces.

How is Ergonomics Used?

In military acquisition, ergonomic principles are usually included in system specifications. In the civilian sector, companies adopt ergonomic principles to reduce the incidence of costly accidents in their facilities, or to make their products more marketable as user-friendly. In some cases, government or industry guidelines or voluntary, consensus-based standards may be appropriate.

Is Ergonomics Expensive?

No. Ergonomics is a cost-effective means of product enhancement. Ergonomics applications-based on solid research findings-not only improve the workplace, but make products and processes more competitive in the world market. The result is an improved bottom line for business, whether by decreased worker compensation and health care costs, or by increased marketability of products.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 136

Here are a few examples from the workplace:

Incorporating Ergonomics Into the Manufacturing Process. Beginning in 1979, John Deere and Company, the largest manufacturer of agricultural equipment in North America, began using ergonomics principles to redesign and reduce physical stresses on the job. Employees were extensively involved. Since 1979, Deere has seen an 83% reduction in employee back injuries and within five years, worker compensation costs were cut by 32%.

Preventing Injuries Reduces Costs. AT&T Global Information Solutions in San Diego, California, a manufacturer of mainframe computers, analyzed its injury logs and identified its three most frequent types of injuries: lifting, fastening, and keyboarding. By making workstation improvements and providing proper lift training for all employees, the company s worker compensation costs dropped by 75% in the first year.

In a second round of changes, the company moved from conveyor systems to individual scissor-lift platforms and shifted from an assembly line process to allowing each worker to build an entire computer cabinet. These changes allowed workers to readily shift from a standing to sitting position. All told, the company s ergonomic changes enabled it to go from 298 work days lost from injury in 1990, to zero days lost to injury in l993 and 1994. This translates into worker compensation cost savings of $1.48 million over the period.

Faster Directory Assistance. The computer displays used by directory assistants at Ameritech, a regional telephone company, were ergonomically redesigned for easier viewing. The new displays enabled operators to answer calls more easily and reduced the time of each call. This change saved the company nearly $3 million a year across its five-state region.

Redesigning Equipment. Use of butcher knives for de-boning at a poultry processing plant was proving both inefficient and leading to extensive worker compensation premium increases. By introducing an ergonomically designed poultry de-boning knife, not only were worker injuries greatly reduced at the processing plant -- saving $500,000 in worker compensation premiums -- but also profits increased from more efficient de-boning.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 137

How to sit at a computer

A diagram giving essential ergonomic advice for comfortable, safe posture:

A. Adjustable back support to support the small of the backB. Arm rests are optionalC. Thighs not compressedD. Adjustable seat height to suit operatorE. Swivel chair with stable base. Castors are not recommended on smooth, hard (floors). Profile at base

as low as possibleF. Viewing distance same for screen, source document and keyboardG. Optimum viewing angle is 38° below horizontalH. Screen positionI. Source document holderJ. Accessible work surface (Keyboard 30 mm thick, home key row)K. Sufficient thigh clearance under deskL. Cords Kept out of wayM. Height to home key row adjustable to suit operatorN. Leg clearanceO. Foot rest may be require for some operators especially where desk height is not adjustableP. Adequate knee and foot clearance

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 138

A

B

C

D

E

F

G

K

H

I

J

L

MN

O

P

Office Ergonomics Checklist

1. Posture - Activity - Exercise

Maintain proper posture, paying careful attention to positioning of head, neck/spine, arms/wrists, hips/thighs and feet. Basically, ensure the small of your back is supported, your shoulders relaxed (not slumped, not elevated), and that there is no pressure under your thighs.

Alternate between different postures on a regular basis. When keyboarding, use minimum force while striking the keys.

Keep a neutral position, where the forearms, wrists and hands are in a straight line.

Avoid awkward reaching for work tools such as telephone, mouse and reference materials.

Avoid resting elbows, forearms or wrists on hard surfaces or sharp edges.

Take frequent mini-breaks throughout the day to give muscles and joints a chance to rest and recover.

Alternate between work activities that use different muscle groups to avoid overuse.

Give eyes a break by closing them momentarily, gazing at a distant object and blinking frequently.

Proper exercises are a complement to a complete office ergonomics program.

2. Lighting - Air - Noise

Maintain appropriate light levels for specific tasks. More illumination is usually needed to read a document than a computer screen.

Reduce or eliminate glare by using window shades, diffusers on overhead lighting and anti-glare filters for computers.

Adjust the contrast and brightness on your computer screen to a comfortable level.

Get a regular eye exam and if necessary, wear corrective lenses. Tell your eye specialist how often you use the computer.

Clean the computer screen and other surfaces regularly.

Reduce the number of dust collecting items like papers and files on your desk.

If necessary, use a portable air cleaner to reduce airborne particles like dust, pollen and mold.

Maintain a comfortable temperature by using layers of clothing or a portable fan or heater.

Be considerate to others working in the area and conduct meetings and conversations in appropriate areas.

Position fabric partitions to reduce noise from conversations, foot traffic and equipment, like copiers and printers.

Identify distracting noises and try headphones, earplugs, soft music or a quiet fan to reduce or mask the noise.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 139

3. Work Style - Organization - Breaks

Reduce stress by planning ahead and setting realistic expectations for what you can accomplish during the workday.

Organize your workload to help even out busy and slow times, to avoid feeling "swamped".

Vary tasks to make the day more interesting. For example, deliver a message in person instead of phoning. Avoid long periods of repetitive activity. For example, alternate computer work with other tasks like phone calls, filing, copying and meetings. Organize equipment, supplies and furniture in the most efficient arrangement for daily tasks.

Enhance privacy by using office partitions and privacy filters for computer screens or documents.

Develop stress reduction and relaxation techniques that work for you at the office and at home.

Take mini-breaks that re-energize, invigorate and refresh.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 140

Ergonomics at school

What follows is part of an ergonomics program developed for the parents of school children, from the needs identified by a project with Blackwell Elementary School in Redmond, Washington. The guidelines have been developed by Diane Tien and her class at this school.

Risks Of Keyboarding

People are always being told all about how typing for long periods of time is bad for you, but have you ever wondered what really happens and if there is a real cause for alarm? Well, unfortunately, there is!

Poor typing posture can cause pain and other symptoms in your:

Back Neck and shoulders Hands and wrists Eyes

Back Pain

The lifetime prevalence of low back pain has been estimated at nearly 70% for industrialized countries (Andersson, 1991), and much of this is related to poor posture while sitting. Back pain is certainly not limited to adults. In fact, it has been reported that approximately 23% of elementary school children complain of backache and that this percentage rises to about 33% among the secondary school population (Mierau, 1984, cited in Marschall, Harrington, and Steele, 1995).

Two European studies even found that as many as 60% of schoolchildren experience back problems by the ages of 15 or 16 (Balague, 1988 and Davoine, 1991, both cited in Mandal, 1997). A study of 500 US teenagers found that 56% of the males and 30% of the females suffered from degeneration of the spine as supported by X-ray evidence (Fish, 1984, cited in Knight and Noyes, 1999).

Hand/Wrist Problems

These include Cumulative Trauma Disorders, better known as CTDs, RSIs (Repetitive Stress Injuries), OODs (Occupational Overuse Disorders), etc. Since the late 1980s, the incidence of CTDs has skyrocketed, especially among those performing computer intensive work. The number of repeated trauma cases increased steadily from 23,800 in 1972 to 332,000 in 1994 a 14-fold increase (Bureau of Labor Statistics, 1995).

Although there are few statistics on children and CTDs, with so many children starting to use computers at such an early age, there is no telling whether this may accelerate the incidence of CTDs.

Since the average American child is currently spending one to three hours daily in front of a computer (Roper Starch, 1999), there is a great potential for injury.

In their milder forms, CTDs may involve injury to the tendons and their sheaths within the hand and wrist area, which may cause:

Discomfort Tenderness to touch Inflammation Weakening of the tendons

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 141

The more serious CTDs may lead to the following symptoms in the hands, fingers, and arms:

Pain Numbness Tingling Loss of sensation

Carpal Tunnel Syndrome (CTS)

It is one of the most serious and best known CTDs. It results when the median nerve does not "work" properly. Usually, this is thought to occur because there is too much pressure on the nerve as it runs into the wrist through an opening called the carpal tunnel.

Eventually, the pressure inside the tunnel reaches a point when the nerve can no longer function normally. Pain and numbness in the hand begin and progress if the cause is not eliminated.

Repeated forceful movements made by the hands while in deviated postures (flexion, extension, ulnar radiation, and radial radiation) are known to dramatically increase the risks of developing this syndrome. Ulnar and radial deviation contribute to CTDs, but it is flexion and, particularly, extension that are the real culprits.

Remember that when the wrist is in a neutral position, the carpal tunnel is as big as it can be so the nerve has as much room as possible and injury can be prevented.

Preventing Injury

When it comes to preventing injury, adults and children need to primarily:

Keep their body and wrist posture in neutral positions while sitting and keyboarding.

Have an appropriate workstation configuration.

Take breaks at appropriate intervals.

Neutral Keyboarding Posture

Upper and lower back well supported by chair

Chair height set so that the chair seat does not compress the back of the knees Feet firmly planted on a surface for support (floor or footrest)

Head balanced on neck (not tilted back or too far forward)

Upper arms close to body and relaxed (not abducted to the side or flexed forward)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 142

Sitting so that the:

Angle formed by the shoulders, hips, and knees is >90 degrees

Angle formed by the shoulder, elbow, and wrist is >90 degrees

Angle formed by the hips, knees, and feet is >90 degrees

Wrists at a neutral position, level with forearm (<15 degrees deviation)

Chair armrests not directly compressing any part of the forearms or elbows

Moving a mouse with your forearm and not just your wrist (will reduce hand deviation)

Ideal Computer Workstation

Many people spend thousands and thousands of dollars on their computers, software, and games and then completely disregard the workstation where they sit day in and day out. But that would be like buying a Ferrari and then buying the cheapest tires possible! It just will not work in the long run and it’s the person who is going to end up hurting, literally.

1. Furniture and Equipment

Stable work surface. One that is adjustable in height may be good to have when adults and very young children are sharing the same workstation.

Comfortable, ergonomic, adjustable chair with at least chair height and back support adjustment mechanisms. If the back tension of the chair does not adjust, make sure that the lower back is firmly supported. Armrests that pivot and are height and width adjustable are also a good idea. Remember that while most adjustable features are not absolutely essential, they do assure that many people of different sizes will feel comfortable in the chair.

Height-adjustable, negative slope keyboard tray is best for keeping the elbows at a >90 degrees and for allowing the wrists to remain in a neutral position.

NOTE:

Desktop keyboards and those placed on conventional, articulating keyboard trays (those on a positive slope) do not fully allow the elbows and wrists to remain in neutral posture and actually encourage wrist extension.

Height-adjustable, gliding mouse platform that allows the mouse to be positioned close to the side of the body, above the keyboard tray (so that the arm does not have to reach to the side).

It does not matter exactly what type of keyboard and pointing device you use as long as whatever you use feels comfortable, fits your hands, and allows you to work in a neutral hand and body posture.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 143

2. Normal Work Area

The normal work area corresponds to the space and objects that can be reached by a person while sitting in front of a computer, without having to twist the body or reach far. Make sure that everything you need is within this area, including books, documents, tools, a telephone, etc.

Be sure that the desk has a surface large enough to support all of your materials, even the ones that you are not currently using.

If typing from a book or document, make sure that it is placed in a document holder that is placed near the screen, in order to avoid head twisting.

The body should be centered on the alphanumeric part of the keyboard. Most keyboards are asymmetrical in design (the alphanumeric keyboard is to the left and a numeric keypad to the right). If the outer edges of the keyboard are used as landmarks for centering the keyboard and monitor, the user’s hands will be deviated because the alphanumeric keys will be to the left of the user's midline.

3. Computer Monitor Position

Monitor that is height and angle adjustable works best.

Monitor should be placed directly in front of the user and facing the user, not angled to the left or right (to discourage neck twisting).

Your eyes should be in line with a point on the screen that is 2 to 3 inches below the top of the monitor. If the monitor is above or below this height, your neck will be raised or lowered and the result will be neck pain.

Monitor should be at a comfortable distance for viewing, which is usually around an arm’s length (sit back, raise your arm, and your fingers should touch the screen).

If text on the screen is too small, increase the font size - do not move monitor closer.

Users with bifocal glasses should tilt their monitors slightly backwards.

4. Lighting

It should not be too bright or too dark. Always use light even though a computer screen is self-illuminating. There should not be a large contrast between the screen and the area surrounding it.

Indirect lighting (that which illuminates the walls and ceilings), in combination with a task light, works best.

If you do use a task light, position it as far away as possible - make sure that you cannot see the light source when you look at the screen.

There should be no glare falling on the screen. If there is, reposition the workstation with regard to the light sources (natural or artificial). Be careful not to just move the monitor, resulting in a poor viewing angle. If repositioning alone does not work, use a good quality glass anti-glare screen. If left uncorrected, glare will cause discomfort, eyestrain, and headaches.

Avoid very glossy work surfaces and furnishings, such as mirrors and shiny metal, which will contribute to glare.

5. Noise and Ventilation

Work in an environment with a level of noise that is comfortable for you. Working in an uncomfortably loud environment stresses the body and, as a result, the muscles tense up. This tension accelerates injury.

If using headphones, make sure they are at a comfortable noise (sound should not “leak” – that is, it must not be heard by others around you) level and that they fit properly.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 144

Workstation should be located in a well -ventilated area, with adequate heating and cooling in order to minimize discomfort.

Taking Breaks Is Important!

The risk of problems associated with computer use depends more on the amount of time that one spends keyboarding without taking a break in one single session than on the total number of keyboarding sessions.

You can regulate your own computer usage and that of your child(ren) in the following ways. Just remember that breaks and exercises need to be combined with good workstation set-up and/or posture for them to be of most help!

Eye Breaks: Looking at a computer screen for a while causes some changes in how the eyes work, causes you to blink less often, and exposes more of the eye surface to the air. Every 15 minutes you should briefly look away from the screen for a minute or two to a more distant scene, preferably something more that 20 feet away. This lets the muscles inside the eye relax. Also, blink your eyes rapidly for a few seconds. This refreshes the tear film and clears dust form the eye surface.

Micro-breaks: Most typing is done in bursts rather than continuously. Between these bursts of activity you should rest your hands in a relaxed, flat, straight posture.

Rest Breaks: Every 30 to 60 minutes you should take a brief rest break. During this break stand up, move around, and do something else. Go get a drink of water, soda, tea, coffee, or whatever. This allows you to rest and exercise different muscles and you'll feel less tired.

Ergonomic Software: Working at a computer can be hypnotic, and often you don't realize how long you've been working and how much you've been typing and mousing. Look for software that will run in the background and monitor how much you've been using the computer. It will prompt you to take a rest break at appropriate intervals, and it will suggest simple exercises.

Exercise Breaks: There are many quick stretching and gentle exercises that you can do to help relieve muscle fatigue. These should be done every 1-2 hours, depending on your needs.

Workstation Exercises (to be done at least once an hour)

1. Deep Breathing: Breathe in slowly through the nose. Hold for 2 seconds, and then exhale through the mouth. Repeat several times.

2. Head and Neck: Turn head slowly from one side to the other, holding each turn for 3 seconds. Repeat

several times. 3. Back: Start with the arms bent, hands near chest area, and push elbows back. Hold for 5 seconds, and

then relax. Repeat several times. You can also raise arms in the same fashion, this time close to the shoulders, to work out the upper back.

4. Shoulders: Roll shoulders slowly in a circular fashion, while trying to make the circle as big as possible.

Take about 5 seconds to complete one circle. Repeat several times.

5. Wrists: Hold your hands out in front of you. Slowly raise and lower your hands to stretch the muscles in the forearm. Repeat several times.

6. Fingers and Hands: Make a tight fist. Hold for a second. Then spread your fingers apart as far as you

can. Hold for 5 seconds, and then relax. Repeat several times.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 145

7. Tendon Gliding Exercises: These relieve tension in the tendons. Do each of the following movements slowly, but do not force any of the positions. Go as far as you comfortably can.

a) Starting Position: Raise your arm, with the hand extended (you can also rest the elbow on a table and extend the hand).

b) Roof: Bend your fingers down to a right angle. Return to starting position.

c) Straight Fist: Touch your fingertips to the base of your palm, keeping the thumb straight. Return to starting position.

d) Hook Fist: Gently make a hook. Return to the starting position.

e) Full Fist: Make a fist. Return to the starting position.

In addition to these exercises, do some gentle stretching or stand up and move around during these brief pauses.

What if you don’t have the “Ideal Workstation”?

Although proper equipment is important in minimizing your risk for injury, it may not be possible to go out and buy all the components for an ideal workstation. There are still many inexpensive things you can do to improve your current workstation.

Some of the following are also some things you can do to improve existing workstations that are not your own (such as in a library).

Decide which workstation features need to function best for your own needs and those of others who will be using the workstation. For example, if you know that your computer will primarily be used for word processing, make sure that you have a good keyboard setup. If it will be used primarily for web surfing, make sure that you have a good mouse/pointing device configuration.

Also, make a list of factors in terms of your present physical condition. For example, if your right wrist tends to throb after 2 hours of inputting data into a spreadsheet, then try to obtain the best keyboard/mouse setup as soon as possible.

If you use a desktop keyboard or one that is placed on a conventional, articulating tray, position the keyboard/tray at the most negative slope possible. You can tilt the keyboard tray away from you or place a book/wrist rest that is not too thick under the bottom area of the desktop keyboard in order to lift it. In the case of a desktop keyboard, you can also use a broad, flat wrist rest as a forearm support. The wrist rest should be approximately the same thickness as the bottom of your keyboard. Place the wrist rest midway between your wrists and elbow, but make sure that you are not compressing the area.

If you don’t have a mouse tray, at least make sure that the mouse is close to the side of your body, so that that your upper arm can remain relaxed and your posture can remain as neutral as possible.

Wrist rests should generally not be used as actual resting places for your wrists. This is because wrist rests, especially the very soft, cushioned kind, actually contour to the wrists and encourage wrist-twisting movements.

Never use the “legs” that many keyboards have attached to the upper part of their bottom surface. Doing so would place the keyboard at a positive slope, which should be avoided.

If you don’t have an adjustable chair, you can still try to accommodate people of various sizes by using a back and/or seat cushion. You can also use a footrest (or a makeshift footrest, such as a pile of books or a box) for a

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 146

child or a person of small stature. Just make sure that the feet are supported and the area behind the knees is not compressed.

Laptops And Their Inherent “Un-Ergonomics”

Although laptops are certainly a great invention, there is no way that they will be ergonomic (in their present design) without a little help from you.

It usually turns out that when the screen is at a comfortable height and distance, the keyboard isn’t and vice versa. The best way to avoid discomfort here is to place the keyboard at a comfortable distance and enlarge the font, which you can always reduce later.

If you use your laptop for more than one hour at a time, consider obtaining an external keyboard and/or monitor.

The fact that a pointing device on a laptop is almost always located in the middle may not allow you to keep your arm at a neutral position while using it. Consider purchasing a mouse or any other external pointing device.

As in the case of a desktop keyboard, you may use a wrist rest to support your forearms while typing on the laptop keyboard.

Avoid using your laptop on a high surface. This will cause you to abduct your shoulders and lead to shoulder and back pain.

Ergonomic Devices: Are They Worth It?

These days just about everything is labeled as being "ergonomically designed" and much of the time this is not true. Unfortunately, right now there is relatively no regulation of the term “ergonomic.” Some so-called “ergonomic” products can even make things worse!

If you're thinking about buying an "ergonomic” product ask yourself the following four questions:

1. Does the product design and the manufacturer's claims make sense?

2. What research evidence can the manufacturer provide to support their claims? Be suspicious of products that haven't been studied by researchers.

3. Does it feel comfortable to use the product for a long period? Some ergonomic products may feel strange or slightly uncomfortable at first because they often produce a change in your posture that's beneficial in the long-term. Think of some products as being like new shoes that initially may feel strange but then feel comfortable after being used for a while. If a product continues to feel uncomfortable after a reasonable trial period (say at least a week), then stop using it.

4. What do ergonomics experts say about the product? If they don't recommend it, don't use it.

The Real Truth About The Most Popular Ergonomic Products

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 147

Ergonomic chairs: As long as the chair has at least height and back adjustment features, it will be worth your while. These chairs can range in price from a hundred dollars or less to more than a thousand dollars, and generally the more expensive ones have more adjustment features and better construction. The greater a chair’s adjustment capabilities, the greater the number of people that will be able to sit on it comfortably.

Armrests: The best armrests will allow you to rest the area of your forearm that lies halfway between your wrist and elbow, without compressing any part of the arm. Look for those with at least height and width adjustment features. Research studies have shown that armrests provide many benefits, such as:

Reduced postural strain to the upper body Reduced muscle loads in the upper arms, shoulders, and neck Reduced loads on the spine (by redistributing the weight of your upper body) Reduced forearm exhaustion while typing (when your forearm gets tired, you tend to increase wrist extension)

Reduced key forces while typing (the amount of force with which you hit the keys plays a role in CTD development)

Keyboards: Most ergonomic keyboards on the market today are split keyboards (those where the alphanumeric keys are split at an angle). These keyboards mainly address the problem of wrist ulnar deviation (side-to-side). However, wrist extension and flexion (vertical movement) are more important when preventing injury. There is no consistent research that shows that split keyboards offer any postural benefits-, and for most people a regular keyboard design works just fine if it's placed in the proper neutral position. Some people find split keyboards to be more comfortable than traditional keyboards, so if you use one, make sure that it is not causing your shoulders to abduct (raised higher than is comfortable).

Keyboard Trays: Height-adjustable, negative slope keyboard trays (those that height adjust down to your lap and allow you to tilt them away from your body) function best because they allow the body and hands to maintain the most neutral working position (see section on Neutral Keyboarding Posture). In order to be in the proper position, you should almost feel as if your keyboard is placed on your lap. Pointing Devices: There is no conclusive research that says that one type of pointing device (mouse, trackball, stylus, touch pad, joystick, etc.) is better for you than another. Just make sure that when you use whichever one you choose, you are using it in a neutral position (arm relaxed, close to your body). A pointing device should also fit the hand of its user. Don’t use a very large mouse if you have very small hands. In the same token, young children often prefer trackballs because the traditional mouse design is sometimes too big for their small hands.

Mouses: The mouse is the most popular type of pointing device and there are many types of “ergonomic” mouses out there. Before you purchase a mouse, place your hand over it. If it causes your wrist to extend up too much, then it’s not really “ergonomic.” One recent study showed that one particular mouse design, which is flatter and broader than a traditional mouse, can reduce side-to-side wrist deviation.

Wrist rests: Research studies haven't demonstrated any substantial benefits for wrist rests. Some people may actually experience increased pressure in the wrist area just from using one. If you do choose to use a wrist rest, a broad, flat surface design works best. Many keyboards come with an attached or built-in plastic wrist rest, which works well if it is broad and flat. Avoid soft and squishy wrist rests (gel-filled) because these will contour to your wrist and encourage wrist-twisting movements - your hands should be able to glide over the surface of a wrist rest during typing. Using a wrist rest as forearm support can be comfortable and effective.

Glare Screens: Glare screens can only reduce glare. A lot of people think that they can reduce or eliminate magnetic fields. This is simply not true, no matter what the packaging says. Any jargon on the packaging about “fields” usually refers to static electricity. Usually it is the higher quality glare screens that are worth getting. The lesser quality ones may reduce glare but may also accumulate a lot of dust, thereby obscuring the image. And remember that you may not even need a glare screen if you position your monitor in a way that does not encourage glare.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 148

Support Braces/Gloves: There is no consistent research evidence that wearing wrist supports during computer use actually helps reduce the risk of injury. If you do like wearing a wrist support, make sure that it keeps your hand flat and straight, not bent upwards. There is some evidence that wearing wrist supports at night in bed can help relieve symptoms for those with Carpal Tunnel Syndrome.

Sources

www.apa.org/ppo/ergofact.html

www.ergonomics.com.au/howtosit.html

http://ergo.human.cornell.edu/Mbergo/schoolguide.html

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 149

Ergonomics exercises

All answers are to be in sentence form unless stated otherwise.

Page 1

1. Using your own words, explain the meaning of the term "ergonomics".[4 marks]

2. What other disciplines (or areas) contribute to ergonomics?[2 marks]

3. In a paragraph, give five things that the data (information) gathered from and methods developed through ergonomics, are used to improve.[5 marks]

4. When did the study of ergonomics begin?[1 mark]

5. Why did the study of ergonomics start?[2 marks]

6. Into which areas did ergonomics expand following the Second World War?[2 marks]

7. What are the two major concerns of the "global ergonomics community" today?[2 marks]

8. Why are ergonomics principles adopted in the civilian sector?[2 marks]

Page 2

9. From the page of "examples in the workplace" choose one organization or company as an example and using a paragraph answer the following questions:

a) What is the name of the company?[1 mark]

b) What service does the company provide or what do they produce? [1 mark]

c) What did the company do to improve their workplace ergonomically?[2 marks]

d) What was the result of these changes?[2 marks]

Office Ergonomics checklist10. From the section “1. Posture - Activity - Exercise", describe five things that you can do when using a computer to work better ergonomically in a classroom.[5 marks]

11. From the sections "2. Lighting - Air – Noise” and, “3. Work Style - Organization - Breaks", list five things that you can do, in addition to those that you mentioned in question 1., when using a computer to work better ergonomically at home or in the classroom.[5 marks]

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 150

Ergonomics at school

12. What are the four areas that can be affected by poor typing posture?[2 marks]

13. What is the percentage of prevalence of back pain in industrialized countries?[1 mark]

14. What percentage of secondary school students complain of backaches?[1 mark]

15. What is the maximum percentage of 15 or 16 year olds that experience back problems?[1 mark]

16. What do the letters CTD stand for?[1 mark]

17. What is the number of hand/wrist trauma problems reported in 1994 by the Bureau of Labor Statistics?[1 mark]

18. What problems can be caused by mild forms of CTD that may involve injury to the tendons and their sheaths within the wrist area?[4 marks]

19. What symptoms may be caused by more serious CTDs?[4 marks]

20. What types of movements are known to dramatically increase the risks of Carpal Tunnel Syndrome?[2 marks]

21. What are the three primary ways of preventing injury?[3 marks]

22. What is meant by "a neutral keyboarding posture"?[2 marks]

23. Write a short paragraph describing the characteristics that the following should have to help improve the ergonomics of a workstation.

a) Work surface[2 marks]

b) Chair[2 marks]

c) Keyboard tray[2 marks]

24. What is the most important characteristic of the keyboard or the pointing device?[2 marks]

25. How should the monitor be positioned for the user?[2 marks]

26. What is the best type of lighting to be used for computer work?[2 marks]

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 151

27. Which of the following increases the risk of problems associated with computer use - the number of times that you use the computer or how long you use the computer in a session?[2 marks]

28. How often should you look away from the computer screen? Where should you look?[2 marks]

29. What should you do between bursts of typing activity?[1 mark]

30. How often should a rest break be taken?[1 mark]

31. Give three examples of Workstation exercises.[6 marks]

32. How often should the Workstation exercises be performed?[1 mark]

33. What two general factors should be considered when trying to minimize the risk of injury using a workstation?[2 marks]

34. Why should wrist rests and keyboard "legs" not be used?[2 marks]

35. Give four ways that laptops can be made better ergonomically.[4 marks]

36. Give four general guidelines to be following when considering the purchase of "ergonomic" products.[4 marks]

37. In a paragraph, name three groups of ergonomic products and describe what characteristics of these products make them ergonomically effective.[9 marks]

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 152

Ergonomics and Computers

The following are some useful websites containing information on: ergonomics in general and ergonomics related to computer use.

www.apa.org/ppo/ergofact.html

www.ergonomics.com.au/howtosit.htm

http://ergo.human.cornell.edu/Mbergo/schoolguide.html

Other sites with useful information

www.me.berkeley.edu/ergo/tips/tips.html

www.office-ergo.com

www.safetyoffice.uwaterloo.ca/hspm/documents/office_ergo/ergo/vdt.html

(Note that some of these sites may no longer be active!)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 153

Boolean Logic Problems

Compound Expressions

One way of finding the output of compound Boolean expressions (where there are combinations of gates) is by using a truth table.

Example:

What is the output of the following Boolean expression?

To find the output of this expression, we set up a table that has all the input values in the left-hand column.

0 00 11 01 1

In columns to the right, we fill in the expressions that are included in the expression starting with any "NOT" values of the input. These are followed by any expressions in brackets. The last column is the whole expression.

0 0 1 0 0 00 1 0 1 0 01 0 1 1 1 11 1 0 1 0 0

The values in columns are used to find values in other columns to the right (we are finding the values inside the brackets first and then using these values to find the result of the whole expression).

Assignment

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 154

1. Find the output of the following expressions using truth tables (show all steps as in the example) a) b) c)

2. Prove, by using truth tables that the following equations are true (the expressions on each side of the equation are equal).

a)

b)

3. Are the following expressions equal? Use truth tables to support your answer.

?

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 155

The History of Computers

Date Due: _____________

The following list of names represents some of the many people who have contributed to the development of computers.

(Please note that these names are not necessarily in chronological (time sequence) order!)

1. Hollerith, Herman 11. Thomson, William2. Pascal, Blaise 12. Babbage, Charles 3. Aiken, Howard 13. Napier, John4. Hopper, Grace 14. Hoff, Ted5. Gates, William 15. Zuse, Konrad6. Jacquard, Joseph Marie 16. Boole, George7. Byron, Augusta Ada 17. Mauchly, John and Eckert, J. P.8. Shockley, William 18. Watson, Tom (Jr.)9. Wozniak, Steve and 20. Eckert, J. Presper Jobs, Steve 21. Fleming, Sir John Ambrose10. Noyce, Robert 22. Wilkes, Maurice

23. Von Neuman, John

The names of your partner(s) ______________________

______________________

The number, the last (or family) name and the first name of the person that you are to investigate:

number:_______

last name: __________________

first name:__________________

Please see the next page for more details!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 156

The History of Computers

a) Find the contribution (if there is more than one, choose the contribution that had an effect on succeeding developments) of the person to the history of computing.

b) Give the date (or the time period) when this contribution took place.

c) Give the importance of this contribution to modern computing.

d) Give some personal details about the life of this person that may have influenced their work and led to their contribution to the history of computing.

e) A bibliography must be included at the end of the essay on a separate page. The following information must be given about each reference work used to find information about the person:

Author (or editor) of the work Title Publisher Publishing date Place of publishing

f) References – two print references must be used before an Internet resource may be used.

For further information on bibliographies, see the librarians.

All writing must be in the correct form (e.g. paragraphs must be indented, a blank line must be in-between each paragraph, titles must be centered and underlined, name of author(s) must be at the underneath the title) and be checked for spelling and grammar.

NOTES:i) All writing is to be done using Microsoft Works.ii) Your document should be at least one page but not more than two pages.

Marks: Form _____ /15

Content _____ /25

Spelling _____ /10

Total _____ /50

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 157

History of technology and ComputersResearch Assignment

The following list of names represents some of the many people who have contributed to the development of computers. All names are given with the last (or family) name first, followed by the first name. Please note that these names are not necessarily in chronological order!

1. Hollerith, Herman 2. Pascal, Blaise 3. Aiken, Howard

4. Hopper, Grace 5. Gates, William 6. Jaquard, Joseph M.

7. Byron, Augusta Ada 8. Shockley, William9. Wozniak, Stephen

10. Jobs, Steven 11. Thomson,William 12. Babbage, Charles

13. Napier, John 14. Hoff, Ted 15. Zuse, Konrad

16. Boole, George 17. Mauchly, John and Eckert, J. P.

18. Watson, Tom (Jr.)

The number of the person I am to investigate: ________________

The last or family name of this person: ________________

The first name or initials of this person: ________________

a) Find the contribution, of the person that you have been assigned, to the history of computing or technology. If there is more than one contribution, choose one that you believe had the greatest effect on succeeding developments.

b) Give the date that this contribution took place. If the exact date is not known, then give the time period during which this contribution took place.

c) Give the importance of this contribution to modern computing.

d) Give personal details about the person such as where they lived, whom they worked for and any other information that you found interesting.

e) Include, at the end of your paper, bibliographical information about the references that you used to obtain this information. At least TWO sources of information must be used. Only one of these sources may be an Internet site.

Marks:

a) ____/6 b) ____/2 c) ____/5 d) ____/3 e) ____/4

Total: _____/ 20

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 158

Computer and Information Science

Final Project/Presentation

Produce a study guide

A study guide is a summary of particular information. This study guide is designed to be a summary of a part of the TIK course.

To be completed:

a) The study guide must include a written summary that can be distributed to the other students in the class. This written summary must be in sentence form and approximately 900 words. Spelling and grammar mistakes will result in up to 10% (each) of the mark being deducted. The summary can be neatly handwritten or typed. If a handwritten piece of work is not legible, it will be returned for rewriting and it will not be evaluated until it is legible.

b) A presentation – this can be in one or more of the following forms:

- an oral presentation of between 5 and 10 minutes- a poster

The written summary must contain an overview of the information in part a).

No more than two students may work together on this assignment.

All students must complete both parts of the assignment in order to obtain a mark.

MARKS:

Part a

Part b

Due date:

No marks assigned after:

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 159

Topics1. Safety

- health problems related to the use of computers

2. Problem solvinga) The following as a model for:

- input- processing- output

b) Writing algorithms- for mathematical problems- for everyday situations

3. Computer Science Theorya) components of a computer

- control unit - arithmetic logic unit - input - output - memoryb) inter-relationship of componentsc) definition of hardware

- basic internal components of a computer (motherboard, processor, buses, CPU, hard disk drive, floppy disk drive)

- peripherals (such as: monitor, keyboard, mouse, joystick, etc.) and their function

- practical function of hardware -components

4. Networks

a) definition of a networkb) purpose of a networkc) types of networks

- Wide Area Networks versus - Local Area Networks (including an introduction to the Internet and the World

Wide Web)

5. The concept of a programa) as related to everyday lifeb) as related to computers

6. Softwarea) definitionb) examples

7. General types of programs

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 160

a) Programs used by people- Application programs- Programming languages- Operating systems

b) Programs used by computers- Operating systems- Compilers- BIOS

8. Programming

a) Programming languages- levels of programming languages- the evolution of programming languages

b) Definition of a structured programc) Simple programming commands

- output commands1. mathematical operators2. formatting of output

- input commandsd) Programming structures

- Sequences of commands - Repetition

1. the purpose and the function of counted loops2. using integer and character type loop control variables3. nested loops (two level)

- Selection 1. logical operators

2. the purpose and the function of selection statementse) Types of programming errors

- logical- syntax- run-time

f) Tracing variablesg) Writing algorithms

- for mathematical problems- for everyday situations- for programs

1. code to English2. English to code

9. Application programs a) Definitionb) Types

i) definitionsii) description and definition of the characteristicsiii) Uses of application programs

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 161

10. Impact of microelectronic technology on societya) Uses of computersb) Computer securityc) Computers in the workplaced) Health concerns related to the use of computers

11. Computer Careersa) Variety available in the fields of computer science and information processingb) Aptitudes and skills requiredc) Educational paths

12. The history of information technologya) The evolution of the microcomputer.b) Important people and events in the development of computer related technology.d) The evolution of technology as related to Computersc) Possible future developments

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 162

History of ComputersSome important people and events

Compiled by G. Kavanagh (revised 2008)

Date Person Contribution

1614 John Napier Invented logarithms and shortly after Napier's rods or bones. These were multiplication tables on four sided wooden rods which allowed the user easily to find the product of numbers.

1623 Wilhelm Schickard Invented the first mechanical calculator of modern times. A theologian and scholar of languages as well as scientist.

1642 Blaise Pascal Invented a mechanical adding machine. This was a small metal box containing interlocking gears. Adding and subtracting were performed by turning numbered dials on the outside of the box.

1666 Gottfried Wilhelm Created a system for von Leibniz reducing reasoning to a combination of elements. This is considered the beginning of modern logic.

1672 Gottfried Wilhelm Worked on machine, the von Leibniz Stepped Reckoner (completed 1674) whose operating principles led to the development of the first successful mechanical calculator (see Mathieus Hahn).

1714 Henry Mill Patented the first typewriter. Mill was a British engineer.

1770 Mathieus Hahn Built a cylindrical calculator based on Leibniz's design. Hahn's calculator worked better than Leibniz's. This machine could have been mass-produced.

1801 Joseph M. Jacquard Used punched cards to control weaving looms. Using the instructions on these cards, complicated designs could be produced. This development resulted in the displacement of many workers.

1834 Charles Babbage Designed a mechanical computer (the Difference Engine) that could not be built because the technology of the time was not advanced enough.

1835 Augusta Ada Byron Also known by her title, Countess of (or Lady) Lovelace. An amateur mathematician and friend of Babbage. She wrote an article about Babbage's Difference Engine detailing how it could be programmed.

1854 George Boole Developed the rules of logic. ("Boolean Algebra").

1866 William Thomson Lord Kelvin, knighted for his work studying the capacity of cable to carry electric current. Also developed improvements in the transatlantic telegraph cable.

1868 Christopher Soles Patented the first “modern” typewriter.

1872 Christopher Soles Created the QWERTY keyboard.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 163

1890 Herman Hollerith Used punched cards in a mechanical computer to tabulate census information.

1914 Thomas Watson (SR) Becomes head of the Computing-Tabulating-Recording Corporation, a company that included Hollerith's original Tabulating Machine Company.

1924 Thomas Watson (SR) International Business Machines started and headed by Watson. The company was originally called the Computing-Tabulating-Recording Corporation.

1936 Konrad Zuse Independently designed a computer that used the binary system and logic gates (instead of the decimal system and wheels). He also designed and built the first program controlled calculator. Programs consisted of holes punched in discarded film.

1937 Alan Turing English mathematician who wrote the paper "On Computable Numbers..." which described a hypothetical machine that could solve almost any logical or mathematical problem. This was the first description of the modern computer.

1938 William Hewlett andDavid Packard

Formed (for $538) a small electronics company in garage in Palo Alto, California. This company “Hewlett- Packard” was the start of “Silicon Valley”.

1939 Howard Aiken Invented the first electro-mechanical computer, the Harvard Mark 1.Instructions were given to the computer on punched tape. This computer could perform 3 operations per second.

1939 John Atanasoff Built a computer that could solve linear equations. This computer worked on the same principles as today's computers but the main component was the vacuum tube. This was the first digital computer.

1942 John Mauchly Wrote a paper on the use of vacuum tubes for high speed calculation.

1943 Thomas H. Flowers Colossus, the first electronic computer, developed at Bletchley Park (near London, England) to help break the German codes produced by the Enigma coding machine. This information was not released until 1999. At that time Flowers (a Post Office Engineer in wartime England) finally received credit for creating the first computer.

1945 John Von Neumann Famous mathematician who helped design the EDVAC (Electronic Discrete Variable Computer). The computer he designed was composed of four basic elements a Memory Unit, an Arithmetic Unit, a Control Unit and Input Output units.

1945 Dr. Vannevar Bush Writes an article describing an idea for a hypertext system.

1946 J. Presper Eckert andJohn Mauchly

Invented the first American electronic computer (ENIAC). Eckert was an engineer who assisted Mauchly in the development and construction of this machine. The main component of this machine was the vacuum tube. This computer could perform 5000 operations per second. This machine was originally designed to calculate values for distance and elevation tables for firing cannons.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 164

1946 Arthur Burks A mathematician who helped design and program ENIAC. He also worked on other computer designs.

1947 William Shockley Discovered (with Walter (December 23) Brattain and John Bardeen) the transistor. This device would take the place of the vacuum tube.

1951 Grace Hopper Created the first compiler program. This type of program examines the user's instructions and produces binary instructions that can be used by the computer to carry out the user's commands.

EDVAC computer completed. This computer was able to work from a stored program.

Transistors created. This component replaced the vacuum tube making computers smaller, cooler and more efficient. The ATLAS computer, created in 1962, could perform5 x 105 operations per second.

1958 Jack Kilby An engineer at Texas Instruments, he proposed and created the first electronic circuit composed of a block of one type of material. The first material he used was germanium. This was the beginning of the integrated circuit.

1960 Ted Nelson Begins work on a hypermedia system called Xanadu.

1963 Douglas Englebart Publishes “A conceptual Framework for the Augmentation of Man’s Intellect” which gives the framework for a hypermedia system.

He also invents the first computer mouse (pioneered by Xerox).

1964 Corrado Bohm andGuiseppe Jacopini

Introduced the idea of structured programming. These two mathematicians discovered that three structures could be used to express any programming. The structures are sequence, selection and repetition.

1964 Silicon chips used in computers. Small "chips" contained anintegrated circuit with 70 transistors. As a result computers become smaller and faster. The ILLIAC 4 could perform 1 x 109 operations per second.

1965 Ted Nelson Coins the term “hypertext”. He launches his prototype hypermedia system.

1966 Joseph Weizenbaum Devised a computer program that reproduced the conversational skills of a psychotherapist.

1970 Marcian E. Hoff(jr) Developed the first microprocessor for INTEL.This was a general-purpose logic chip. The 4004 consisted of 2,250 transistors. It could process only four bits of information and carry out 60,000 operations a second. This allowed INTEL to produce the first microcomputer (for the Japanese company Busicom) using an integrated circuit chip containing the CPU. This small computer could perform as well as any 1960's (2nd generation) computer.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 165

1971 Steven Jobs Writer of computer games for Atari. Later worked withStephen Wozniak.

1971 Pocket calculators first available.

1972 Stephen Wozniak Produced a simple computer on a circuit board. It was named by his friend, Steven Jobs, the Apple 1.

1975 Steven Jobs andStephen Wozniak

Produce the first commercial Apple computer. It sold for $666.66.

1975 William Gates Microsoft created.

1976 Steven Jobs andStephen Wozniak

Apple Computer is founded. The company was housed in Jobs’ garage.

1978 Seymour Rubinstein Created the first wordprocessing program, WordStar.

1979 Daniel Bricklin A Harvard Business School student created (with the help of Robert Frankston) VisiCalc, the first spreadsheet program, written for use on Apple computers by a Havard Business School student.

1979 Wayne Ratliff Wrote the first database program, Vulcan. This was later marketed, in 1980, with the help of George Tate as dBase II.

1980 William Gates Wrote operating system for IBM PC (MS DOS).

1983 Mitch Kapor Lotus 1-2-3 an integrated software package combining spreadsheet, database and graphics programs in one package.

Apple “bundles” the Macintosh computer with “Hypercard”, a hypertext programming environment. Tim Berners-Lee (of the European Laboratory for Particle Physics) proposes the World Wide Web. Mosaic, the first graphical web browser developed by Marc Andreeson.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 166

Bibliography

Aurgarten, Stan. Bit by Bit, An Illustrated History of Computers. New York, Ticknor & Fields, 1984.

Noonan, Larry. The Age of Computer Literacy, Toronto, Oxford University Press, 1983.

Palfreman, Jon & Doron Swade. The Dream Machine. London, BBC Books, 1992.

“How Computers Work (part 1)”, Sandhills Publishing, 2001

Understanding Computers - Software. Alexandria, Virginia, Time - Life Books.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 167

The R S FLIP-FLOP

There are two types of flip-flop gates, one based on the NOR gate the other based on the NAND gate. We will consider the one based on the NOR gate.

__There are two inputs to this gate (S and R) and two outputs (Q and Q ) one of which is the complement of the other. That is, when one is “1” the other is “0”.

The “state” of the flip-flop is taken to be the state of the Q output. For example, if the output at Q is “0”, then the state of the gate is “0”.

Rules for the RS Flip Flop:

1. If both S and R carry “0” signals, then the state of the gate does not change.

2. A “1” signal on the S input and a “0” on the input R cause the flip-flop to set to the “1” state.

3. A “1” signal on the R input and a “0” on the S input cause the flip-flop to re-set to the “0” state.

4. A “1” input on both S and R is forbidden (or not allowed). If this does happen, the flip-flop can go to either state!

Using the rules above complete the following table:

Input S Input R Output Q(Q complement)

Output Q(the STATE of the flip-flop)

- - 0 10 0 0 10 1 1 00 01 00 0

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 168

Q__Q

S

R

The completed table (using the rules above):

Input S Input R Output Q(Q complement)

Output Q (the STATE of the flip-flop)

- - 0 10 0 0 10 1 1 00 0 1 01 0 0 10 0 0 1

(NOTE: for the NAND gate based flip-flop the contents of the entire table are reversed!)

Logic circuits can be placed into two groups: those that have memory and those that do not have memory. In circuits that do not have memory, the output disappears as soon as the input is removed. For a logic circuit to have memory, the output must remain even when the input is removed.

Flip-flop circuits are used to store a single binary digit.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 169

A discussion of teaching concerns

The following are topics that have been of concern to my EDU 1040Y students.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 170

Teaching – General

Classroom management (discipline tricks; establishing control quickly)

If you want students to take you and your class seriously, you MUST do the same. Arrive on time and be prepared. Start classes on time. Do not stroll into class with a cup of coffee just as the bell rings and expect your students to take you seriously. Remember that you obliged to be at your first class at least 15 minutes before it starts.

When starting a new class, always make the students aware of your expectations. Determine AHEAD of time how you want your classroom organized. How much noise can YOU tolerate?

Be aware of school policies regarding hall passes and lateness. Late students disrupt the learning of others, handle lateness firmly – it is an issue that can quickly get out of hand. Make sure that your rules do not contradict those of the administration.

Consider making a list of "rules" for your class. Present these to the class THE FIRST DAY. These rules may be copied down by the students into their books or you may hand out a copy to each student (if you do this CONSIDER having the students "sign-off" on a copy of the rules and returning it to you).

The old adage of picking the largest/noisiest student to discipline on the first day has more than a grain of truth to it.

Make sure that you apply your rules from the start. This lets the class know that you are serious about how you want them to behave.

NOTE: It is always easier to "loosen" rules than it is to "tighten" them. It is difficult to regain control of a class once you have lost it. Remember that you are ultimately responsible for all that takes place in your classroom.

Above all – BE CONSISTENT – a rule is a rule and applies to all your students unless there are special circumstances.

Get into the habit of taking attendance at the same time every class. You will find that students do not mind you calling out their names for the first couple weeks. Prepare a seating chart as soon as possible to allow you to put names to faces (which helps with discipline in the class). A good way of remembering their names is to give small assignments as soon as possible that the students must submit and that you hand back.

One technique that worked for me in keeping the class motivated and "on track" when I was teaching general level grade 10 mathematics was the following. A goal was set with the students at the start of the week for the amount of material to be covered (having thought about it beforehand myself). Once this had been established, the students were informed

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 171

that, if they completed this work prior to the end of the week, they could have the last day of the week (usually Friday) as free time.

When possible, find ways to give the class some ownership in the proceedings of the class. This could also be the date of a test, remediation times for the class, rules of behaviour and so on. Remember though, you are the "boss" of the class and are ultimately responsible for anything that takes places during your class (you may wish to think of it as a "benign dictatorship').

Organization/time management tips

When marking never hand back student work the NEXT day – unless they absolutely require the material for other work. It sets up an unrealistic expectation on the part of the students and, therefore, puts a lot of pressure on you to always hand back the work the next day. Also it makes it very difficult for those students who need a little extra time to complete assignments. Given the procedures for marking that are now being used, these students will not be evaluated on this work because they are unable to complete it prior to your returning the assignments to the class.

It is not necessary for you to mark all work in detail for every assignment. Choose key questions to mark in detail (i.e. with a rubric or a detailed marking scheme) others can be checked-off as being complete or incomplete (correct/incorrect). Those marked in detail can form part of the actual evaluation while the others can be used for assessment purposes.

Create exercises that build directly upon previous work. One assignment does not have to be isolated from another. By taking a longitudinal approach you essentially create one large assignment that encompasses several topics. Marking also becomes easier for you, especially if you have taken up the previous version of the assignment.

Other suggestions:

Complete forms as soon as possible. Do not let them gather dust as they will return to haunt you.

Machinery often fails; prepare lessons that can be presented in several ways.

Plan ahead for tests and exams.Share work with colleagues – work in collaboration with other members of the department.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 172

Scheduling student assignments – do teachers consult to avoid overloading students?

Rarely do all teachers consult with others to determine assignment due dates. Usually teachers within a department do consult with each other. Sometimes department heads consult across departments. This would be the way to go if you want to notify the rest of the school about due dates.

Contacting parents

Parents are consulted when you have concerns about a student. Check with a vice principal first to see whether or not others have also expressed concerns about the student. You may not be the only one who is concerned.

Usually students are not informed each time that contact is made with parents. You may consider making a blanket statement to the class that you will contact "parents" should you have concerns. You should also be aware of school policies regarding certain issues – you may be REQUIRED to contact parents at certain points in the disciplinary process.

When to call is up to you. However, try to use your time at school for this matter. Also, if you call from home, contact your telephone company a make sure that your number is "private" (e.g. with Bell initiate *67). You private number is one that you do not want to be general knowledge (this also applies to email addresses).

What is the busiest time of year for a teacher?

Beginning of term, middle of term, end of term…In general all times of the year are busy but for different reasons.

For most teachers the start of a new term seems to be the busiest time of the year because there are many administrative details.

At the end of a semester/year there is generally a rush to make sure that enough material is covered to allow the students to perform well on the exam. When preparing tests, keep track of questions that could be used on an exam. These can later be assembled into the first draft of the exam. By focussing your attention on key questions you are also reminding yourself of the key concepts of that unit/section.

The key is making sure that you are organized. See the sections on: Designing (fair) tests and exams, Students helping students….

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 173

Designing (fair) tests and exams

A fair test, to me, is one where students are able to obtain 100%. It should be based on work that has been assigned to students. The questions do not have to be exactly the same as those assigned but there should be a direct relationship between the material assigned and that on the test. There should be various types of questions. There should not be ambiguous questions or those that have a "best" answer. Marks must be allotted to reflect the amount of work required by the students to complete the question.

Do not use a different style of marking on tests compared with assignments. Use assignments to familiarize students with your marking schemes (CONSISTENCY).

Exams can very test every topic that is taught in a course. When you design a test for a topic, prepare other questions that are a summary of the material contained in that topic consider the following:

What are the important points that you want the students to remember?

What are the objectives of this unit or topic?

What is necessary for the students to remember if they take the next level?

By creating these questions at the same time as making the original test, you will save yourself time later (you will not have to "remember" what you tested). You can always edit these questions at a later date.

Motivating students

This can take many forms. Usually verbal encouragement works. Let the student know what was correct (right/good) about their work as well as what was incorrect. Emphasize their strengths and have them work on their weaknesses. Design assignments in an incremental manner that allows you to check the work of students in stages. This also allows them to get feedback before proceeding to the next part of the assignment.

Another way of motivating students and praising their work is to encourage students to seek out their classmates who have produced good work. This does not have to be a whole solution it could be a particular part of a solution. Most students have good solutions at one time or another and therefore will get a chance to be acknowledged by their peers.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 174

Teaching - Computer Science

Teaching programming

Programming should be taught as a series of simple concepts with each new concept adding to the previous one. Make sure that the students understand a concept before proceeding to the next one.

Once students have an understanding of the basic concept of a simple program, consider giving them programs that incorporate new concepts (or structures) and having them investigate the result of using these in the program. You may also lead up to a new concept by having the students tell how they would accomplish a task using previously learned concepts and determining that the new task is difficult/onerous or impossible. This will pave the way for them understanding why the new concept is required (looping, decisions, text files, sorting etc.).

Always take a long-term view of what you are teaching, how does what you are teaching now relate to the next topic? The next unit? The material in the next course?

Special education in CS – accommodations and modifications

In general design your assignments so that students with different strengths have a chance to succeed. Find opportunities for students to: give presentations, prepare videos, and to work with other students. This way, when you have IPRCed students in class you will have already done some of the groundwork in preparing different forms of evaluation for your students.

The school (and the department) may choose to modify the content of a course for a certain group of students. Always be aware though, that these students may go to another school. These students have to be able to cope with the next level of course that uses the modified course as a prerequisite.

When in doubt about what accommodations to use for a student, check with the Special Education department of your school. You may also want to check with the English as a Second Language department if the student does not have standard English as their first language.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 175

Finding the balance between helping and guiding students

In order to do this effectively, you have to examine the problem that the student must solve and determine the knowledge that the student needs to possess in order to be successful in solving the problem.

Help the student by making sure that they have this knowledge first. Many times students are unable to solve a problem because of misunderstanding of the prior knowledge necessary to solve a problem.

When helping students, ask them what they DO UNDERSTAND. This will give you a more accurate determination ("assessment") of where to start helping a student AND will save you time in the long term.

Guiding students to a particular solution should be part of the design of the work leading up to a larger problem.

Create exercises that build directly upon previous work. This provides a degree of familiarity for the students (and a starting point for those students who may have had some difficulties) with part of the assignment. It also allows the students to see an assignment as part of a larger scheme and not as an isolated event. Marking also becomes easier for you, especially if you have taken up the previous version of the assignment.

Handling Inequities in the classroom Problem - some students know more than others do

Note that this is different than students who appear to know more than the teacher knows!

Suggestions:

1. Have the assignments prepared ahead of time - when a student has completed one satisfactorily, then they are given the next one to work on.

2. Sometimes it is necessary for students not to get too far ahead of others in the class, in this case prepare assignments that have different levels:

a) the first levels of the assignment should meet the minimum expectations for that assignment

b) other levels should build on the original and point towards the next topic or add greater depth to the problem

MARKING these assignments:

Marks can be assigned to these levels (similar to a rubric). For example, level 1 completion can be worth 60%, level 2 = 75% etc.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 176

Students helping students – easing the burden on the teacher

When checking solutions, take note of those students with correct answers and encourage other students to seek them out. You must encourage the students to use each other as resources. These students can also be helpful if a student returns after an absence.

NOTE: When teaching various topics keep track of common mistakes that students have made previously and mention these to the class as potential pitfalls to be avoided. Also encourage students to help others with simple syntax errors. There is nothing to be lost by having students help each other correct "simple" mistakes - ALSO questions on tests where students must correct syntax errors will also help in this regard (the errors to be corrected should be "common" ones).

Many of the mistakes first made when students learn how to program, are of the "simple" sort. If you do not encourage them to find and correct these errors by themselves, a great deal of time will be taken up by the teacher "fixing" these at a later time!!

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 177

Cheating

It is impossible to stop students working together in a computer science classroom. Instead, use this to your advantage (see Students helping students). Still, there need to be some ground rules for student submissions.

Students may be tempted to assist each other more than just with simple errors - discourage copying/cheating by:

a) not accepting two or more programs that are identical (comments and variable identifiers at least must be different)

b) "randomly" asking students (keep a list) to explain various parts of their program ("What happens here?", "Why did you...?", “What would happen if …?”). Full marks for a solution would only be given when a student is able to explain (in some fashion) how their program works.

If you assign work that is to be researched consider the following:

- limit and specify the sources to be used be the students- insist on proper referencing of material (including at least one footnote from each

reference)- INCLUDE SOME COMPONENT OF THE ASSIGNMENT WHERE THE STUDENT

MUST "EXPLAIN" WHAT THEY HAVE FOUND

This last point is, once again, the most effective way of determining whether or not the student understands what they have submitted. It does not directly address “cheating” or “copying”, but it does ensure that students will attempt to understand the material.

Teaching electronics/engineering to high school students

(learning more about the topic – see also “Keeping up with the … technology”)

The best way to learn anything is to actually do it. Work through the exercises in a text (such as the HSA Engineering text). Spend time familiarizing yourself with the material in the course, ask your colleagues for assistance, and join one (or more) of the organizations that exist for teachers.

There are various post-secondary institutions that will offer courses to teachers for a reduced (or no) cost. Be aware though that these may have other “strings” attached.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 178

Keeping up with the ... technology

It is difficult to keep track of all the new developments in computer technology. REMEMBER not to try. The key is to take notice of, and mention where appropriate, "highlights" that you feel may be of interest to the students. DO NOT try to keep up will all developments - you will suffer from "information overload".

One of the functions of the "history" section of the course is to provide a perspective from which students can view today's technology. The more information, and hopefully understanding, students have of the history of computer related technology - the better they understand today's technology. Additionally it will allow you to have the same appreciation of this technology.

How to keep the class interesting with respect to "current developments"?

a) The use of team projects - have students work together to find information on recent developments. These can then be "presented" in some fashion to the rest of the class. Not only will the students in the group learn something, but so will the rest of the class and you!!

b) Another type of project would be to have groups of students try to decide what the future development of a particular piece of equipment might be. The results could then be used to form the basis of some displays around the class or school.

c) Obtain subscriptions to various free periodicals that can be read (or used as resources) in the classroom.

e.g. ComputerWorld, Canadian Computer Wholesaler...

These can then be read both by you and the students in the class.

How to find magazines? Go to "Computer Shows" both hobbyist and professional and talk to representatives of periodicals that are on display and see if they will send you free copies. Many magazines are eager to have more names on their mailing list!!

CAUTION - be careful about putting your name on too many email lists, it can be tiresome wading through too much stuff - plus email is not always handy to show a class!!

If you must subscribe to a magazine then try "Smart Computing - Computing in plain English" an excellent all round periodical with information about new product plus "how to" features. Watch out for issues that reprint older material (convince your school library to subscribe).

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 179

Marking Programming Assignments

Programs consist, in general, of two elements: statements in some logical order and the syntax of those statements. As programs become more complex, a greater portion of the mark should be based on the logic in the program.

As part of the instruction in the course, students need to be aware of these two elements and they need to be "trained" to eliminate as many syntax errors as possible (see the section on students working together).

Earlier assignments are generally designed to check a student’s ability to write a program with correct syntax. Later programs are designed to check the ability of the student to write a program with correct structure.

Take off or add on marks?

As a rule, it is easier to deduct marks than to total them. For instance, assign a certain number of marks for the two major categories and then subtract a certain number for an error in each category. At the start of the programming assignments, syntax errors may fail a student. Towards the end of the assignments this would not usually be the case.

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 180

Other reference materials

Books

PROGRAMMING

Schaum's Outline - Computer Science, McGraw -Hill Ryerson

Problem Solving in PASCAL – John Carter; Addison Wesley

A guide to programming in Turbo Pascal – Corica, Freitas, Presley; Lawrenceville Press

Problem Solving and Programming Concepts – Sprankle; Prentice Hall

The study of programming languages – R. Stansifer, Prentice Hall (a thorough textbook examining exactly what programming languages "are")

TEACHING

These have been listed by title rather than by author:

If Learning is so natural, why am I going to school? – Andrew Nikiforuk, Penguin

School's out – A. Nikiforuk, M W & R

"Why do we gotta do this stuff Mr. Nehring?" Notes from a teacher's day in school – J. Nehring, Fawcett

The hurried child – D. Elkind, Addison Wesley

Follow the yellow brick road – R. S. Wurman, Bantam

The numbers game, A study of evaluation and achievement in Ontario schools – King and Peart, OSSTF Educational Services

Assess for success, assessment, evaluation and reporting for successful learning – Midwood, O'Connor and Simpson, OSSTF Educational Services

Making the grade, Evaluating student progress - ?, Prentice-Hall Canada

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 181

HISTORY OF COMPUTING

Bit by Bit, An illustrated history of computers – S. Augarten, Ticknor& Fields (Out of print but one of my all time favourites because of its' comprehensive coverage and well worth looking for!)

Fire in the Valley – P. Freiberger & M. Swaine, McGraw Hill(This was the basis for the movie "Pirates of Silicon Valley")

The History of Computers, A family album of computer genealogy – L. Freed, Ziff Davis

Computer, A history of the information machine – M. Campbell-Kelly and W. Aspray, Basic Books

The dream machine, Exploring the computer age – J. Palferman & D. Swade, BBC Books

ENIAC, The triumphs and tragedies of the world's first [sic] computer – S. McCartney, Walker

Code, The hidden language of Computer Hardware and software – C. Petzhold, Microsoft

Computer Technology

How Computers Work – R. White, Que(There are various titles in this series such as "…Software…", "…Internet…" and various editions, some of which are published by Ziff Davis)

RELATED BOOKS

The cuckoo's egg - C. Stoll, Bantam(Stoll tracked down the first computer hacker!)

Silicon snake oil – C. Stoll, Doubleday(a scathing examination of the "propaganda" related to technology prevalent in western society) Code breaking, A history and exploration – R. Kippenhahn, Overlook

Follow the yellow brick road, Learning to give, take, & use instructions – S. Wurman, Bantam (an essential book)

Information anxiety, What to do when information doesn't tell you what you want to know – S. Wurman, Bantam (This is now available in an updated edition)

Making time work for you, A guide to effective & productive time management – H. L. Taylor, Stoddart

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 182

VIDEOS

Pirates of Silicon Valley, TNT Original

Sorting out sorting, UT

The World of objects, Borland

Decoding Nazi Secrets, Nova(This details the creation of the FIRST electromechanical computer!)

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 page 183