Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Subject:
Topics:
Cambridge IGCSE Computer Science (Paper 1) Smart practice A mixed round aimed at your weak spots
Unit 1
Data representation
Unit 2
Data transmission
Unit 3
Hardware
Unit 4
Software
Unit 5
The internet and its uses
Unit 6
Automated and emerging technologies
Automated systems
Automated systems
0%
Artificial intelligence
Artificial intelligence
0%
Avg
score:
–
Topics
done:
0/39

Compilers and interpreters

Practise 28 exam-style questions on Compilers and interpreters for Cambridge IGCSE Computer Science (Paper 1). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with an AI tutor on hand if you get stuck.

  • 28 questions
  • 1–6 marks each
  • Instant marking
  • No sign-up needed
20 questions, marked as you go

Sample questions with model answers

Here are 4 of the questions in this topic, each with a model answer, an explanation of why it earns the marks and the mark scheme an examiner would use.

Question 1

1 mark

Compilers and interpreters are both translators.

State the type of programming language that they translate.

Model answer

High-level languages.

Explanation

Compilers and interpreters translate high-level languages into machine code. Assembly language, a low-level language, is translated by an assembler instead.

Mark scheme
  1. 1 mark

    High-level language

    do not accept assembly language, machine code or low-level language

Question 2

2 marks

Give two advantages of using an interpreter.

Model answer

An interpreter stops when it finds an error and shows which line it is on, so errors are easy to find. The programmer can then correct the error and run the program again straight away.

Explanation

Interpreters suit development because errors are found one at a time, exactly where they happen, and changes can be tested immediately. A common wrong answer is that interpreted programs run faster; they run more slowly.

Mark scheme
  1. 1 mark

    It stops at an error and shows where it is, so debugging is easier

    max 2

  2. 1 mark

    Errors can be corrected and the program run again straight away, without recompiling the whole program

  3. 1 mark

    A program can be run / tested before it is finished

  4. 1 mark

    The result of each line can be seen as soon as it is executed

  5. 1 mark

    The same source code can run on any computer that has an interpreter

    do not accept 'it is faster' (interpreted programs run more slowly)

Question 3

3 marks

Explain why a compiler is usually used to translate the final version of a program.

Model answer

The finished program has been debugged, so the compiler can translate it once into an executable file that is given to users. Users can run it without needing a translator, it runs faster than an interpreted program, and the source code stays private.

Explanation

Once the errors have been removed, the compiler's drawbacks during development no longer matter, and its advantages (speed, no translator needed, protected source code) all benefit the users.

Mark scheme
  1. 1 mark

    It produces an executable file that can be given to users

    max 3

  2. 1 mark

    Users do not need a translator / the source code to run the program

  3. 1 mark

    The compiled program runs faster than an interpreted one

  4. 1 mark

    The source code is not distributed, so it is protected from being copied or changed

  5. 1 mark

    The program is only translated once, not every time it is run

Question 4

4 marks

A teacher is choosing a translator for students who are learning to write their first programs in a high-level language.

Evaluate the use of an interpreter rather than a compiler for these students.

Model answer

An interpreter stops at the first error and shows which line it is on, which helps beginners find their mistakes. They can fix the error and run the program again straight away, and they can test their programs before they are finished.

Interpreted programs run more slowly and only one error is reported at a time, but the students' programs are small and are not being given to anyone else, so speed and an executable file do not matter. An interpreter is therefore the better choice for these students.

Explanation

Evaluate means weighing the benefits against the drawbacks in this context and reaching a conclusion. For learners, the interpreter's easy debugging outweighs its slower speed, which matches the syllabus point that interpreters are used during development.

Mark scheme
  1. 1 mark

    An interpreter stops at the first error and shows the line, so students can find their errors easily

    max 4; max 3 if no drawback or conclusion is given

  2. 1 mark

    Students can correct an error and run the program again immediately, without recompiling

  3. 1 mark

    Students can test parts of an unfinished program / see the result of each line

  4. 1 mark

    The slower speed of interpreted programs does not matter for small programs

  5. 1 mark

    The programs are not being distributed, so no executable file is needed

  6. 1 mark

    Drawback: only one error is reported at a time / later errors are not found until execution reaches them

  7. 1 mark

    Drawback: interpreted programs run more slowly

  8. 1 mark

    Justified conclusion, e.g. an interpreter is the better choice because easy debugging matters more than speed for beginners

Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.

AI Tutor Hints first, answers after you try

Hi! Stuck? Ask me for a hint and I’ll help you work it out. Once you’ve checked your answer I can explain exactly where the marks are.