Practise 30 exam-style questions on Programming languages and translators for AQA GCSE Computer Science (Paper 2). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with the Study Helper on hand if you get stuck.
30 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
Which statement about interpreters is true?
Choose your answer.
An interpreter calls machine code subroutines within its own code to carry out each statement
An interpreter translates assembly language into machine code
An interpreter produces an executable file of machine code
An interpreter translates the whole program before any of it is run
Model answer
An interpreter calls machine code subroutines within its own code to carry out each statement
Explanation
An interpreter does not generate machine code for the program: it analyses one statement at a time and carries it out by calling the right machine code subroutines that are part of the interpreter itself. Translating assembly language is the job of an assembler. Producing an executable file and translating the whole program before it runs are features of a compiler.
Mark scheme
1 mark
An interpreter calls machine code subroutines within its own code to carry out each statement
Mark is for AO1 (understanding). If more than one option is given, 0 marks.
Question 2
2 marks
A technician is shown two versions of the same short program for a microcontroller: one written in assembly language and one in machine code.
Describe two differences between the assembly language version and the machine code version.
Model answer
The assembly language version uses mnemonics such as ADD and LDR, whereas the machine code version is written entirely in binary. The assembly language version must be translated by an assembler before it can run, but the machine code version can be executed directly by the microcontroller's processor.
Explanation
Assembly language is a symbolic, human-readable form of machine code, so the two versions have the same instructions but look very different, and only the binary version can be executed directly. Each mark needs a different difference: saying that assembly uses mnemonics and then that machine code does not use mnemonics is one difference written twice. Similarities, such as both being low-level, do not answer the question.
Mark scheme
1 mark
assembly language uses mnemonics/abbreviations/symbols (such as ADD) // machine code is (written in) binary / 1s and 0s
All marks AO1 (understanding). Max 2. Do not award two marks for one difference and its converse, e.g. 'assembly language uses mnemonics' and 'machine code does not use mnemonics'.
1 mark
assembly language must be translated (assembled) before it can be executed // machine code can be executed directly by the processor
1 mark
assembly language is easier for humans to read/write/understand/debug (than machine code)
I. similarities, e.g. 'both are low-level' or 'both are specific to the processor' (true, but not differences).
Question 3
2 marks
State one similarity and one difference between a compiler and an assembler.
Model answer
Similarity: both a compiler and an assembler translate their input directly into machine code. Difference: a compiler translates high-level language source code, whereas an assembler translates assembly language.
Explanation
Compilers and assemblers both produce machine code that can be saved and run without the translator, which is what makes them different from an interpreter. The difference is their input: high-level code for a compiler, assembly language for an assembler - so only an assembler has the 1:1 relationship between its input and the machine code. Writing two features of one translator does not give a difference.
Mark scheme
1 mark
Similarity: both translate their input (directly) into machine code // both produce machine code that can be run without the translator // both translate the whole program before it is run
All marks AO1 (understanding). R. 'both are programs that run the code'.
1 mark
Difference: a compiler translates a high-level language but an assembler translates assembly language // a high-level statement may be compiled into several machine code instructions but each assembly language instruction becomes one machine code instruction
The difference must refer to both translators (this can be implied, e.g. 'a compiler translates high-level code, whereas an assembler does not'). R. 'an assembler translates code into assembly language'.
Question 4
4 marks
A team of eight programmers is developing a banking app. The app will be updated regularly for several years and must run on phones that use several different families of processor.
Explain two reasons why the team should write the app in a high-level language rather than in assembly language.
Model answer
High-level code is portable because it is not tied to one processor's instruction set. The team can write the source code once and translate it for each family of processor used by the phones, instead of rewriting the whole app in each processor's assembly language.
High-level code is also easier to read and understand because it uses English-like keywords and structures such as loops. This means the eight programmers can understand and change each other's code, and the app can still be updated easily by new programmers in several years' time.
Explanation
Two features of the scenario point to high-level languages: several processor families (portability) and a team updating the app for years (readability and maintainability). Each reason earns its second mark only when it is explained in that context. Speed of execution is an advantage of assembly language, so it cannot be a reason here.
Mark scheme
1 mark
high-level code is portable // is not tied to one processor's instruction set
All marks AO2 (apply). Max 4: two reasons, each with its expansion. Each expansion can only be awarded if the reason immediately before it has been awarded. Do not award two reasons for the same idea, e.g. 'easier to read' and 'easier to understand'.
1 mark
so the same source code can be translated (compiled) for each family of processor used by the phones, instead of being rewritten for each one
1 mark
high-level code is easier to read/understand (English-like keywords, structures such as selection and iteration)
1 mark
so the eight programmers can understand and work on each other's code // new programmers can update the app in later years
1 mark
high-level code is easier to debug/maintain
1 mark
which matters because the app will be updated regularly // errors in a banking app must be found and fixed quickly
1 mark
programs are quicker to write // fewer lines of code are needed // built-in functions/libraries can be used
1 mark
so new versions/features can be released sooner // development costs less
R. 'high-level programs run faster'.
Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.
Ctrl + Enter to check
Study HelperHints first, answers after you try
Stuck on this one? Ask for a hint and I’ll point you in the right direction, without giving the answer away. Once you’ve checked your answer, I’ll show you how the marks are awarded.