Saturday, March 23, 2013

Programming-languages and styles

Programming-languages and styles

Programming-languages and stylesA pupil has written a program. As it is in a computer language why does it need to be translated before the computer can execute it?

(a) A high level language is slow to execute.

(b) A high level language is easy for people to read and write.

(c) This is because it is close to human language.

Write three statements like these about a low level language.

(a) Name a commonly used high level computer language.

(b) Name the two different types of translators used with a high level language.

(c) Explain the main difference between the methods of operation of these two types of translator.

(d) What type of translator is used for a low level language?

(e) What is the name for the type of instructions that the computer hardware actually uses?

A program is written in a high level language. Which one of the following statements is true? A Each instruction in the program represents a number of machine instructions.

B It is written in binary.

C It does not need to be translated before execution.

D It is translated by an assembler before execution.

E The language is called 'high level' because it is difficult to learn.

The T90 microcomputer system has a compiler for its main high level language.

(a) Use the terms 'source code' and 'object code' to complete the spaces in the following sentences.

'A compiler produces and error messages as it translates. The input to the

(b) Compilers and interpreters both translate high level languages but use a very different approach. Give two differences you would notice in your method of writing and testing a program if you changed from using an interpreter to using a compiler.

The Euclid Microcomputer is supplied with 512 Kbytes of RAM and a 20 Mbyte Hard Disc. The Operating System, a BASIC Interpreter and a COBOL Compiler are on the Hard Disc.

(a) (i) What is RAM?

(ii) What is RAM used for?

(b) What is the function of an Interpreter?

(c) What is the function of a Compiler?

(d) Write down one advantage and one disadvantage in using a Compiled language rather than an Interpreted language.

(e) For what types of application are

(i) COBOL and

(ii) BASIC

particularly suitable?

(f) What are two advantages of having a Hard Disc rather than the more usual Floppy Disc?

(g) The Euclid Microcomputer is also supplied with a Mouse and a WIMP user interface.

(WIMP means 'Windows, Icons, Mouse, Pointers.')

(i) What is a Mouse? How is a Mouse used?

(ii) What are the advantages in using a WIMP user interface instead of the more common text Operating System command lines?

For each of these items of data ring its type.

 

Data

Type of data

A town name, e.g banbury

numeric

string

The number of words in a sentence ,e.g.11

numeric

string

A car registration number ,e.g B353AXB

numeric

string

Three algorithms are shown below. They are all meant to print out the integers from 1 to 10 inclusive.

Algorithm 1

Set count to 1

While the count is less then 10 do add 1 to the count

Output the value of the count endwhile

Algorithm 2

Set count to 1

Repeat

Output the value of the count add 1 to the count

Until the value of the count is 10

Algorithm 3

For count going from 1 to 10 do add 1 to the count

Output the value of the count endfor

None of these algorithms actually works correctly. Rewrite the algorithms so that they work.

Large programs are often written in modules. Give one reason why.