Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Course:
Topics:
AQA GCSE Computer Science (Paper 1) Smart practice A mixed round aimed at your weak spots
Unit 1
3.1 Fundamentals of algorithms
Unit 2
3.2 Programming
Data types
Data types
Arithmetic operations in a programming language
Arithmetic operations, DIV and MOD
Relational operations in a programming language
Relational operations
Boolean operations in a programming language
Boolean operations in conditions
Data structures
Arrays and records
Input/output
Input and output
String handling operations in a programming language
String handling
Random number generation in a programming language
Random number generation
Structured programming and subroutines (procedures and functions)
Subroutines and structured programming
Avg
score:
–
Topics
done:
0/15

Arithmetic operations, DIV and MOD

Practise 30 exam-style questions on Arithmetic operations, DIV and MOD for AQA GCSE 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 the Study Helper on hand if you get stuck.

  • 30 questions
  • 1–8 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

The pseudo-code statement below is run.

x ← 20 / 8

State the value stored in x.

Model answer

2.5

Explanation

The / operator in AQA pseudo-code is real division, so the result keeps its fractional part: 20 / 8 = 2.5. Integer division would need DIV, which gives 2, and the remainder (4) would need MOD.

Mark scheme
  1. 1 mark

    2.5

    Mark is for AO2 (apply). A. 2.50 R. 2 (this is 20 DIV 8). R. 4 (this is 20 MOD 8). A correct answer with no working scores the mark.

Question 2

2 marks

A garden light show runs for 20 seconds. The algorithm below outputs the seconds at which the lights flash blue.

FOR t ← 1 TO 20
  IF t MOD 6 = 2 THEN
    OUTPUT t
  ENDIF
ENDFOR

State all the values output by the algorithm, in order.

Model answer

2, 8, 14, 20

Explanation

The condition is True when t leaves a remainder of 2 after dividing by 6, which happens every 6 seconds starting at 2: 2, 8, 14 and 20. 2 MOD 6 is 2 because 6 goes into 2 zero times, so 2 is output too. Common mistakes are to start at 8 or to give the multiples of 6 (6, 12, 18).

Mark scheme
  1. 1 mark

    8 and 14 output

    Both marks AO2 (apply).

  2. 1 mark

    2 and 20 also output, with no other values (2, 8, 14, 20)

    R. If 6, 12 or 18 (or any other value) is also given.

Question 3

3 marks

A running app records the time of a run as a whole number of seconds. The pseudo-code below should output the time as minutes and then seconds. For example, if the user enters 500, it should output 8 and then 20.

Two expressions have been replaced by the labels A and B.

totalSeconds ← USERINPUT
minutes ← A
seconds ← B
OUTPUT minutes
OUTPUT seconds

State the expressions that should replace the labels A and B.

State the two values output by the completed algorithm when the user enters 754

Model answer

A: totalSeconds DIV 60
B: totalSeconds MOD 60
Outputs when 754 is entered: 12 then 34

Explanation

There are 60 seconds in a minute, so DIV 60 gives the number of whole minutes and MOD 60 gives the seconds left over. For 754 seconds, 754 DIV 60 = 12 (12 × 60 = 720) and 754 MOD 60 = 34. Using / instead of DIV would give 12.566..., which is not a whole number of minutes.

Mark scheme
  1. 1 mark

    A: totalSeconds DIV 60

    Marks for A and B are AO3 (program). A. Equivalent code in C#, Python or VB.NET, e.g. totalSeconds // 60 (Python), totalSeconds \ 60 (VB.NET). I. Case. R. totalSeconds / 60 (real division gives 12.566... for 754).

  2. 1 mark

    B: totalSeconds MOD 60

    A. totalSeconds - minutes * 60. A. totalSeconds % 60 (C# or Python), totalSeconds Mod 60 (VB.NET).

  3. 1 mark

    12 and 34 (in this order)

    AO2 (apply). Both values are needed for the mark. Award this mark even if the answers for A or B are wrong. Correct values with no working score this mark.

Question 4

4 marks

An exam hall numbers its desks from 0. Each row has 12 desks: row 0 holds desks 0 to 11, row 1 holds desks 12 to 23, and so on. The position of a desk within its row is also numbered from 0, so desk 13 is in row 1 at position 1.

The variable deskNo holds a desk number.

Write an assignment statement to calculate row, the row number of the desk, and an assignment statement to calculate position, the position of the desk in its row. You may use pseudo-code or program code.

State the row and the position of desk 30.

Model answer

row ← deskNo DIV 12
position ← deskNo MOD 12
Desk 30: 30 DIV 12 = 2, so it is in row 2; 30 MOD 12 = 6, so it is at position 6.

Explanation

Each row holds 12 desks, so the number of complete rows before a desk is deskNo DIV 12, which is its row number, and what is left over, deskNo MOD 12, is its place in that row. For desk 30, two full rows (24 desks) come before it and it is 6 places further on. Using / would give 2.5, which is not a row number.

Mark scheme
  1. 1 mark

    row ← deskNo DIV 12

    First two marks AO3 (program). A. Equivalent code in C#, Python or VB.NET, e.g. row = deskNo // 12 (Python), row = deskNo / 12 with integers (C#), row = deskNo \ 12 (VB.NET). I. Case. R. deskNo / 12 in pseudo-code, Python or VB.NET (real division).

  2. 1 mark

    position ← deskNo MOD 12

    A. position ← deskNo - row * 12. A. deskNo % 12 (C# or Python), deskNo Mod 12 (VB.NET).

  3. 1 mark

    Row: 2

    Last two marks AO2 (apply). Award these marks even if the statements are wrong. R. 2.5. Correct values with no working score these two marks.

  4. 1 mark

    Position: 6

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

Study Helper Hints 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.