AQA GCSE Computer Science Paper 1 (1A), June 2025: Question 5

8 marks · Medium difficulty · Programming

Explain data types and rewrite a C# program calculating the sum of five numbers using an iteration structure.

Practise this question

Question

The question presents Figure 5 showing a C# program that reads five integers using separate Convert.ToInt32(Console.ReadLine()) lines into num1 through num5, calculates 'int total = num1 + num2 + num3 + num4 + num5;', and outputs it using 'Console.WriteLine(total);'. Question 05.1 asks to describe what is meant by a data type (1 mark). Question 05.2 asks why the variables do not have a string data type (1 mark). Question 05.3 asks for a C# data type that can represent numbers with a fractional part (1 mark). Question 05.4 asks the student to rewrite the program in C# using an iteration structure containing only one Console.ReadLine() statement, providing an indentation grid (5 marks).
Question text

05 The C# program in Figure 5 gets five numbers and outputs the sum of those

numbers.

Figure 5

int num1 = Convert.ToInt32(Console.ReadLine());

int num2 = Convert.ToInt32(Console.ReadLine());

int num3 = Convert.ToInt32(Console.ReadLine());

int num4 = Convert.ToInt32(Console.ReadLine());

int num5 = Convert.ToInt32(Console.ReadLine());

int total = num1 + num2 + num3 + num4 + num5;

Console.WriteLine(total);

05.1 An integer data type is used in the program in Figure 5.

Describe what is meant by a data type.

[1 mark]

The variables num1, num2, num3, num4 and num5 in Figure 5 have an

integer data type.

05.2 Explain why these variables do not have a string data type.

[1 mark]

05.3 The program in Figure 5 needs to be changed to use numbers with a fractional part

(a real number).

State a data type in C# that should be used.

[1 mark]

05.4 Rewrite the program in Figure 5 so that it achieves the same result but uses an

iteration structure that contains only one Console.ReadLine()statement.

*14*Your answer must be written in C#.

You should use meaningful variable name(s) and C# syntax in your answer.

The answer grid below contains vertical lines to help you indent your code.

[5 marks]

Mark scheme

Show the mark scheme Mark scheme for question 05. Part 1 awards 1 mark for specifying the type of value/data a variable stores/has, or defining the operations that can be performed. Part 2 awards 1 mark for explaining that strings would concatenate instead of add, or arithmetic operators require numeric values. Part 3 awards 1 mark for double, float, or decimal. Part 4 provides 5 marks: 1 design mark for an iteration structure, 1 mark for looping five times, 1 mark for user input inside the loop once, 1 mark for correctly calculating the running total, and 1 mark for outputting total outside the loop.

Total

Question Part Marking guidance

marks

05 1 Mark is for AO1 (recall) 1

(Specifies the) type of value/data a variable stores/has;

R. Information in place of Data

//

Defines the type of operations that can be performed on a value (stored in a

variable);

Total

Question Part Marking guidance

marks

05 2 Mark is for AO2 (apply) 1

The values would be concatenated if they were strings;

//

The values need to be added to the other values;

//

The arithmetic operator can only be used on numeric values;

Total

Question Part Marking guidance

marks

05 3 Mark is for AO2 (apply) 1

C#

Maximum of 1 mark from:

double;

float;

decimal;

Python

float;

VB.NET

Maximum of 1 mark from:

Double;

Single;

A. Decimal;

I. Case

R. Real

Total

Question Part Marking guidance

marks

05 4 1 mark for AO3 (design), 4 marks for AO3 (program) 5

Program Design

Note that AO3 (design) marks are for selecting appropriate techniques to

use to solve the problem, so should be credited whether the syntax of

programming language statements is correct or not and regardless of

whether the solution works.

Mark A for the use of an iteration structure that exists within their language;

Program Logic

Mark B for correct conditions within an iteration structure to correctly loop

five times;

Mark C for using user input once in a logically appropriate place;

Mark D for correctly calculating the total from the inputted values;

Mark E for correctly outputting total in a logically appropriate place outside

the iteration structure;

I. Case

I. Messages or no messages with input and output statements

I. Gaps/spaces throughout the code, except where to do so would explicitly

alter the logic of the code in a way that makes it incorrect.

Maximum 4 marks if any errors in code.

Note to examiners

In C#/VB.NET examples, explicit variable declarations are not shown. Refer

to the specific language type issues section of the appropriate Marking

Guidance document. Any correct variable declarations in student answers

should be accepted.

C# Example 1 (fully correct)

The design mark is achieved (Mark A)

total = 0; Part of D

num = 0; Part of C

for (i = 0; i < 5; i++) { B

num = Convert.ToInt32(Console.ReadLine()); Part of C

total = total + num; Part of D

}

Console.WriteLine(total); E

A. Write in place of WriteLine;

I. missing Console.MARKSCHEME – COMPUTER SCIENCE – – JUNE 2025

VB.NET Example 2 (fully correct)

The design mark is achieved (Mark A)

num = 0 Part of C

counter = 0 Part of B

total = 0 Part of D 19

While counter < 5 Part of B

counter = counter + 1 Part of B

num = Console.ReadLine() Part of C

total = total + num Part of D

End While

Console.WriteLine(total) E

A. Write in place of WriteLine;

I. missing Console.

How to answer it

C# Data Types, Concatenation, and Iteration Loops

📋 What this question tests

This question evaluates foundational programming principles in C# and computational thinking:

  • Data Type Definition: Explaining what a data type represents in memory and program execution.
  • String vs Numeric Operations: Understanding mathematical addition versus string concatenation ( + operator).
  • Language-Specific Types: Recalling valid C# primitive types representing real numbers (floating-point).
  • Program Refactoring & Loops: Replacing repetitive linear code with a definite count-controlled iteration loop ( for or while ) with running totals.
Question 05.1 • 1 Mark

Definition of a Data Type

Describe what is meant by a data type.

✅ Model Answer

Any one of the following:

  • It specifies the type of data / value that a variable can hold.
  • It defines the set of operations that can be performed on the data.

💡 Key Knowledge

  • A data type tells the compiler how much memory to allocate and how to interpret the binary bit pattern.
  • It dictates permissible actions (e.g. mathematical operations on integers, text manipulation on strings).

❌ Common Errors & Mark Scheme Guidance

  • Using "information" instead of "data": The mark scheme explicitly states "R. Information in place of Data" (Reject). Always write "data" or "value".
  • Giving examples instead of a definition: Stating "integer or string" scores 0 marks because it does not describe what the term itself means.
Mark Breakdown: 1 mark for identifying that it specifies the type of value/data a variable holds OR that it defines valid operations.
Question 05.2 • 1 Mark

Strings vs Integers in Arithmetic

Explain why these variables do not have a string data type.

✅ Model Answer

Any one of the following:

  • If they were strings, using + would concatenate (join) the values together rather than mathematically add them.
  • The program needs to calculate a numerical sum (perform arithmetic addition).

🧠 Exam Technique

  • Use the technical computing term: concatenate or join.
  • For example, if numbers were strings, "10" + "20" results in "1020" , not 30 .

❌ Common Errors

  • Vague answers like "because they are numbers" do not explain why string wouldn't work in this specific program. Focus on the mathematical addition required.
Mark Breakdown: 1 mark for mentioning concatenation OR that values must be added mathematically.
Question 05.3 • 1 Mark

Real / Fractional Numbers in C#

State a data type in C# that should be used for numbers with a fractional part.

✅ Acceptable Answers (Any ONE)

  • double (most common in C#)
  • float
  • decimal

💡 Key Knowledge

  • In C#, real numbers (numbers with a decimal point) are implemented as floating-point types: float (32-bit), double (64-bit), or decimal (128-bit, typically for currency).
  • C# is case-insensitive for this mark, but idiomatic C# uses lowercase keywords.

❌ Common Errors

  • Writing "Real": The mark scheme explicitly states "R. Real". "Real" is an abstract computer science concept, not a valid data type keyword in C#.
Mark Breakdown: 1 mark for double , float , or decimal .
Question 05.4 • 5 Marks

Refactoring Using Iteration (Loops) in C#

Rewrite the program using an iteration structure that contains only ONE Console.ReadLine() statement.

✅ Model Solution ( for loop)

int total = 0; for (int i = 0; i < 5; i++) { int num = Convert.ToInt32(Console.ReadLine()); total = total + num; } Console.WriteLine(total);

✅ Alternative Solution ( while loop)

int total = 0; int count = 0; while (count < 5) { int num = Convert.ToInt32(Console.ReadLine()); total += num; count++; } Console.WriteLine(total);

📐 Step-by-Step Mark Scheme Breakdown (5 Marks)

  1. Mark A (AO3 Design): Using an iteration structure that exists in the language (e.g. for , while ). Credited even if syntax has minor errors.
  2. Mark B (AO3 Logic): Correct loop conditions to run exactly 5 times (e.g. int i = 0; i < 5; i++ or 1 to 5 ).
  3. Mark C (AO3 Logic): Taking user input inside the loop using only one Console.ReadLine() .
  4. Mark D (AO3 Logic): Correct accumulator pattern: continuously calculating running total ( total = total + num; ).
  5. Mark E (AO3 Logic): Displaying the final total outside and after the loop using Console.WriteLine(total) .

❌ Common Pitfalls & Examiner Warnings

  • Initialisation trap: Forgetting to initialise total = 0 before the loop starts. Without setting it to zero, running accumulation causes a compile error.
  • Placing output inside the loop: Putting Console.WriteLine(total) inside the loop prints the subtotal 5 times, failing Mark E.
  • Off-by-one errors: Writing i <= 5 when starting from 0 causes the loop to run 6 times instead of 5.
  • Syntax cap: Any syntax errors cap the maximum achievable mark to 4 out of 5. Check braces { } and semicolons ; carefully!
Mark Breakdown: 1 Design Mark (AO3) + 4 Logic Marks (AO3) = 5 Marks.

Topics

3.2 Programming · 3.2.1 Data types · 3.2.2 Programming concepts · 3.2.3 Arithmetic operations in a programming language · 3.2.7 Input/output

Question and mark scheme from the AQA GCSE Computer Science examination, Paper 1 (1A), June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.