Arithmetic, Relational & Boolean Operations (AQA GCSE Computer Science)

Exam Questions

14 mins6 questions
1a1 mark

The modulus operator is used to calculate the remainder after dividing one integer by another.

For example:

  • 14 MOD 3 evaluates to 2

  • 24 MOD 5 evaluates to 4

Identify one choice that shows the line number that contains a relational operator in the algorithm in Figure 1.

Figure 1

1 i ← USERINPUT
2 IF i MOD 2 = 0 THEN
3    OUTPUT i * i
4 ELSE
5    OUTPUT i
6 ENDIF
  • Line number 1

  • Line number 2

  • Line number 3

  • Line number 4

1b1 mark

Identify one choice to show which of the following is a true statement about the algorithm in Figure 1.

  • This algorithm uses a Boolean operator.

  • This algorithm uses a named constant

  • This algorithm uses iteration.

  • This algorithm uses the multiplication operator.

Did this page help you?

21 mark

Figure 4 shows a Python program that calculates car park charges.

The user inputs their car registration (eg MA19 GHJ) and the length of the stay. The program then outputs the charge.

  • Line numbers are included but are not part of the program.

Figure 4

1 charge = 0
2 carReg = input("Enter your car registration: ")
3 while len(carReg) > 8:
4    displayMessage = " is not valid"
5    carReg = input(displayMessage)
6 hours = int(input("Enter your stay in hours: "))
7 if hours < 2:
8    charge = 0
9 else:
10   charge = hours * 2
11 print(charge)

The charge for parking for two or more hours is changed to include an additional £2 fee.

Rewrite line 10 in Figure 4 to show this change

Your answer must be written in Python.

Did this page help you?

1a2 marks

Given the following Python code:

user_input = int(input("Enter a number: "))
if user_input % 2 == 0:
    print("The number is even.")
else:
    print("The number is odd.")

State the purpose of the modulus operator (%) and describe it’s use in this program.

1b1 mark

State the output when the user enters the number 7.

Did this page help you?

23 marks

Write a Python expression using arithmetic operators that calculates the area of a circle with radius 5.

Did this page help you?

32 marks

Look at the following Python code:

a = True
b = False
print("a and b:", a and b)
print("a or b:", a or b)

State the output of each print statement.

Did this page help you?

13 marks

Explain the difference between the modulus (MOD) and quotient (DIV) operators in pseudocode.

Provide an example where the modulus and quotient of two numbers are different.

Did this page help you?