- •Reading
- •Match the terms related to the topic of the Unit (1-7) with their definitions (a-f).
- •Decide if the following sentences are true or false. Correct the false sentences. Use the phrases from Appendix 3 to help you.
- •Language work
- •Grammar
- •Translate the following sentences from Russian into English. Use Grammar guide 3 and Grammar guide 4 to help you.
- •Speaking
- •Study the following sample sections of programs and define programming languages, in which these programs are written.
- •Study this Visual Basic program. What do you think this program is for? Discuss your ideas with the partner.
- •Read the text and define five basic types of programming languages.
- •Language work
- •Compare your answers with the partner.
- •Grammar
- •Read the following article about Voice xml and its component and perform the following tasks.
- •Think over and answer the following questions:
- •Reading
- •Language work
- •Speaking
Think over and answer the following questions:
Have you experienced writing a computer program?
What programming languages did you use?
What languages do you prefer to work with? Why?
Did you make any errors when writing a program?
What types of programming errors do you know?
Which of them are the most common in programming?
Can you define the following errors in PHP and Java?
-
$States = array ("Alabama", "Alaska", "Arizona", "Arkansas", "California");
echo "The first record in the States array is " . $States[1];
int a = "hello";
$x = 1
echo $x;
Discuss your ideas with the partner.
Reading
Work in pairs. One of you will read the Texts 1 and 3, the other – Texts 2 and 4, and complete the table below.
Type of error |
|
Definition |
|
Example |
|
Ways to avoid or deal with this kind of error |
|
When a program is written, it should necessarily be tested, as it might contain errors. Actually, there is no perfect 100% error free program. So, a software developer has to be aware of types of programming errors and ways to detect and rectify them.
Programming errors, more commonly known as 'Bugs' in computing lingo, can be divided into some groups.
Text 1 |
System errors affect the computer or its peripherals. For example, you run a program that needs access to a printer. If there is no printer present, the computer will produce a system error message. A sensible way of avoiding system errors is to write code to check that peripherals are present before any data is sent to it. In this case, the computer would warn you by a simple message on the screen, like 'printer is not ready or available'. |
|
|
Text 2 |
Every computer language has a specific syntax, in which code needs to be written. Any misuse of it leads to syntax errors that make the compilation of the program to fail and may cause its termination after showing the list of errors and the line number where the errors have occurred. However, in some cases the line number may not exactly point out the correct place of the error. In some other cases, a single syntax error can result in a long list of errors. Correction of one or two errors in the program may remove all of them. Syntax errors can be easily corrected during the compilation phase. |
|
|
Text 3 |
Logic errors are related to the logic of the program and are much more difficult to detect than syntax errors. They contain syntactically and semantically correct code, but do not execute the way the programmer has intended. The program containing logic errors will run, but it won't work properly. In the following C statement: if(a==b) printf(“Equaln”); When a and b are float types values, they rarely become equal due to truncation errors. The printf call may not be executed at all. A statement like while (a!=b) might create an infinite loop. It’s possible to rectify logic errors in 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 it is expected to do. This should be done long before a programmer types in the code. |
|
|
Text 4 |
Runtime errors occur during the execution of the program. These errors are not detected by the compiler, because the code is syntactically correct. A program with runtime errors will run, but produce erroneous results or may cause termination of the program. Detection and removal of them is a difficult task. An example of a run-time error is a statement that causes division by zero. In the following statement, the syntax is correct, but the statement may cause a division by zero error if the variable Second_number is assigned a value of 0: Ratio := First_number / Second_number; To determine the cause of a run-time error, a programmer needs the exact description of the sequence of events that led to the error. However, if the circumstances that led to the error are more complicated, and it is not possible to determine the exact location of the error, the debugger can be used. |
Exchange the information with your partner to complete two similar tables.
In the texts above find the words and word combinations that mean the following:
a piece of equipment that is connected to a computer and used with it;
words or expressions used only by a particular group of people, or at a particular period of time;
to correct something that is wrong;
to make someone conscious of a possible problem or danger;
the rules that describe how words and phrases are used in a computer language;
the act of ending something, or the end of something;
to happen;
to indicate;
to make a computer use a program or carry out an instruction;
something that you do as a practice for an important event;
a set of related things that are arranged in a particular order.
Decide if the following sentences are true or false. Correct the false sentences. Use the phrases from Appendix 3.
No one program (it doesn’t matter how perfect it is) executes correctly in the first time.
If you want to be a highly skilled programmer, you should learn as many types of programming errors as you can, and be able to identify and remove them.
Errors that influence the computer or its peripherals are called syntax errors.
Runtime errors happen when a program is executed.
Programmers can rectify logic errors at an easy rate when compiling the program.
If runtime errors exist in the program, it runs but produces erroneous results or may cause termination of the program.
Simple programs with logic errors can be corrected by doing a 'dry run' which means working through each line of the program on paper to prove it runs in a way it should run.
When attempting to run net share on a local computer, you may receive this message: ‘net share Logic error 5 has occurred. Access is denied'.
It is impossible to detect runtime errors, as the code is syntactically correct.
Complete the list of programming errors. Try to name at least four of them, their features, and ways to detect and avoid them.
Answer the following questions:
Is it possible to write a program containing no errors?
What programming errors do you know?
Which errors are the most difficult to detect?
Which errors are the easiest for rectifying?
How do you know that a system error occurs in the program?
What errors can be called syntax errors? What should a developer do to correct them?
Can a computer execute a program with logic errors? How can a developer correct such programs?
How are runtime errors detected?
