Past-paper question · 2015 October-November · Paper 22 · Q2(b)

Question 2(b) 2015 · October-November · Paper 22 · 3 marks

Original past-paper question for 2(B)
Original past-paper question for 2(B)
Reveal official mark-scheme answer Official mark-scheme answer for 2(B)Official mark-scheme answer for 2(B)

Official answer for Question 2

Part (b)

Part (b)

✓
IF P = 1 AND Q = 1
✓
IF P = 0 OR Q = 0
✓
THEN
✓
THEN
✓
X ← 1
✓
X ← 0
✓
ELSE
✓
ELSE
✓
X ← 0
✓
X ← 1
✓
ENDIF
✓
ENDIF
✓
Mark as follows:
✓
Structure: IF – THEN – ELSE – ENDIF
[1]
✓
Condition: P = 1 AND Q = 1
[1]
✓
Logic:
✓
X ← 1 (for TRUE)
✓
X ← 0 (for FALSE)
[1]
✓
Check carefully for:
  • other alternative correct algorithm
  • a ‘mirror copy’ of the question paper algorithm – score 0
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International AS/A Level – October/November 2015
✓
9608

Question 22

Mark scheme 9608_w15_ms_22.pdf →

Show text version of question

Question 2

Part (b)

Question 2

A program is to simulate the operation of a particular type of logic gate.

  • The gate has two inputs (0 or 1) which are entered by the user.
  • The program will display the output (0 or 1) from the gate.

The program uses the following identifiers in the pseudocode below:

Identifier Data type Description P INTEGER Input signal Q INTEGER Input signal X INTEGER Output signal

01 INPUT P 02 INPUT Q 03 IF (P = 1 AND Q = 0) OR (P = 0 AND Q = 1) OR (P = 0 AND Q = 0) 04 THEN 05 X 0 ← 06 ELSE 07 X 1 ← 08 ENDIF 09 OUTPUT X

Part (b)

The selection statement (lines 03 – 08) could have been written with more simplified logic.

Rewrite this section of the algorithm in pseudocode.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

Question 4

Topic relevance

Why this question appears here

71% assigned-topic match · Algorithm design and problem-solving › Algorithms

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_w15_qp_22.pdf

Keep practising this topic