Pearson Edexcel GCSE (9-1) · Computer Science (1CP2)

Develop code: Practice Questions

5 multiple-choice questions marked as you go, and 4 written questions with worked solutions. All on Develop code.

9 questions30 marksFree, no account
Question 1
1 mark

Which of the following describes the benefit of using meaningful identifiers when writing a program?

Question 2
1 mark

A student writes a program to calculate the average of three numbers but accidentally uses the formula avg = a + b + c / 3. What type of error is this?

Question 3
1 mark

A developer is using abstraction to design a flight simulator. Which of the following would be an example of applying abstraction in this context?

Question 4
1 mark

A programmer wants to make their Python code easier for others to understand. Which of these techniques uses non-executable text to describe what a specific section of the code does?

Question 5
1 mark

Consider the following pseudocode segment:

x = 10
y = 5
IF x > y THEN
  x = x - y
ELSE
  y = y - x
ENDIF

What is the final value of x?

Question 6
5 marks

A developer is refining a program to make it more maintainable. Identify two techniques mentioned in the specification that improve code readability.

Write your answer out first, then check it against the worked solution.

Question 7
5 marks

A program crashes when a user enters a string instead of a number. Identify the type of error and suggest a technique to prevent it.

Write your answer out first, then check it against the worked solution.

Question 8
7 marks

A developer needs to create a program that manages a 2D array representing a 3x3 grid for a game.

(a) Write a code statement to initialize a 3x3 2D array named grid with the character "X" in all positions.
(b) Explain how to access the element in the second row and third column.
(c) Write a nested loop structure to print all elements of the 2D array to the screen.

Write your answer out first, then check it against the worked solution.

Question 9
8 marks

A robot moves on a coordinate plane. It starts at \((0,0)\). It receives a list of commands: "N", "S", "E", "W".

(a) Create an algorithm using a case/switch selection or nested IFs to update x and y coordinates based on a variable cmd.
(b) Use a loop to process a list of commands: ["N", "N", "E", "S"]. Show the final values of x and y.
(c) Explain how decomposition was used to solve this problem.

Write your answer out first, then check it against the worked solution.

* The content provided by thinka is generated by AI and may not always be accurate or up-to-date. Please use it as a supplementary resource and verify with official materials.

You've seen the model answer. Now get yours marked.

This page can show you how a good answer looks. It cannot tell you what your answer was missing. thinka marks your written work against the real mark scheme in about 15 seconds.

Want more questions like these? Get a fresh set on this topic, marked as you go.

Practise More