Back to the topic

The mark scheme starts on a new page, so you can print pages one and two for a student and keep the last page yourself. Everything prints in black on white whichever theme you are using.

AQA GCSE CS · 3.2.13

Classification of Programming Languages

Section A: 10 multiple choice questions, 10 marks. Section B: 4 written questions, 15 marks. Total 25 marks.

Name

Class

Date

Mark  / 25

Section A

Circle the letter of the correct answer. One mark each.

  1. 1What does an assembler translate?1
    1. AMachine code into assembly language
    2. BOne high level language into another
    3. CHigh level code into machine code
    4. DAssembly language into machine code
  2. 2Which is an advantage of an interpreter over a compiler?1
    1. AErrors are reported as soon as the line containing them is reached
    2. BThe program runs faster
    3. CNo translator is needed on the target machine
    4. DThe source code can be kept private
  3. 3Why is a compiled program usually faster to run than an interpreted one?1
    1. AInterpreters run on slower hardware
    2. BTranslation has already been done, so the machine code runs directly
    3. CCompiled programs use less memory in every case
    4. DCompilers optimise the algorithm for you
  4. 4Which of these is a reason to write part of a program in a low level language?1
    1. ADirect control of specific hardware is needed
    2. BThe program must be written quickly
    3. CThe code needs to be portable
    4. DThe programmer wants automatic memory management
  5. 5What is machine code?1
    1. AA high level language with short keywords
    2. BThe output of an interpreter
    3. CThe binary instructions a processor executes directly
    4. DAnother name for assembly language
  6. 6Why is a high level program more portable than a low level one?1
    1. AIt is shorter
    2. BIt can be translated for any processor that has a suitable translator
    3. CIt uses less memory
    4. DPortability depends only on the operating system
  7. 7A compiled program is distributed without its source code. Why is this an advantage for the developer?1
    1. AThe developer's work cannot be read or copied directly
    2. BIt removes the need for testing
    3. CErrors are reported line by line
    4. DThe program runs on more platforms
  8. 8Which statement about one line of high level code is correct?1
    1. AIt runs directly on the processor
    2. BIt always translates into exactly one machine code instruction
    3. CIt usually translates into many machine code instructions
    4. DIt cannot be translated at all
  9. 9Where would an assembly language most likely be used today?1
    1. AIn a word processor's spell checker
    2. BIn a school database
    3. CIn a device driver that must access hardware registers directly
    4. DIn a website's front end
  10. 10What happens to errors when a program is compiled?1
    1. AThey are ignored until the program is run
    2. BThey are corrected automatically
    3. CThey are reported one at a time as each line runs
    4. DThey are all reported together at the end of compilation

Section B

Answer in the space provided. The number of marks tells you how many separate points to make.

  1. 1StateState one difference between a high level language and a low level language.2
  2. 2ExplainExplain two advantages of using a compiler rather than an interpreter to translate a finished program.4
  3. 3ExplainA programmer is developing and testing a new program. Explain why they might prefer an interpreter during this stage.3
  4. 4DiscussA company is writing software to control a washing machine, which has a very small amount of memory. Discuss whether they should use a high level or a low level language.6

Mark scheme

Section A

1D2A3B4A5C6B7A8C9C10D

Section B

1 State one difference between a high level language and a low level language. 2

One mark for each of the following, to a maximum of 2.

  • A high level language is close to human language and easier to read
  • A low level language is close to the hardware, and one instruction does very little

Model answer. A high level language is written in a form close to human language, so it is easier to read and one statement performs a substantial amount of work. A low level language is close to the hardware, so each instruction does very little and the code is written for one particular processor.

2 Explain two advantages of using a compiler rather than an interpreter to translate a finished program. 4

One mark for each of the following, to a maximum of 4.

  • Translation happens once before the program runs
  • So the compiled program executes faster than an interpreted one
  • The program can be distributed as an executable without the source code
  • No translator is needed on the machine that runs the program

Model answer. The first advantage is speed of execution. A compiler translates the whole program into machine code once, before it is ever run, so at run time the processor executes machine code directly with no translation happening at all. An interpreter has to translate each line every time it is reached, including every pass round a loop, which is considerably slower. The second advantage is distribution. The compiled executable can be given to users without the source code, which protects the developer's work and means the user does not need a translator installed on their own machine.

3 A programmer is developing and testing a new program. Explain why they might prefer an interpreter during this stage. 3

One mark for each of the following, to a maximum of 3.

  • An interpreter translates and runs one statement at a time
  • It stops and reports an error as soon as the line containing it is reached
  • So the fault is easy to locate and the program can be re-run quickly after a change

Model answer. An interpreter translates and executes one statement at a time, so when it meets a line it cannot process it stops there and reports the problem. That tells the programmer exactly where the fault is, rather than presenting a list of errors after a full compilation. It also means a small change can be tested immediately by running the program again, with no compilation step in between, which makes the write, test, correct cycle much faster while the program is still being developed.

4 A company is writing software to control a washing machine, which has a very small amount of memory. Discuss whether they should use a high level or a low level language. 6

One mark for each of the following, to a maximum of 6.

  • A low level language gives direct control over the hardware
  • Low level code can be made very small and memory efficient
  • Low level code is slow to write and hard to read or maintain
  • A high level language is faster to develop in and easier to maintain
  • But a high level program is generally larger and gives less direct hardware control
  • Reaches a justified conclusion for this specific situation

Model answer. A low level language has two real advantages here. It gives direct control over the specific hardware in the machine, which matters when the software must operate motors, valves and sensors precisely, and it allows the finished code to be made extremely small, which matters when the memory available is measured in kilobytes. The cost is development. Low level code takes far longer to write, is much harder to read, and is tied to one processor, so moving to a different controller later would mean rewriting rather than recompiling. A high level language reverses all of that: development is quick, the code is readable and maintainable, and it can be recompiled for different hardware, but the compiled program is generally larger and the programmer has less direct control over what the processor does. For a washing machine controller, where memory is severely limited, the hardware is fixed and the program is small and unlikely to change often, the low level route is defensible. In practice most manufacturers take a middle path: write the bulk of the program in a high level language such as C so it stays maintainable, and drop into assembly only for the few routines that must be tightly optimised or must touch the hardware directly.