Você está na página 1de 5

Hartzell High School

Page 1 of 5

Programming Languages Test 1 marking scheme
NB: any relevant points for each question must be considered
1. Define low level languages (LLL). [2]
Possible answer
Low level languages are either written in machine codes (i.e. binary values) or in assembly language.
Low level languages are machine oriented (machine specific).
LLL is machine oriented and is difficult to read or understand
LLL are two forms name machine language and assembly language
Any point from the above award one mark [1]
2. LLL is in two forms. Briefly describe the two forms of low level languages, possibly giving two advantages and any
two disadvantages of each form. [12]
Possible answer
a. Machine language (code) (maximum two marks)
- The language that the computer can understand, that uses different binary digits to stand for different
instructions and locations.
- Is the language used to write programs in binary form (1s and 0s).
- Machine code executes without translation.
- Machine language is machine oriented
Any point from the above award one mark [1]

Advantages: (maximum two marks)
Programs run faster since they are already in computer language. There is no need for conversion
as programs are in machine language.
Programs occupy very small disc storage space by storing just 1s and 0s.
Any point from the above award one mark [1]


Disadvantages of Machine language: (maximum 2 marks)
- They are very difficult to learn.
- They are difficult to understand.
- Very difficult to use and therefore very few programmers use them these days.
- It takes too long to debug and therefore is prone to some errors.
- It takes too long to develop working programs.
- They are machine dependent (they can only work on type of computer designed for and not work on
other computers)
Any point from the above award one mark [1]


b. Assembly Language: (maximum 2 marks)

Possible answer
Hartzell High School

Page 2 of 5

- These are programming languages that use mnemonic codes in coding programs.
- Is a basic language which uses mnemonics to stand for instructions and labels to represent data locations
- Mnemonic codes are abbreviations used to represent instructions when coding assembly language
programs, for example, LDA for Load, ADD for Addition, etc.
- One assembly language statement is equivalent to one machine code instruction and therefore
programming is lengthy and time consuming.
- It is translated by the assembler
- Programs also run faster as they are closer to machine language and therefore are used in designing
programs that needs efficient timing, e.g. games like chess, operating systems, etc.
- Assembly language is used when there is need to access registers and memory addresses directly.
- They also contain different forms of instruction, e.g. jump, control, arithmetic, etc.
- Assembly language allows immediate, direct and other forms of memory addressing.
Any point from the above award one mark [1]

Advantages of Assembly language: (maximum 2 marks)

Possible answer

- One assembly language instruction corresponds to one machine code instruction and therefore
translation is easier and faster
- Programs run faster since they are close to machine code. (Very useful for making efficient and fast
running programs.)
- They occupy very small disk storage space hence are economical to use.
- Easier for a programmer to use than machine language.
- Very useful for making small programs for embedded system applications.
- Easy to access hardware in assembly language
- Writing compact code.

Any point from the above, award one mark [1]

Disadvantages of Assembly Language (maximum 2 marks)
Possible answer
- They are very difficult to learn.
- They are very difficult to understand.
- Takes too long to develop working programs.
- They can be machine dependent (machine oriented) unless the machines use the same processor chip.
Award one mark for any of the points listed above [1]
3. The second generation language is used in coding several different programs. Give any three areas of
programming where second generation languages are used and give three reasons why they are used to produce
those type of programs. [6]

Possible answer
Assembly language is used in: (maximum 3 marks)
- Coding operating systems
Hartzell High School

Page 3 of 5

- Coding device drivers
- Coding programs for embedded systems like DVD players, decoders, etc.
- Coding encryption software

Award one mark for any of the points

Reasons for using assembly language (maximum 3 marks)
Possible answer

- One assembly language instruction corresponds to one machine code instruction and therefore
translation is easier and faster
- Programs run faster since they are close to machine code. (Very useful for making efficient and fast
running programs.)
- They occupy very small disk storage space hence are economical to use.
- Easier for a programmer to use than machine language.
- Very useful for making small programs for embedded system applications.
- Easy to access hardware in assembly language
- Writing compact code.
Award one mark for any of the points
4. Write a visual basic program used to divide any two numbers supplied by a user. The quotient must be displayed
in a label. [4]
Possible answer
Private sub cmdDivide Click ()
If txtNum2 = 0 then
Msgbox (Dividing by zero is undefined) 2 marks
Else
lblQuotient = val(txtNum1.Text) / val(txtNum2.Text) 1 mark
End if
End sub
Award one mark for stating Private Sub and End sub
5. Describe declarative programming languages. [3]
Possible answer
Declarative programming languages consist of a series of facts and rules about a particular subject, rather
than a sequence of instructions.
In declarative programming languages, a programmer describes the problem to be solved rather than an
algorithm to be followed
The program is structured as a collection of properties to find in the expected result, not as a procedure
to follow
A program written in a declarative language searches a database according to a set of rules supplied to it
and produces the results.
Hartzell High School

Page 4 of 5

An example of a declarative programming language is Prolog. (artificial intelligence, knowledge based
systems, expert systems)

Award one mark for any of the points (maximum 2 marks), third mark is for relevant example(s)

6. Describe imperative programming languages [3]
7. Possible answer
These are high level programs in which the programmer specifies how the program is to be
executed, following a predefined execution sequence.
The programmer has to write instructions (in source code) that are to be strictly followed when
performing a certain task.
The programmer shows steps in the order of execution, providing a set of data.
Procedural languages are problem oriented, which means that there are procedural languages
which can be used to create programs for specific purposes. Problem with the procedural
languages is that it can be difficult to reuse code and to modify solutions when better methods of
solution are developed.
Examples include C, Pascal, COBOL, BASIC
Award one mark for any of the points (maximum 2 marks), third mark is for relevant example(s)

8. Distinguish between Low level languages and high level languages [7]
Difference between High Level Languages and Low Level Languages (maximum 7 marks)
Possible answer

High Level Language Low Level Language
1 Written in English like statements Written in 1s and 0s (machine code) or in
mnemonic codes.
2 Easier to work with Difficult to work with
3 Easier to understand Difficult to understand
4 Are problem oriented and can be used on
any computer
Machine oriented
5 Slower in execution since they need to be
first converted to machine code before
running
Faster in execution since they are in machine code
already.
6 Occupy large disk storage space on the
computer
Occupy small disk storage space on the computer
7 They are machine independent They are machine dependent
8 Extensively translated to machine code Little or no translation

Award one mark for points which tally
9. Special purpose languages
Hartzell High School

Page 5 of 5

- These are languages that are dedicated to a specific area, for instance, for running on embedded computer
systems like washing machines, mobile phones, controlling robots in a car assembly, etc. Such languages must
support real-time facilities. Give three features of special purpose languages. [3]

Possible answer
- Real-time control facilities: Programmer specifies times/frequency at which certain actions are to be
performed, e.g. taking readings after every 3 seconds for sensors. Programmers must also program timeout
if the sensor fails to take reading in the specified interval and treat this as a fault and take appropriate
action.
- Interaction with hardware interfaces: language must contain instructions to monitor devices like sensors
and control actuators.
- Ability to support concurrent programming: languages must allow two or more actions to take place at the
same time.
Award one mark for each point

Você também pode gostar