Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Programming.doc
Скачиваний:
18
Добавлен:
25.04.2019
Размер:
1.14 Mб
Скачать

Unit 1. Computer Programming

Warm-up

Task 1. What do you know about programming? Answer the Internet Quiz.

  1. When creating a computer program, the _____ designs the structure of the program.

  1. end user

  2. systems analyst

  3. programmer

  4. all of the above

  5. none of the above

  1. Checking a computer program for errors is called _____.

  1. bugging

  2. debugging

  3. correcting

  4. syntaxing

  1. The computer itself uses _____ language.

  1. natural

  2. assembly

  3. machine

  4. high-level

  5. none of the above

  1. The language which is best for mathematical models is _____.

  1. FORTRAN

  2. BASIC

  3. Java

  4. C

  5. COBOL

  1. The term BASIC is an acronym for _____.

  1. Balanced Assembly System Integrated Code

  2. Basic All System Internal Code

  3. Beginner's Assembly Syntax Instruction Code

  4. Beginner's All-purpose Symbolic Instruction Code

  1. A programming language which looks like normal English is a(n) _____ language.

  1. normal

  2. high-level

  3. natural

  4. 4GL

7. The process of writing the computer instructions is called _____.

  1. coding

  2. compiling

  3. debugging

  4. interpreting

8. The most widely used language for business programs is _____.

  1. Fortran

  2. BASIC

  3. Java

  4. C

  5. COBOL

9. The _____ must decide what a new program is to accomplish.

  1. End user

  2. systems analyst

  3. programmer

  4. supervisor

10. Documentation of computer programs is important so that _____.

  1. users can learn how to use the program

  2. other programmers can know how to maintain the program

  3. the programmer can see why the code is written that way while hunting for sources of error

  4. all of the above

  5. a and b only

Listening

Task 2. Programmers sometimes use flowcharts when planning a program. Listen to the recording and identify these symbols used in flowcharts. Four symbols are not mentioned.

a) ________________ b) _________________ c) _______________

d) ________________ e) _________________ f) _______________

g) ________________ h) _________________ i) _______________

Task 3. Listen again to the recording and write below a typical example of an instruction often found there in flowcharts. One symbol has no words.

      1. _____________________________________________________________________

      2. _____________________________________________________________________

      3. _____________________________________________________________________

      4. _____________________________________________________________________

      5. _____________________________________________________________________

Reading

Task 4. Look at the algorithmic flowchart on the next page and answer the questions.

        1. Which computer commands does it show?

        2. How many decisions does the computer make?

        3. After the user clicks Save, how many times does the user input data?

        4. How many ways of developing the events are possible here?

        5. In what case will the program be completed in the shortest way?

Now describe this algorithmic flowchart.

The program reads the file name, format and location.

YES

NO

Program reads the file name, format and location.

YES

NO

Task 5. Read the text about computer programming. Write the number of the paragraph that gives you the information.

  1. why high-level languages are easy to learn _____

  2. a description of machine language _____

  3. the greatest problem for computer programmers _____

  4. the names of three high-level computer languages _____

  5. a description of an algorithm _____

  6. different uses of computers in our lives _____

  7. a description of a computer program _____

  8. what computers do with code _____

  9. a description of the binary system _____

  1. The diagram above shows part of a simple algorithmic flow chart for the Save command in a computer program. An algorithm is a set of logical rules that we use to solve a problem. Computer programmers often use algorithms to plan their programs, but the only language a computer understands without translation is machine language. This uses the binary system of 1 and 0, which matches the electrical positions ‘on’ and ‘off’. We can also show these numbers in English by Yes/No or True/False.

  1. Machine language is a low-level language and is very difficult to write. Over the years, computer scientists have developed many high-level languages, such as BASIC, C++ and Java. These languages use a computer code that is similar to English, which makes them easier to learn. A computer program is just a set of coded instructions. A computer translates the code into machine language to complete a specific task. A computer receives input, processes data and produces results, or output, according to the program code.

  1. We use computers in many parts of our lives, and not just in schools or for the Internet. There are computers in all kinds of electrical devices, from mobile phones to washing machines. We can find them in banks, supermarkets and cars. When programmers write programs, they have to plan carefully for every possible kind of error a computer user can input into the computer. It is planning for the random behaviour of humans that makes programming so much fun.

Speaking

Task. 6. Work in groups and discuss the following questions.

  1. Have you ever had any problems with the computer?

  2. What kind of errors do you make with computers?

  3. How do you behave when things go wrong with a computer?

Listening

Task 7. Listen to the interview with Colin who is a programmer and answer these questions.

  1. Is programming stressful?

  2. What does Colin do as a break from programming?

  3. Where do the team do much of the design work?

  4. How many people are there in the team?

  5. What do they do?

  6. How long did Dante take to write?

  7. Why was it easy to split?

  8. What languages does he mention?

  9. How does he keep up with developments in his field?

  10. Why does he hate to go home sometimes?

Reading

Task 8. Work in groups of three: A, B and C. Read your text on the next page and complete the table.

Text A

Text B

Text C

Type of error

Definition

Example

Ways to avoid or deal with this kind of error

  1. System errors affect the computer or its peripherals. For example, you might have written a program which needs access to a printer. If there is no printer present when you run the program the computer will produce a system error message. Sometimes a system error makes the computer stop working altogether and you will have to restart the computer. A sensible way of avoiding system errors is to write code to check that peripherals are present before any data is sent to it. Then the computer would warn you by a simple message on the screen, like ‘printer is not ready or available’.

  1. Syntax errors are mistakes in the programming language (like typing PRNIT instead of PRINT). Syntax errors cause the program to fail. Some translator programs won’t accept any line that has syntax errors. Some only report a syntax error when they run the program. Some languages also contain special commands such as debug, which will report structural errors in a program. The programming manual for the particular language you’re using will give details of what each error message means.

  1. Logic errors are much more difficult to detect than syntax errors. This is because a program containing logic errors will run, but it won’t work properly. For example, you might write a program to clear the screen and then print ‘hello’. Here is a code for this:

10// Message

20 PRINT ‘Hello’

30 CLS

40 END

The code has a logic error in it, but the syntax is right so it will run. You can get rid of logic errors from simple programs by ‘hand-testing’ them or doing a ‘dry run’ which means working through each line of the program on paper to make sure it does what you want it to do. You should do this long before you type in the code.

Task 9. Now share information orally about your text with others in your group to complete the table for each of the errors described.

Writing

Task 10. Draw a flowchart like one in Task 4 for one of these activities. Follow these steps:

  • Choose a simple procedure from the ones in the box below (or a simple one of your own).

  • Break the procedure down into all the steps that you have to follow. Think about where the process starts and ends, and the input from you and from the outside. When you make a decision, think of when you say ‘yes’ and when you say ‘no’, and what happens next.

  • Write exactly what happens at each stage.

  • Draw the flowchart, putting your text into the different shapes in Task 2.

  • Show your flowchart to another student. Does he/she agree with your steps?

Making a cup of tea or coffee

Making a telephone call

Sending a text message

Answering the door

Planning a holiday

Choosing a new computer

Preparing for an important exam

Playing a cassette or a CD

Speaking

Task 11. Read the quotations about ‘programming’ below. Discuss with other students what point you think each quotation is trying to make and whether you agree with it.

  1. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

  2. To understand a program you must become both the machine and the program. (Alan J. Perlis)

  3. Perhaps if we wrote programs from childhood on, as adults we'd be able to read them. (Alan J. Perlis)

  4. Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)

  5. “There are two ways to write error-free programs; only the third one works.” (Alan J. Perlis)

  6. “Don’t worry if it doesn’t work right.  If everything did, you’d be out of a job.” (Mosher’s law of software engineering)

  7. It is easier to change the specification to fit the program than vice versa. (Unknown)

  8. Most people find the concept of programming obvious, but the doing impossible. (Alan J. Perlis)

  9. One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. (Elbert Hubbard)

  10. Those parts of the system that you can hit with a hammer are called hardware; those program instructions that you can only curse at are called software. (Anonymous)

  11. Any given program costs more, and takes longer. (Computer law)

  12. The most harmful error of any program will not be discovered until the program has been in production for at least six months. (Troutman's programming postulates)

  13. Profanity is the one language that all programmers know the syntax of. (Troutman's programming postulates)

  14. Real programmers never work from 9 to 5. If any real programmer is around at 9 a.m., it’s because they were up all night. (Some computer geek)

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]