Menu

Edexcel GCSE Computer Science (1CP2) Exam Questions

Build a practice paper from 514 exam-style questions, each with its mark scheme and example answers. Print it, or answer it on paper and then open the mark schemes. Or browse the questions by topic.

Build a paper

Topics (none ticked: all of them)
Question types (none ticked: all of them)

Practice paper

9 questions · 23 marks

Pick again
Print
1Short recall1 markTranslators Swap Remove

An interpreter translates high-level code.

State what happens to the translation of a program when an interpreter finds a syntax error.

[1 mark]
Mark scheme

Award one mark for any of the following:

  • Translation/execution stops (when the error is found) / the rest of the program is not translated/executed (1)

Allow stops/terminates/halts when the error is found

Do not accept shows/displays an error message on its own

Do not accept the whole program is translated and errors are reported at the end

Do not accept translates line by line on its own

Example answers and how they were marked
Full marks1/1

The translation stops as soon as the error is found, so the rest of the program is not translated.

Why: Translation stops when the error is found (1).

No marks0/1

An error message is displayed.

Why: Only an error message; it does not say translation stops, and the scheme does not accept a displayed error message on its own.

No marks0/1

The whole program is translated and all the errors are reported at the end.

Why: Describes a compiler; the scheme does not accept errors being reported at the end of translating the whole program.

2Short recall1 markLow and High Level Languages Swap Remove

A high-level language uses statements that look like English or maths.

State what a single statement in a high-level language is usually translated into.

[1 mark]
Mark scheme

Award one mark for:

  • Several/multiple machine code instructions (1)

The answer must refer to instructions.

Do not accept machine code on its own.

Do not accept binary on its own.

Do not accept 'one or more machine code instructions' as it does not show that one statement becomes several instructions.

Do not accept assembly code/compiled code/low-level code on their own.

Do not accept 'a line of code'/'a statement' as this repeats the question.

Example answers and how they were marked
Full marks1/1

Several machine code instructions

Why: Matches the creditworthy point that one high-level statement translates into several machine code instructions (1).

No marks0/1

Machine code

Why: Near-miss: gives the type of code but not that one statement becomes several instructions; mark scheme does not accept machine code on its own.

No marks0/1

Binary

Why: Misconception: high-level statements are translated into machine code instructions, not just binary; not accepted.

3Short recall2 marksLow and High Level Languages Swap Remove

Programs written in a high-level language are often machine independent.

Define the term machine independence.

[2 marks]
Mark scheme

Award one mark for any of the following up to a maximum of two marks:

  • The (same) program/source code can run on different types/makes of computer/processor (1)
  • With few/no changes (to the program code) (1)
  • The same source code can be translated for each type of processor (1)
  • A different compiler/interpreter is used for each type of processor (1)
  • The program does not depend on one specific type of processor/hardware (1)
  • Only one version of the program needs to be written/kept (1)
  • The program is portable between different computers (1)

Allow 'different computers' as meaning different types of computer/processor.

Do not accept a program that will only run on one type of computer / the computer it was written on.

Do not accept written in machine code/binary, is translated into machine code, compiled/interpreted, is a low-level language.

Example answers and how they were marked
Full marks2/2

The same program can run on different types of computer (1) without being changed (1).

Why: Two creditworthy parts: runs on different types/makes of computer/processor (1); with few/no changes (1).

Some marks1/2

A program can run on different computers.

Why: Creditworthy point: can run on different types/makes of computer/processor (1), with 'different computers' allowed by the guidance. No second part about changes or translation.

No marks0/2

A program is written in machine code so the computer can understand it.

Why: Misconception: machine code is not machine independence; the mark scheme does not accept this, and no other creditworthy point is given.

4Short recall1 markTranslators Swap Remove

A compiler translates a whole program in one go before it is run.

Name the type of code that a compiler produces.

[1 mark]
Mark scheme

Award one mark for any of the following:

  • Object code (1)
  • Machine code (1)
  • Executable code / an executable (1)

Allow object file.

Do not accept source code.

Do not accept high-level code.

Example answers and how they were marked
Full marks1/1

Object code.

Why: Object code is named as the code a compiler produces (1).

No marks0/1

High-level code.

Why: Near-miss: this is the input to the compiler, not the code it produces; not accepted.

No marks0/1

Source code.

Why: Names the programmer's input rather than the compiler's output; not accepted.

5Describe2 marksTranslators Swap Remove

A compiler and an interpreter both translate source code.

Describe one difference between what a compiler produces and what an interpreter produces.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • A compiler produces object code/machine code/an executable (file) (1) whereas an interpreter produces no object code/translated file (1)
  • A compiler produces a machine code file (1) that can be run on its own/without the compiler/translator being present (1)
  • An interpreter produces no object code/file (1) because it translates and executes each line instead of saving translated code (1)
  • The compiler's output can be saved/stored (1) and run again later, while interpreted code has to be translated again each time it is run (1)

Allow binary for machine code.

Allow executable/an executable for object code.

Do not accept responses about translating the whole program, reporting errors or the speed of execution.

Do not accept 'the interpreter translates/executes one line at a time' on its own: this is how it translates, not what it produces. It earns the development only when linked to no object code/translated file being produced.

Do not accept the interpreter producing object code/an executable.

Example answers and how they were marked
Full marks2/2

A compiler produces object code, which is saved as a file, whereas an interpreter does not produce a file because it translates and executes each line.

Why: Compiler produces object code (1) contrasted with the interpreter producing no object code/translated file (1).

Some marks1/2

The compiler produces machine code.

Why: Machine code/object code produced (1); there is no contrast with the interpreter, so the development is not earned.

No marks0/2

The interpreter produces object code for each line it translates.

Why: Reverses the translators' outputs: the interpreter produces no object code, so nothing is creditworthy.

6Explain2 marksTranslators Swap Remove

A programmer writes a program in a high-level language. The program is translated by a compiler.

Explain why a compiler must translate the whole program before any of it can be executed.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The compiler produces object code/machine code for the whole program (1) so there is no complete executable until every line has been translated (1)
  • The compiler translates all the source code before producing the object code (1) so the program cannot start until translation has finished (1)
  • The compiler checks the whole program for errors during translation (1) so all of the source code must be read before an executable can be produced (1)

For both marks, the expansion must follow/associate with the statement.

Allow 'in one go'/'all at once' for the translation point, but this does not earn the second mark unless it is linked to why the program cannot be executed until translation has finished.

A statement that the whole program is translated, with no linked reason about when the program can be executed, earns 1 mark only.

Do not accept 'a compiler is faster' or 'compiled code runs faster' on its own; this does not explain why translation must finish before execution.

Do not accept 'it translates and runs the program one line at a time', as this describes an interpreter.

Example answers and how they were marked
Full marks2/2

A compiler produces object code for the whole program, so there is no complete executable until every line has been translated.

Why: Object code for the whole program (1) linked to there being no complete executable until every line is translated (1).

Some marks1/2

A compiler translates the whole program in one go.

Why: Translation of the whole program only (1); no linked reason about when the program can be executed, so the second mark is not awarded.

No marks0/2

A compiler translates and runs the program one line at a time, so it stops when it finds an error.

Why: Confuses a compiler with an interpreter; nothing about translating the whole program before execution, so no creditworthy point.

7Explain2 marksLow and High Level Languages Swap Remove

A programmer writes the same program in a low-level language and in a high-level language.

Explain one reason why the program written in the low-level language may run faster.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The programmer can choose the most efficient instructions/registers to use (1) so the program completes its task in fewer steps (1)
  • The programmer can optimise the code for the processor (1) because low-level instructions give direct control of registers/memory (1)
  • Each low-level instruction maps to one machine code instruction (1) so fewer instructions are executed than for the equivalent high-level code (1)
  • The translated code is smaller (1) so fewer instructions are fetched from memory and executed (1)

For both marks, the expansion must follow/associate with the statement.

Do not accept 'it is low-level' / 'it is closer to machine code' / 'low-level code is faster' on its own without a reason why it makes the program run faster.

Do not accept 'high-level code has to be translated' / 'high-level code is interpreted' on its own without saying why that makes the program slower.

Do not accept 'the code is smaller' on its own without saying that this means fewer instructions are fetched/executed.

Do not accept 'it is easier to write' or 'quicker to type' as a reason for faster execution.

Example answers and how they were marked
Full marks2/2

The programmer can choose the most efficient instructions and registers to use (1) so the program completes its task in fewer steps (1).

Why: Linked point (1) of choosing efficient instructions/registers and reason (1) that the task is completed in fewer steps, so it runs faster.

Some marks1/2

Each low-level instruction maps to one machine code instruction (1) so the program is shorter to type.

Why: Point (1) that one low-level instruction maps to one machine code instruction, but being shorter to type does not explain why the program runs faster, so no second mark.

No marks0/2

Because it is closer to machine code.

Why: 'Closer to machine code' alone gives no reason why that makes the program run faster, and the mark scheme does not accept it on its own.

8Discuss6 marksLow and High Level Languages Swap Remove

A software company is writing a new program that will be sold to users who have different types of computer. The program does not need to control the hardware of the computer directly. The company must decide whether to write the program in a high-level language or a low-level language.

Discuss whether the company should use a high-level language or a low-level language to write this program.

Your answer should consider:

  • machine independence
  • processor specificity
  • how the code is translated for each type of computer.
[6 marks]
Mark scheme

Indicative content

Machine independence

  • A high-level language is machine independent, so the same source code can be run on different types of computer with few or no changes.
  • The company can write the program once and sell it to users with different computers, without rewriting the code for each type of computer.
  • Only one version of the program needs to be written and maintained, so development takes the company less time.

Processor specificity

  • A low-level language is processor-specific, so a program written for one processor will not run on a different processor without being rewritten.
  • Assembly language instructions depend on the instruction set of the particular processor, so the company would need a separate version of the program for each type of computer.
  • Writing a separate low-level version for every type of computer would take the company much longer than writing one high-level program.
  • Low-level code gives direct control of the hardware of one processor, so it is better suited to device drivers than to a program that must run on many different computers.

Translation

  • High-level source code is translated for each type of computer by a compiler or an interpreter, so one version of the source code is enough for all the users.
  • Assembly language is translated into machine code by an assembler, and the assembler produces machine code for one specific processor only.
  • Machine code is already in a form that one particular processor can execute directly, but the same machine code will not run on a different processor.
  • Each high-level statement translates into several machine code instructions, so the programmer does not need to know the instruction set of the processor.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)

Additional guidance

  • Level 3 responses must cover both high-level machine independence and low-level processor specificity, with the effect on the company's decision.
  • Do not award low-level language, assembly language or machine code as portable, or 'high-level languages are written in English/like English' as a reason for machine independence.
Example answers and how they were marked
Full marks6/6

A high-level language is machine independent, so the company can write the program once and it will run on different types of computer with few or no changes. A different compiler is used for each type of processor to translate that same source code into the machine code for that computer, so the company can sell one program to all of its users. A low-level language is processor-specific, so a program written in assembly for one processor will not run on a different one. The assembler produces machine code for one particular instruction set, so the company would need to write a separate version for each type of computer, which would take much longer. As the program does not need to control the hardware directly, the company should use a high-level language.

Why: Develops high-level machine independence with the compiler translating for each processor, and low-level processor specificity with the assembler producing machine code for one instruction set, both applied to the company's decision, in a coherent and sustained argument: Level 3, 6 marks.

Some marks3/6

A high-level language is machine independent, so the company can write the program once. A different compiler is used for each type of computer to translate the code, so users with different computers can all run the same program. A low-level language is processor-specific, so it would not be as suitable for the company.

Why: Machine independence is linked to the compiler and applied to the users, but processor specificity is only asserted and no translation of low-level code is given, so the reasoning is not sustained: Level 2, 3 marks.

Some marks1/6

High-level languages are machine independent because they are written in English, so the company can sell the program to anyone. Low-level languages are machine code, so they can be translated to run on any type of computer.

Why: One basic point that high-level languages are machine independent, applied by selling to anyone (1). 'Written in English' is not a reason for machine independence and low-level code is not portable, so neither is credited: Level 1, 1 mark.

9Discuss6 marksTranslators Swap Remove

A student is writing a program in a high-level language. The student runs the program after every small change to check that it works.

Discuss whether the student should use an interpreter or a compiler while writing and testing the program.

Your answer should include:

  • how each translator deals with a syntax error
  • how much of the program is translated at a time
  • how this affects the student's testing.
[6 marks]
Mark scheme

Indicative content

How each translator deals with a syntax error

  • An interpreter stops as soon as it finds a syntax error and displays an error message.
  • With an interpreter, the lines before the error have already been executed, so the student can see how far the program got before it stopped.
  • A compiler reports errors at the end of translation, so the student gets a list of all the syntax errors in the program in one go.

How much of the program is translated at a time

  • An interpreter translates one line at a time and executes each line immediately.
  • A compiler translates the whole program in one go before any of it is run.
  • A compiler produces object code, so after every change the whole program must be compiled again before the student can run it.
  • An interpreter produces no object code, so the student does not have to wait for the whole program to be translated before it runs.

How this affects the student's testing

  • An interpreter suits this student because the program can be run straight away after each small change.
  • The interpreter stops at the first error found, so the student fixes that error and runs the program again, but may only find the next error on the next run.
  • Reporting every error at the end of compilation means the student can fix several errors at once, but cannot run the program until the whole program compiles.
  • The student should use an interpreter while testing, and compile the finished program once it works.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)

Level 3 responses must relate the way each translator works to the student's testing, not just describe the two translators.

Do not accept answers about run-time or logic errors where no comparison of the translators is made.

Example answers and how they were marked
Full marks6/6

The student should use an interpreter while testing. An interpreter translates one line at a time and executes each line straight away, so as soon as the student has made a small change the program can be run without waiting for the whole program to be translated. If there is a syntax error, the interpreter stops at that line and displays an error message, and the lines before it have already been executed, so the student knows exactly where the problem is. A compiler translates the whole program in one go and only reports the errors at the end, so the student would get a list of all the syntax errors, but could not run any of the program until the whole program compiled successfully.

Why: Explains how each translator deals with a syntax error, how much is translated at a time (one line executed immediately against the whole program at once) and links both to the student's testing, with a conclusion. Level 3.

Some marks4/6

An interpreter translates one line at a time and stops when it finds an error, so the student can see where the error is. A compiler translates the whole program and reports all the errors at the end. The interpreter is better for testing because the student can run the program straight away after a change.

Why: Adequate: correct points about error reporting and one line at a time, with a recommendation, but the effect on testing is only asserted rather than reasoned through, so the linkage is not sustained. Level 2.

Some marks1/6

The student should use a compiler because it translates the program one line at a time and stops at the first error, which makes testing quicker.

Why: The roles of the two translators are reversed, so the answer only makes a basic point about testing more quickly. Level 1.

Questions by topic

More ways to revise Edexcel GCSE Computer Science (1CP2)

Teachers: build a paper, print it with the mark schemes at the end, and sign your school up to set your classes activities on every topic.

Fetch Decode Explain isn't affiliated with or endorsed by Pearson Edexcel.