Question bank › GCSE › GCSE Computer Science › Programming

Data types & arithmetic operations (DIV, MOD)

10 questions43 marksabout 50 min

Answer on paper first, then reveal the mark scheme one mark at a time.

1Grade 1–34 marks

A cinema booking program stores the data below. State the most appropriate data type for each item. [4]

(a) The number of seats booked
(b) The price of a ticket, e.g. 7.50
(c) Whether the customer has paid
(d) The customer's postcode

2Grade 1–34 marks

(a) State the result of 17 DIV 5. [1]

(b) State the result of 17 MOD 5. [1]

(c) Write a Boolean expression, in AQA pseudocode, that is True when the integer variable n is even. [1]

(d) A two-dimensional array is declared as:

grid ← [[3, 8, 1], [6, 2, 9]]

State the value of grid[1][2]. [1]

3Grade 1–34 marks

In AQA pseudocode, DIV is integer division and MOD gives the remainder.

State the result of each expression.

(a) 23 DIV 4 [1]

(b) 23 MOD 4 [1]

(c) 3 DIV 5 [1]

(d) 9 MOD 3 [1]

Stuck on Data types & arithmetic operations (DIV, MOD)?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Grade 1–34 marks

A school report program stores the data shown below.

(a) State the most appropriate data type for each item. [3]

(i) A pupil's grade for one subject, which is a single letter such as B
(ii) The pupil's average mark, e.g. 67.4
(iii) The number of days the pupil was absent

(b) The program also stores each pupil's mobile phone number, such as 07700 900123. Explain why this should be stored as a string rather than an integer. [1]

5Grade 4–54 marks

A program converts a number of seconds into hours, minutes and seconds. Part of the program is shown below; two expressions are missing.

total ← USERINPUT
hours ← total DIV 3600
remaining ← total MOD 3600
minutes ← ........(i)........
seconds ← ........(ii)........
OUTPUT hours, minutes, seconds

(a) Write the two missing expressions. [2]

(b) State the three values output when the user enters 7384. [2]

6Grade 4–54 marks

The algorithm below adds together the digits of a whole number.

n ← 583
total ← 0
WHILE n > 0
   total ← total + (n MOD 10)
   n ← n DIV 10
ENDWHILE
OUTPUT total

(a) Complete the trace table to show the values of n and total at the end of each pass through the loop. [3]

Passntotal
start5830
1
2
3

(b) State the value output. [1]

7Grade 6–75 marks

A shop's till stores every amount as a whole number of pence, e.g. 1275 pence.

(a) Write an algorithm, using AQA pseudocode, that:

  • takes a whole number of pence as input from the user
  • outputs the number of whole pounds and the number of pence left over.

For example, an input of 1275 should output 12 and 75. [4]

(b) A student suggests using amount / 100 to find the number of pounds. Explain why this does not give the required result. [1]

8Grade 6–74 marks

Eight players sit in a circle in positions numbered 0 to 7. A game passes a ball using this algorithm:

position ← 5
FOR count ← 1 TO 4
   position ← (position + 3) MOD 8
   OUTPUT position
ENDFOR

(a) State the four values output. [2]

(b) Explain the purpose of MOD 8 in this algorithm. [2]

9Grade 6–74 marks

The following statements are executed.

a ← 7
b ← 2
c ← a / b
d ← a DIV b

(a) State the value and the data type of c. [2]

(b) State the value and the data type of d. [2]

10Grade 8–96 marks

A warehouse uses 4-digit product codes. A code is valid if the sum of its digits is exactly divisible by 7.

(a) State whether each of these codes is valid. Show your working. [2]

(i) 3022
(ii) 2504

(b) Write a function isValid, using AQA pseudocode, that takes an integer code as a parameter and returns True if the code is valid and False otherwise. Your function must extract the digits using DIV and MOD; it must not convert the code to a string. [4]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session