Question 2(a) 2015 · October-November · Paper 22 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
Part (a)
Question 1
Question 1
Question 1
Question 1
Question 2
Question 1
Question 3
Question 1
Question 4
Show text version of question
Question 2
Part (a)
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 (a)
The programmer chooses the following four test cases.
Show the output (X) for each test case.
Input Output Test case P Q X
1 1 1
2 1 0
3 0 1
4 0 0
Why this question appears here
72% assigned-topic match · Hardware › Logic gates and logic circuits
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
