COMP233 · Section 4 · First Semester 2026/2027

Quiz 1: Paper and Worked Solutions

Chapters 2 and 3 · 100 points · 3 questions
Back to COMP233

Every question below is reproduced word for word from the paper you sat. Under each part you will find my worked solution and the marking guide used to grade it. Try each part on paper first, then open the solution and compare your steps with the marking guide.

Section
4
Covers
Chapters 2 and 3 (2.1–2.3, 3.1–3.3)
Marks
Q1: 20 · Q2: 35 · Q3: 45
Time on paper
30 minutes

Notation: ¬ is “not”; lower-case c is a contradiction (not the course set C in Q3). In marking, ~ or ∼ for ¬, and ∴ or “therefore” for a conclusion, were all accepted. Any logically equivalent answer earned full marks unless a part says otherwise.

Q1
Translation, contrapositive and negation
20 pts

Let p = “The battery is charged”, q = “The device turns on”, and r = “The device is faulty.”

Q1.a
10 pts (5 each)
Formalise each statement in symbols:
  1. A charged battery is sufficient for the device to turn on.
  2. Neither is the battery charged nor does the device turn on.
Worked solution
(i) p → q  (equivalently ¬q → ¬p)

“p is sufficient for q” means p → q: whenever the battery is charged, the device turns on.

(ii) ¬p ∧ ¬q  (equivalently ¬(p ∨ q))

“Neither A nor B” means “not A and not B”.

Marking guide (10 pts).
  • (i) 5 pts. 0 pts for q → p (direction reversed, which would be “necessary”). Full marks for any equivalent form.
  • (ii) 5 pts. 2 pts for ¬p ∨ ¬q or ¬(p ∧ q); 0 pts for other connectives.
Q1.b
10 pts (5 each)
For the proposition “If the battery is charged and the device does not turn on, then the device is faulty”, write its contrapositive and its negation in symbols. In your final answers, ¬ should apply only to single variables.
Worked solution
Statement (p ∧ ¬q) → r
Contrapositive ¬r → ¬(p ∧ ¬q)  ≡  ¬r → (¬p ∨ q)

Swap and negate both sides, then apply De Morgan’s law and double negation so that ¬ sits on single variables.

Negation ¬((p ∧ ¬q) → r)  ≡  (p ∧ ¬q) ∧ ¬r  ≡  p ∧ ¬q ∧ ¬r

The negation of A → B is A ∧ ¬B: the hypothesis holds and the conclusion fails. It is not a conditional.

Marking guide (10 pts).
  • Contrapositive, 5 pts: 3 for the correct structure ¬r → ¬(p ∧ ¬q), 2 for applying De Morgan’s law and double negation to reach ¬p ∨ q. 0 pts for the converse or inverse.
  • Negation, 5 pts: 2 for ¬((p ∧ ¬q) → r) without expansion; full marks for p ∧ ¬q ∧ ¬r. 0 pts if the negation is written as a conditional.
Q2
Truth table, simplification and rules of inference
35 pts

In Q2, p, q, r, s are statement variables; they do not carry the battery meanings from Q1.

Q2.a
15 pts
Use a complete truth table to check whether p → (q ∨ r) and (p ∧ ¬q) → r are logically equivalent. Explain your conclusion.
Worked solution

Three variables give 2³ = 8 rows. The two columns being compared are shaded.

pqrq ∨ rp → (q ∨ r)¬qp ∧ ¬q(p ∧ ¬q) → r
TTTTTFFT
TTFTTFFT
TFTTTTTT
TFFFFTTF
FTTTTFFT
FTFTTFFT
FFTTTTFT
FFFFTTFT

Conclusion. The columns for p → (q ∨ r) and (p ∧ ¬q) → r agree in every row. Both are F only in the row p = T, q = F, r = F (outlined) and T elsewhere, so the two statement forms are logically equivalent.

Marking guide (15 pts).
  • 2 pts: all eight rows of truth-value combinations.
  • 3 pts: the columns q ∨ r and p → (q ∨ r).
  • 3 pts: the columns ¬q and p ∧ ¬q.
  • 3 pts: the column (p ∧ ¬q) → r.
  • 4 pts: the conclusion stating equivalence because the two final columns are identical in every row.
Deduct 1 pt per wrong cell within a column block (minimum 0 for that block). A table with only 4 rows earns at most 5 pts in total. A conclusion with no comparison of the columns earns at most 2 of the 4 pts. If the table is missing entirely: 0 pts.
Q2.b
10 pts
Simplify (p → q) ∧ (p → ¬q) using logical equivalences. Name the law used at each step. Do not use a truth table.
Worked solution
(p → q) ∧ (p → ¬q)given
≡ (¬p ∨ q) ∧ (¬p ∨ ¬q)implication law (p → q ≡ ¬p ∨ q), applied twice
≡ ¬p ∨ (q ∧ ¬q)distributive law
≡ ¬p ∨ cnegation law (q ∧ ¬q ≡ c)
≡ ¬pidentity law (¬p ∨ c ≡ ¬p)

Final answer: (p → q) ∧ (p → ¬q) ≡ ¬p.

Marking guide (10 pts).
  • 3 pts: the implication law step.
  • 3 pts: the distributive step.
  • 2 pts: the negation law.
  • 2 pts: the identity law.
Deduct 1 pt per step whose law is not named (max −3). Other correct orders of equivalent steps were accepted. 0 pts if a truth table is used instead.
Q2.c
10 pts
From the premises p → q, q → r, ¬r, and p ∨ s, derive s using rules of inference. Give the rule and the supporting premises or steps for each derived line.
Worked solution

One valid derivation (others are acceptable):

1.p → qpremise
2.q → rpremise
3.¬rpremise
4.p ∨ spremise
5.¬qmodus tollens, 2 and 3
6.¬pmodus tollens, 1 and 5
7.selimination (disjunctive syllogism), 4 and 6

Alternative route. 5. p → r by transitivity (hypothetical syllogism) from 1 and 2; 6. ¬p by modus tollens from 5 and 3; 7. s by elimination from 4 and 6.

Marking guide (10 pts).
  • 3 pts: deriving ¬q (or p → r).
  • 3 pts: deriving ¬p.
  • 4 pts: deriving s.
Each derived line must name the rule and the lines it uses; deduct 1 pt per line with a missing or wrong rule name or missing references. 0 pts for a truth-table argument or for asserting s without steps.
Q3
Quantified statements and multiple quantifiers
45 pts
Q3.a
15 pts (5 each)
The domain is all employees of a company. Let M(x) = “x is a manager,” T(x) = “x has completed the security training,” and K(x) = “x holds a key card.” Consider:
“Every manager who has completed the security training holds a key card.”
Write in symbols: (i) the statement, (ii) its contrapositive, (iii) its negation, and also give the negation as an English sentence. ¬ should apply only to predicates.
Worked solution
(i) Statement ∀x, (M(x) ∧ T(x)) → K(x)
(ii) Contrapositive ∀x, ¬K(x) → ¬(M(x) ∧ T(x))  ≡  ∀x, ¬K(x) → (¬M(x) ∨ ¬T(x))
(iii) Negation ∃x, M(x) ∧ T(x) ∧ ¬K(x)

In English: “There is a manager who has completed the security training but does not hold a key card.” (Equivalently: some manager who completed the training has no key card.)

The negation of ∀x, A(x) → B(x) is ∃x, A(x) ∧ ¬B(x): the quantifier flips and the conditional becomes a conjunction.

Marking guide (15 pts).
  • (i) 5 pts. 2 pts if ∧ is used instead of → (∀x, M(x) ∧ T(x) ∧ K(x)); 3 pts if the hypothesis omits one of M(x), T(x).
  • (ii) 5 pts: 3 for the correct structure, 2 for De Morgan giving ¬M(x) ∨ ¬T(x). 0 pts for the converse or inverse.
  • (iii) 5 pts: 3 for the symbolic negation (must be ∃ with a conjunction; 1 pt if written ¬∀x, … without moving the negation inside), 2 for a correct English sentence. 0 pts for the symbolic part if it contains →.

For parts (b)–(d), let S be a set of students and C a set of courses, and let T(x, y) mean “student x has taken course y.”

Note: T(x, y) is a new two-place predicate, unrelated to T(x) in part (a).

Q3.b
10 pts (5 each)
Formalise, using quantifiers with the specified domains:
  1. Every course has been taken by at least one student.
  2. Some student has taken every course.
Worked solution
(i) ∀y ∈ C, ∃x ∈ S, T(x, y)
(ii) ∃x ∈ S, ∀y ∈ C, T(x, y)

Read each formula from the left: in (i) the course is chosen first and the student may depend on it; in (ii) one student is fixed first and must work for every course.

Marking guide (10 pts, 5 each). Quantifier order swapped: 2 pts. Domains missing or wrong (e.g., x ranging over C): deduct 1 pt. Both answers identical: at most 5 pts for the pair.
Q3.c
10 pts
Write the negation of statement (ii) in symbols, with ¬ moved inside so that it applies only to T(x, y). Then state the negation as an English sentence.
Worked solution
¬(∃x ∈ S, ∀y ∈ C, T(x, y))negation of (ii)
≡ ∀x ∈ S, ¬(∀y ∈ C, T(x, y))¬∃ becomes ∀¬
≡ ∀x ∈ S, ∃y ∈ C, ¬T(x, y)¬∀ becomes ∃¬

In English: “For every student there is at least one course that the student has not taken.” (Equivalently: no student has taken every course.)

Marking guide (10 pts).
  • 6 pts: the symbolic form (each quantifier flipped and ¬ on T(x, y) only). 2 pts if written as ¬∃x ∈ S, ∀y ∈ C, T(x, y) without moving ¬ inside; 3 pts if one quantifier is not flipped.
  • 4 pts: the English sentence. It must express “for every student, some course not taken”; “no student has taken any course” earns 0 for the English part.
Q3.d
10 pts
Let S = {Ali, Dana, Noor} and C = {Logic, Algebra}. The only courses taken are: Ali took Logic, Dana took Algebra, and Noor took Logic. Determine the truth value of statements (i) and (ii) from part (b), and justify each. What does this example show about whether (i) implies (ii)?
Worked solution
Has x taken y?LogicAlgebra
AliTF
DanaFT
NoorTF

(i) True. Each course has at least one student: Logic was taken by Ali (and Noor); Algebra was taken by Dana. In the table, every column contains a T.

(ii) False. No student has taken both courses: Ali and Noor have not taken Algebra, and Dana has not taken Logic. In the table, no row is all T. Equivalently, the negation from part (c) holds: for every student there is a course not taken.

Conclusion. This example makes (i) true and (ii) false, so (i) does not imply (ii). The order of ∀ and ∃ matters: ∃x ∀y is stronger than ∀y ∃x.

Marking guide (10 pts).
  • (i) 4 pts: 1 for True, 3 for naming a student for each course.
  • (ii) 4 pts: 1 for False, 3 for showing every student misses some course (or that no student has both).
  • 2 pts: stating that (i) does not imply (ii).
If your own formalisations in (b) were wrong but your evaluation is consistent with them, at most 2 pts per part.
Summary of marks. Q1.a 10 · Q1.b 10 · Q2.a 15 · Q2.b 10 · Q2.c 10 · Q3.a 15 · Q3.b 10 · Q3.c 10 · Q3.d 10. Total: 100 pts.