Programming Techniques

essay A+

Get Full Essay

Get access to this section to get all the help you need with your essay and educational goals.

Get Access

Usually, people start learning programming by writing small and simple programs consisting only of one main program. Here “main program” stands for a sequence of commands or statements which modify data which is global throughout the whole program. The main program directly operates on global data. It can be illustrated:

This programming techniques provide tremendous disadvantages once the program gets sufficiently large. For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied. This has lead to the idea to extract these sequences, name them and offering a technique to call and return from these procedures.

Procedural Programming

With procedural programming it is possible to combine returning sequences of statements into one single place. A procedure call is used to invoke the procedure. After the sequence is processed, flow of control proceeds right after the position where the call was made.

With introducing parameters as well as procedures of procedures ( subprocedures) programs can now be written more structured and error free. For example, if a procedure is correct, every time it is used it produces correct results. Consequently, in cases of errors you can narrow your search to those places which are not proven to be correct.

Now a program can be viewed as a sequence of procedure calls. The main program coordinates calls to procedures and hands over appropriate data as parameters. The data is processed by the procedures and, once the program has finished, the resulting data is presented. Thus, the flow of data can be illustrated as a hierarchical graph, a tree for a program with no subprocedures.

A single program that is divided into small pieces called procedures. To enable usage of general procedures or groups of procedures also in other programs, they must be separately available. For that reason, modular programming allows grouping of procedures into modules.

Modular Programming

With modular programming procedures of a common functionality are grouped together into separate modules. A program therefore no longer consists of only one single part. It is now divided into several smaller parts which interact through procedure calls and which form the whole program. The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters.

Each module can have its own data. This allows each module to manage an internal state which is modified by calls to procedures of this module. However, there is only one state per module and each module exists at most once in the whole program.

Long programs are written in small sections or modules. The advantages of this approach are:

> Small sections are easier to debug

> Once a module is thoroughly tested, it can be incorporated into the larger program with confidence

> Modules can be re-used in different programs

> Different programmers can work on different modules

> Programmers can specialize in certain techniques

> Modular code is easier to read, and hence to update

Modules come in various guises. They used to be called sub-routines. The common module types are procedures, functions and objects.

Note: Pascal is used as the sample language in the examples; other languages have similar statements


Data handled by a program is stored in named sections of memory called variables. This data can be changed as the program progresses. It is easier to refer to names than to the memory addresses where the data is stored. In a high-level language a variable will be associated with a data type that will specify the type of data that can be stored. Examples are

number : integer;

amount : real;

status : Boolean;

answer : character;


Any value that is required to be the same all the way through a program can be set up as a named constant. Reference can be made without the need to enter its value at many places. An example might be:

Pie = 3.1423

Variables and constants, and other named components of a program, are given their names by the programmer. The names are called identifiers. It is important that these identifiers mean something, so that as the program develops it remains easy to understand.

Assignment Statement:

A value is computed and then assigned to a variable in the memory of the computer. An example might be:

x := y + z

m := 30

These statements are called assignment statements because they assign a value to a location in memory. In the examples above, the values in memory locations Y and Z are added together and the result placed in X, and the value 30 is placed in M.


All high level languages have the facility to insert comments in the program code. These are brief messages that help to remind the programmer what a particular line or section means when returning to it later. A special symbol is used to tell the compiler to ignore the comment line. Comments are not translated, so take up no space in the final compiled program. Comments are also useful in tracking down errors in a program. Lines can be ‘commented out’ in order to see if they are the cause of the problem.

Selection Statement

When the program has to make a decision as to the next operation to be carried out a selection statement is used. The simplest selection statement is the IF statement. An example is:

IF amount > creditlimit THEN

Write(‘authorisation required’)


Write(‘authorisation not required’)


This statement will cause the program to output ‘Authorisation required’ if the value of the variable amount is greater than the value of the variable creditlimit. If the value of amount is not greater than creditlimit then the output will be ‘Authorisation not required’

The conditions that can be checked are known as Boolean conditions. The conditional operators are <, >, >=, <=, <> , =.

A more complex selection statement is the case statement (sometimes called a switch statement). This statement causes the computer to select one of a list of options, for example:

Case Menuchoice of

‘A’ : writeln(‘you have chosen Add’)

‘C’ : writeln(‘You have chosen change’)

‘D’ : writeln(‘You have chosen Delete’)


Case statement could be achieved with If…Then….Else statements but the Case statement is a neater form of selection statement when there are more than two possible outcomes to be tested


An iteration statement allows the execution of a series of statements a number of times(often called a loop). There are two main types of loop:

* While/Repeat – used when the number of loops to be taken is unknown on entry (conditional loop)

* For – used when the number of loops is known in advance (unconditional loop)

The While loop checks a Boolean condition before entering the loop, so that the loop is not performed at all if the condition is false. For example,

Total = 0


While mark <> – 1 do


Total = total + mark

Writeln(‘please enter the next mark , -1 to end’)



Writeln(‘Total of all marks is ‘, total)

If the mark read in at the second line is equal to -1, the statements in the loop will not be executed at all and the next line to be executed will be

Writeln(‘Total of all marks is ‘, total)

The repeat..until loop checks the Boolean condition at the end of the loop and therefore the loop is always performed at least once. For example,

Total = 0



Total = total + mark

Writeln(‘please enter the next mark , -1 to end’)


Until mark = -1

Writeln(‘Total of all marks is ‘, total)

Difference between these two types of loops:

(1) In a While loop, the Boolean condition is checked before entering the loop whereas in a repeat..until loop, it is checked at the end of the loop

(2) The while loop iterates on a true Boolean condition whereas in a repeat..until, it iterates on a false boolean condition

(3) The repeat..until loop will execute at least once whereas the while loop may not execute at all

The for loop (For…next loop) is used when the loop is to be repeated a fixed number of times. A counter is automatically incremented each time the loop is performed. For example,

For count = 1 to 20


Writeln(‘line’, count)

(any statements can be placed in the loop)


This will display

Line 1

Line 2

Etc as count is automatically incremented

Subroutines and Parameters

Top-down design is a method of solving a problem by breaking it down into tasks and then into gradually smaller and smaller tasks. The process of breaking a task down into smaller and smaller parts is called stepwise refinement.

Advantages of using top-down design

(1) Individual modules can be separately testes

(2) Modules can be kept in a module library and reused in other programs

(3) Long programs that are split into modules are easier to read, debug and maintain

(4) A team of programmers can each work on separate modules, thus shortening the total development time for a large project and each one contributing its own specialism

(5) It reduces the chance of errors

Bottom-up design

It starts with the lowest levels of details and works up to the highest level of the problem. From a programming view, bottom-up design is equivalent to writing modules or procedures first. Sometimes it is useful to make the individual blocks of a system and then stick them together later.

Large programs need to be split into smaller sections of code which are known as subroutines or subprograms. There are two types of subprogram known as procedure and functions. They are very similar but a function will always return a value where as a procedure will never return a value.

A procedure or function is given a name and called by simply writing the name, followed by any parameters to be passed written in brackets. Parameters are the means of passing information to and from a subprogram. The use of parameters makes modules reusable for different values and saves programming size and effort.

Example of using a procedure:

(a) Procedure to display a title

Procedure title();


Writeln(‘***********Phoenix Libre Service***********’)

Writeln(‘ Rose-Hill’)

Writeln(‘ Tel: 454-0125’)


The main program could call this procedure by

{other statements}

Title; {call statement}

{other statements}

(b) Procedure to calculate average and making use of parameters

Procedure calculateaverage(A,B,C : real; Var average : real)


Average := (A + B + C) /3;


The main program could include statements such as:

Result := 0




Calculateaverage(Num1, num2, num3, result); {call statement}

Writeln(‘The average is ‘, result)

Num1, num2, num3 and result are parameters passed to the procedure calculateaverage.

The statement used to transfer execution to the procedure is referred to as the call statement, and the number, type, and order of parameters must exactly match the parameters in the procedure heading.

Functions may be intrinsic to the language or may be user-defined functions. Intrinsic functions are built-in functions such as sqr(100) and user defined functions are called by a name defined by the user.

Functions may be used when a single result is to be returned, as in the above example, for calculating average. The result is returned via the function name, so that a function for calculating the average of three numbers could be coded as follows:

Function Average (A,B,C : Real) : Real;


Average := (A+ B+ C) /3;


To call the function, the programmer writes:

Result := average(num1, num2, num3);

Many languages such as Foxpro have several ‘built-in’ functions such as

Str converts a numeric value to a string value, it expects a numerical value and returns a string value

Ctod converts a character to date, it expects character value and returns a date value

Program Translation

When a human being writes a computer program it is important for them that they can use a language which is easy to understand. After all, the algorithm will probably be difficult enough to follow without the language being difficult as well. Computer languages like this, that the person finds easy to understand, but the computer can’t, are called high-level languages.

A computer can only understand 0s and 1s, in other words, binary numbers. So the language which the computer uses is all in binary and very difficult for human beings to use. Languages like this are called machine code languages. If the program is written in a high level language and the computer can only run it in machine code, then it has to be translated from one to the other, just as a letter in Chinese may need to be translated into English if an English speaker is to be able to read it.

High-level Machine

Language Translator code

A program which is written in a high level language is called the source code. After the source code has been translated the program is called the object code (or executable form).


The object code is normally much bigger than the source code because it takes lots of machine code commands for each of the high-level language commands.

There are two types of translator, one is called a compiler and the other is called an interpreter.

Program Errors

A program may have any or all of four types of error:

* Syntax error: a statement in the program violates a rule of the language; this could be a simple misspelling of a keyword, a missed punctuation mark, or a wrongly formed statement.

For example,

@10,10 sayy “This statement contains 2 syntax errors’

{misspelt keyword say and string starting with a double quote and ending with a single quote}

* Semantic error: the meaning of the code is ambiguous or faulty. For example by specifying the wrong number or type of parameters in a subroutine call, or tying to assign a real value or a string of characters to a variable which has been declared as an integer e.g

Num1 := ‘Testing’ {Num1 is an integer varaible}

* Logic error: the program runs but gives the wrong answer or performs wrongly in some way. For example, the programmer writes

Net := Gross + Tax;

When the statement should have been written

Net := Gross – Tax;

* Run-time(arithmetic) error: The program has no logic or syntax errors but ‘crashes’ during execution. This may be caused, for example, by attempting to open a file on a floppy disk which is not in the drive, or division by zero caused by the user entering 0 when the program expected a non-zero number, or entering a character when a number was expected.

The first two types of error will be detected by the compiler, which will usually pinpoint the error and give a suitable error message.

Logic and run-time errors are detected by rigorous testing, with data for which the expected answers have been calculated. A test plan should test all unexpected occurrences.

Test Strategies

The aim of any test plan is to try and make a program fail. It is to try and find bugs in the program.

White box Testing (also known as ‘glass box testing’)

This kind of testing can be done either by the programmers who wrote the code or some people employed specifically to test software. This type of testing is known as ‘white box testing’ or ‘glass box testing’. The test plan is based upon the structure and design of the actual code. The person who writes the test plan can actually see the code.

Consider this example. Suppose this pseudo-code with lots of nested IF statements.


PRINT “Poor mark”



PRINT “Could do better”



PRINT “Good”


PRINT “Well Done”




Because the tester can see this code, he will try a value less than 100, greater than or equal to 100 but less than 200, greater than or equal to 200 but less than 300, and greater than or equal to 300. The tester can only design the tests for white box testing once the code has been written.

Black box Testing

It is so described because the code is viewed as being inside a black box, or unreadable. Tests that are carried out are based upon feeding data into the box and observing what comes out. The tester has no knowledge of the code. This kind of test should be written before the program is written. This is possible because the tester is not testing the code as such but testing to see if the program can do what it was written to do. The focus is on the functionality of the program. The tests will be written so that data is inputted via the interfaces provided and the outputs observed to see if what was predicted would happen actually does happen.

Black box test are written in advance of the code being written and the functionality of the code is the focus not the code itself. It is best that a person not doing the programming writes the test plan.

For a black box test plan to be complete, the following kinds of test data should be done:

* Valid data

* Invalid data

* Borderline data

The person writing the test plan would not know the code. They would know what is in the specifications of the design, where it will state what the code should do in a range of circumstances. The tester will need to write a plan that uses valid, invalid and borderline values to cover all of the points in the specification. Valid data might include 34,150 and 250. Invalid data might include ‘Gr’. Borderline data might include 99,100,101,199,200, 201,299,300 and 301.

The document recording a good black box test plan will not only record what valid, invalid and borderline data will be used but will also

* Predict the outcome when each of the pieces of test data is used

* Record what actually happens when each piece of data is entered, just in case someone needs to check that the product was fully tested later on.

* Record any action taken as a result of test being done

Alpha Testing

Software can be fully written and then tested using black box and white box testing. It can also be partially written and partially tested. Whichever approach is used the product, whether complete or only partially complete, can be passed to a restricted audience (normally a group of programmers) within the company that produced the software. They will use it, give feedback, will report any faults they find, make comments about the ease of use of the software and suggest improvements, for example. This kind of testing is known as ‘alpha testing’. It is used to further improve a product and to help track down bugs.

Beta Testing

Once a product has been alpha tested, it can then be improved and ‘finished off’. It is then released to a limited audience in return for their feedback. The audience might include reviewers, special customers and people who write textbooks about software products. This information can be used to further improve the quality of the final product before it is finally released and sold as a finished program to an awaiting public. This kind of testing is known as ‘beta testing’

Identifying Programming Errors

Errors in computer solutions are called bugs. They create two problems. One is correcting the error, this is normally fairly straightforward because most errors are caused by silly mistakes. The second problem, however, is much more complicated, the errors have to be found before they can be corrected. Finding where the error is, identifying it, can be very difficult and there are a number of techniques available for solving such problems.

1. Translator diagnostics.

When some source code is translated, it is passed over to a program called a ‘translator’. It checks the lines against the rules of the languages. On finding a syntax error, the translator program know that a mistake has been made, it knows where the mistake is and, often, it also knows what mistake has been made. A message detailing all this can be sent to the programmer to give hints as to what to do. These messages are called translator diagnostics.

2. Sometimes the program looks alright to the translator, but it still doesn’t work properly. Debugging tools are part of the software which help the user to identify where the errors are. The techniques available include:

a) Cross-referencing. This debugging tool identifies every place that a particular variable occurs. This lets the programmer check to make sure that the same variable has not been used twice for different things.

b) Single-stepping through the program: using a function key or other means, the programmer can execute one line at a time, so that the path through the program can be traced.

b) Watch and Trace. It is possible to tell the computer to display (or ‘watch’) certain variables in a program. The programmer can then step through the program line-by-line (or ‘trace’ through the program) watching the variables as they change. This is like doing a dry run on paper. This tool, however, is very powerful when used with the breakpoint tool described below.

c) Breakpoints. The programmer can allow execution to proceed up to a certain point and then single-step from that point.

d) Variable dumps. At specified parts of the program, the values of all the variables are displayed to enable the user to compare them with the expected results.

e) Dumping and examining the entire contents of memory at a specified point during execution

f) Dumping (i.e printing out) and examining the contents of a file before and after updating

3. Desk checking is sometimes known as a dry run. The user works through the program instructions manually, keeping track of the values of the variables. Most computer programs require a very large number of instructions to be carried out, so it is usual to only dry run small segments of code that the programmer suspects of harboring an error.

The programmer copies out a list of instructions from the program into a table on paper (trace table). The latter then adds columns for any variables that are important for the code and works through the program on paper.








Input Taxrate


Input Grosssalary



TaxDue = Grosssalary * Taxrate/100




Netsalary = Grosssalary – Taxdue





Input Bonus






Netsalary = Netsalary – Bonus






Print Netsalary







Dry-run normally retrieves logical errors. In the above example, the error is that bonus must be added to netsalary.

4.Bottom-up testing. Programs are designed using the top-down approach. The bottom-up testing technique is particularly useful for testing the finished program because it is far easier to test a lot of small programs than it is to test one large one.

One problem can arise, because the small programs have to be joined together, these joints have to be tested too to make sure that no silly mistakes have been made like using the same variable name for two different things in two parts of the program (tested by cross referencing).

5. Test strategies are important to establish before the start of testing to ensure that all the elements of a solution are tested, and that unnecessary duplication of tests is avoided. (Covered more in detail later on)


There are a number of simple things that a programmer can do to ensure that a program’s code is ‘readable’ and can be maintained in the future.

a) Top-down programming(also known as stepwise refinement)

Programs should be written in modules. Whatever the language being used, it will be easier to understand a program if it has been broken down into small modules, with each of the modules performing ideally just one task and coded up as a standalone piece of code. The modules are effectively standalone units of code that can, however, interact with other modules of code. The approach of splitting up a big problem into a smaller problem is known as ‘top-down programming’. It aid program understanding

b) Comments

Code is just that, code. By adding a commentary and explanations throughout a program, it will help someone follow what has been done and how a particular piece of ‘clever’ code works.

c) Variables names

Variable names should reflect the item of data they hold. If this is done a program can be ‘read’ that bit easier than if meaningless variables names are used. Consider the following programs: program 1 and program 2

Program 1

Program 2

Input Taxrate

Input value1

Input Grosssalary

Input value2

TaxDue = Grosssalary * Taxrate/100

Value3 = value2 * value1 /100

Netsalary = Grosssalary – Taxdue

Value4 = value2 – value3

Input Bonus

Input value5

Netsalary = Netsalary + Bonus

Value4 = value4 + value5

Print Netsalary

Print value4

Both programs are the same but program 1 can be read and followed easily whereas you quickly lose track of program 2.

d) Indentation

Programs are rarely written as a list of instructions. Parts of the code are ‘indented’ (moved in a few spaces) to emphasise that the code belongs to one of the programming constructions ‘selection’ or ‘iteration’. Code that is indented in this way is far easier for programmers to read and follow than code written as a list of instructions.

1. A roll of wallpaper is 50cm wide. Each roll is 15m long. A room measures x metres long by y metres wide and 2.5 metres high. Ignoring the door and any windows that there may be, describe an algorithm for calculating the number of rolls of wallpaper needed to paper the room. (4)

2. Set the counter to 0 and the total to 0

Read a number

Add 1 to the counter

Add the number to the total


Are there any more numbers?


Divide the Total by the counter

Report the answer

Describe the effect of this algorithm. (4)

3. Give three advantages to using a top down approach when designing a solution to a problem. (3)

4. A piece of software is to be written which will control a central heating system. It is decided that the software is to be written as a set of four modules. State four modules, whose combined solution would be a solution for the whole problem.

5. X = 1


X = X + 1

Y = X * X



The intention of this module is to print out the square numbers from 1 to 100.

a) Write down the output that the module will produce. (2)

b) Using the same structure, produce a similar module that will work. (2)









a) If the numbers 3,5,4,0,4,0,9,1 are used as data for this procedure, state what the printout will be when the procedure is completed. (2)

b) Identify the condition statement, and explain what it does. (3)

7. State what is meant by the terms

(i) Source code

(ii) Object code

(iii) Machine code (4)

8. Describe the relationship between the source code and the object code.


9. State three types of program error and give an example of each. (6)

10. A program is written that will allow the user to input a list of 5 numbers and will print out the largest and the smallest of them.

The program is to be tested to see that it works under all conditions. The programmer decides to use the test data 3,4,2,5,6,7 in order to test what will happen if more than 5 numbers are input.

Give four other different sets of test data explaining the purpose of each. (8)

11. Explain the difference between alpha testing and beta testing. (2)

12. Explain how the translator program can issue error diagnostics and give an example of an error that can be spotted by the translator. (3)

13. Bugs are common in computer programs. Describe two techniques that can be used to help debug a program. (4)

14.a)Describe what is meant by annotation of a program code. (2)

A. -Explanation of the techniques used in the algorithm

b) Describe two methods that can be used to annotate code. (4)


1 A. -Add twice x to twice y/Work out total length of walls

-Divide by .5metres/work out the number of strips of paper needed

-Divide 15metres by 2.5metres/work out the number of strips in one roll of paper

-Divide number of strips needed by the number of strips in one roll

-Indication of the order required.

Note that the mark scheme is not presented in any particular algorithmic form. This is because the syllabus does not specify that a particular form be used so it is entirely up to the candidate, provided that the two points about stating the tasks to be carried out and specifying an order are met. Also notice that the first three steps of the algorithm are presented in two ways. One could be called mathematical while the other is descriptive. Either is perfectly acceptable. One last point about the mark scheme is that an algorithm implies that order is important, so it is highly likely that in an exam, such a question would insist on an order as an essential feature of the solution. In other words one mark would be reserved for providing a definite statement of order.

2 A. -An unknown number of numbers…

-is read into the algorithm.

-When there are no more numbers to read

-The average (mean) is worked out

-The answer is then output.

Producing an algorithm to anything other than a trivial problem under exam conditions is difficult. One solution to this problem is for the examiner to produce the algorithm for the candidate and then expect the candidate to follow the logic. The example here is a very simple one but illustrates two points. First, the fact that whatever the algorithm is it will be short, and secondly that while many algorithms are mathematically based the mathematics is not necessary to attain full marks. When answering a question like this pay particular attention to the number of marks available, and be careful not to simply write down what is given in the algorithm. E.g. no marks would be given here for saying that one is added to the counter.

3 A. -Many people can be involved in the solution

-Individual skills can be used

-A module can be used from the software library

-Each module is far easier to understand than the whole program is.

-Fewer errors are likely to be made

-Any errors that are made will be easier to correct.

A standard question, whose answer jumps from the notes.

4 A. -Handling of the input from the sensors

-Interface with the owner of the system allowing input of important values

-Processing module which makes decisions about the heating requirements

-Control of the output devices in order to carry out the processing decisions

-Alarm system in case of errors occurring.

5(a) A. — 4,9,16,25,36,49,64,81

– An indication that the candidate realises that the first value of X that is used is 2 instead of 1

– An indication that the last value used is 9 when it should have been 10.

Notice that the arithmetic is not being tested here. It is possible to get full marks even if you can’t multiply. The examiner is not trying to test your mental arithmetic but is seeing whether you can follow a small section of logic.

(b) A. – Change the X = 1 to X = 0

– Change the WHILE X<9 DO to WHILE X<10 DO

These are not unique possibilities. There are plenty of other ways of achieving the same results. The mark scheme is really one mark for correcting each of the output errors in the original.

6(a) 5,2

(b) A. -IF…THEN…


-Decides whether the number input is zero or not.

-A count is kept of all the zeros input, and the other numbers are used in the calculation.

Note that the algorithm is provided. It would be hard to expect candidates to produce algorithms of this type in an exam, to all but the most trivial of problems. The description in part (b) can be in the broadest terms. The examiner is not looking for a brilliant insight into the logic, simply for an indication that the student understands the general principles.

7 A. -Generally, code means a set of instructions designed to carry out a task

-Source code is the version of the program written by the programmer…

– in high level language.

-Object code is the executable form of the program…

-created by the translator

-Machine code is in binary form.

Note that there are plenty of marks available here, and the fact that the mark comes at the end of the question implies that the dotties are lumped together and that the marks are largely interchangeable.

Teacher’s note: there is no distinction between interpreter and compiler as yet. Even to the extent that students are not penalised for not knowing that the interpreter does not produce an object code. It is not yet in the syllabus, so should not be expected.

8 A. -The source code is the original program while the object code is after translation.

– There is a one to many relationship between the two.

Note. This could have been a very complex answer. However, you don’t know a lot about translators and their effects yet, and a look at the number of marks available tells you that the answer is strictly limited. The second mark point is rather strangely put, it simply means that the object code is longer than the source code, and if that’s what you said you would get the mark.

9 -Syntax error

-Mistyping a reserved word, eg typing plint instead of print

-Logic error

-A jump instruction that tells the computer to jump to the wrong place

-Arithmetic error

-Inappropriate use of arithmetic. Eg dividing by zero

Note. There are many possible errors that could be given as examples of each of these. It is sensible to stick to the standard answers that way there is no chance of picking a wrong one.

10 A. – 1,3,-4,6,5

-To determine how it handles negative numbers.

– 1,3,4,-6,5

-To determine whether it chooses the largest number according to magnitude or whether it takes the sign into consideration.

– 1.5,3,4,5,6

– To determine whether it can deal with fractions.

– 1,1,1,1,1

-To see what happens if the largest and the smallest are the same.

Note. There are many more sensible sets of test data that could be used. These are just examples. Make sure that you read the question carefully and give ‘different’ sets of test data. Just changing the data doesn’t make it different, it is the reason for the choice of data that must be different.

11 A. -Alpha testing is done by the programmer or in the software house.

-Beta testing is done by the user.

12 A. – Translator compares reserved word/syntax (rules) in its dictionary

– If different to what is in the dictionary the user can be told what and where the error is.

-eg PLINT is not in the dictionary of words that it knows, so there must be an error.

Note. The same example has been used again. I know this one is right, why risk changing it?

13 A. – Cross referencing of variables

– checks the program for occurences of the same variable being used more than once.

– Trace table.

– As the program is run the values of the variables are printed out as the instructions are executed, allowing the user to see where sudden, unexpected, changes have occurred.

Note. There are lots of possible answers here, always choose the two answers that you are absolutely sure of.

14(a) -Needed by people employed to maintain or amend the program in the future…

-by explaining the logic and the reasoning behind the code.

(b) -Indentation of groups of statements.

-This not only makes the group stand out, but also ensures that the person looking at the code knows which statements should be treated together.

– Use of sensible variable names.

-This means that long references to look up tables are not needed and helps to make the understanding of lines of instruction easier to follow.

Note. Again, these are standard answers, but no less effective for that and safe because we know they are going to be right.

Programming Tools & Techniques James Leong Mook Seng

Get access to
knowledge base

MOney Back
No Hidden
Knowledge base
Become a Member