Skip to content

Course home

Boolean operations in a programming language

Boolean operations in a programming language

EasyMedium
123456789101112131415161718
Question 8

A school registrar is writing a subroutine to determine if a student is eligible for a specific academic scholarship based on their GPA.

1   SUBROUTINE CheckScholarship(studentID, minGPA)
2       ids ← ['S101', 'S102', 'S103']
3       gpas ← [3.8, 3.2, 3.9]
4       i ← 0
5       eligible ← false
6       WHILE i < 3
7           IF ids[i] = studentID THEN
8               IF gpas[i] >= minGPA THEN
9                   eligible ← true
10              ENDIF
11          ENDIF
12          i ← i + 1
13      ENDWHILE
14      RETURN eligible
15  ENDSUBROUTINE

Lines 7 and 8 could be replaced with a single line.

Select the option that corresponds to the correct new line.

A

IF ids[i] = studentID OR gpas[i] >= minGPA THEN

B

IF ids[i] = studentID AND gpas[i] > minGPA THEN

C

IF ids[i] = studentID AND gpas[i] >= minGPA THEN

D

IF NOT (ids[i] = studentID) AND gpas[i] >= minGPA THEN

Markscheme

Boolean operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /Boolean operations in a programming language

19 exam-style questions on AQA GCSE Computer Science Boolean operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank