Self-Assessment Quiz: Sets
Twenty questions to check your understanding. Answer before opening the key. Aim for 16+.
Question 1
Which of the following equals $\{1, 2, 3\}$?
A) $\{1, 2, 3, 3\}$ B) $(1, 2, 3)$ C) $\{ \{1\}, \{2\}, \{3\} \}$ D) $\{1, 2\}$
Question 2
The cardinality $\lvert \{ \emptyset, \{\emptyset\}, \{1, 2\} \} \rvert$ is:
A) 0 B) 2 C) 3 D) 4
Question 3
For the set $A = \{a, \{b, c\}\}$, which statement is true?
A) $b \in A$ B) $\{b, c\} \in A$ C) $\{b, c\} \subseteq A$ D) $\lvert A \rvert = 3$
Question 4
The empty set $\emptyset$ is a subset of:
A) only itself B) only sets that contain $0$ C) every set D) no set, since it has nothing to contribute
Question 5
If $\lvert S \rvert = 5$, then $\lvert \mathcal{P}(S) \rvert$ equals:
A) 5 B) 10 C) 25 D) 32
Question 6
Which is an element of $\mathcal{P}(\{a, b\})$?
A) $a$ B) $\{a\}$ C) $(a, b)$ D) $b$
Question 7
With universe $U = \{1, \dots, 6\}$, $A = \{1, 2, 3\}$, $B = \{3, 4\}$, the set $A \setminus B$ is:
A) $\{1, 2\}$ B) $\{4\}$ C) $\{1, 2, 4\}$ D) $\{3\}$
Question 8
$A \cap B = \emptyset$ means $A$ and $B$ are:
A) equal B) complementary C) disjoint D) subsets of each other
Question 9
Which set operation corresponds to logical negation ($\neg$)?
A) union B) intersection C) complement D) Cartesian product
Question 10
The identity $\overline{A \cup B} = \overline{A} \cap \overline{B}$ is "secretly" which logical equivalence?
A) $\neg(p \land q) \equiv \neg p \lor \neg q$ B) $\neg(p \lor q) \equiv \neg p \land \neg q$ C) $p \rightarrow q \equiv \neg p \lor q$ D) $p \land (q \lor r) \equiv (p \land q) \lor (p \land r)$
Question 11
For $A = \{1, 2\}$ and $B = \{x, y, z\}$, $\lvert A \times B \rvert$ is:
A) 5 B) 6 C) 8 D) 9
Question 12
Which is true about ordered pairs and Cartesian products?
A) $(a, b) = (b, a)$ always B) $A \times B = B \times A$ always C) $(a, b) = (c, d)$ iff $a = c$ and $b = d$ D) $A \times \emptyset = A$
Question 13
To prove two sets $A$ and $B$ are equal by the element method, you show:
A) $A \cap B = \emptyset$ B) $\lvert A \rvert = \lvert B \rvert$ C) $A \subseteq B$ and $B \subseteq A$ D) $A \cup B = A$
Question 14 (True/False, justify)
True or false: A Venn diagram showing both sides of an identity shaded identically constitutes a proof of that identity. Justify in one sentence.
Question 15 (True/False, justify)
True or false: In Python, {} creates an empty set. Justify in one sentence.
Question 16
You need a set whose elements are themselves sets (for example, a power set in code). The inner sets must be:
A) list objects B) tuple objects C) frozenset objects D) dict objects
Question 17
The chief reason to choose a set over a list for membership testing is:
A) sets preserve insertion order
B) x in s is $O(1)$ average for a set vs. $O(n)$ for a list
C) sets allow duplicate elements
D) sets support indexing like s[3]
Question 18 (True/False, justify)
True or false: $A \subseteq A$ for every set $A$, but $A \subset A$ for no set $A$. Justify in one sentence.
Question 19 (Short answer)
In one sentence, state the single logical equivalence that carries all the mathematical content of a set-identity proof by the element method, and name the "bookkeeping" steps that surround it.
Question 20 (Short answer)
A feature-flag system has 20 independent on/off flags. In one sentence, explain why there are exactly $2^{20}$ possible configurations, citing the relevant theorem from §8.2.
Answer Key
| Q | Ans | Note |
|---|---|---|
| 1 | A | Duplicates collapse: $\{1,2,3,3\} = \{1,2,3\}$. B is an ordered triple; C is a set of singletons. |
| 2 | C | Three distinct elements; one happens to be a 2-element set, irrelevant to the outer count. |
| 3 | B | $\{b,c\}$ is itself one element of $A$. $b \in A$ is false; $\lvert A \rvert = 2$. |
| 4 | C | $\emptyset \subseteq B$ vacuously for every $B$ ($x \in \emptyset$ is never true). |
| 5 | D | $\lvert \mathcal{P}(S) \rvert = 2^{\lvert S \rvert} = 2^5 = 32$. |
| 6 | B | Power-set elements are subsets; $\{a\} \subseteq \{a,b\}$, but $a$ itself is not a subset. |
| 7 | A | In $A$ but not $B$: $\{1,2\}$. |
| 8 | C | Sharing no elements is the definition of disjoint. |
| 9 | C | Complement uses "$x \notin A$", i.e. $\neg(x \in A)$. |
| 10 | B | De Morgan with $p := (x\in A)$, $q := (x \in B)$: $\neg(p \lor q) \equiv \neg p \land \neg q$. |
| 11 | B | $\lvert A \times B \rvert = \lvert A\rvert\cdot\lvert B\rvert = 2 \cdot 3 = 6$. |
| 12 | C | The defining property of ordered pairs. A, B, D are all false in general. |
| 13 | C | Mutual inclusion (double containment). |
| 14 | False | A diagram shows only "generic" circles; it misses special cases (e.g. one set empty or contained in the other), so it can suggest but not prove a universal claim. |
| 15 | False | {} is an empty dict; the empty set is set(). |
| 16 | C | frozenset is immutable and hashable, so it can be an element of another set; list/set/dict are unhashable. |
| 17 | B | A set is a hash table, giving average $O(1)$ membership; a list scans in $O(n)$. |
| 18 | True | Every set contains itself ($x\in A \to x\in A$), but $A \subset A$ requires $A \ne A$, which never holds. |
| 19 | — | The named logical equivalence (e.g. De Morgan or distributivity); bookkeeping = unfolding each set operation into its connective and folding back. |
| 20 | — | Each flag is an independent yes/no choice, so configurations correspond to subsets of a 20-element set; by $\lvert \mathcal{P}(S)\rvert = 2^{\lvert S\rvert}$ there are $2^{20}$. |
Topics to review by question
| Questions | Topic |
|---|---|
| 1, 2, 3 | Roster notation, membership vs. containment, cardinality (§8.1) |
| 4, 13, 18 | Subsets, proper subsets, equality by mutual inclusion (§8.2) |
| 5, 6, 20 | Power sets and the $2^n$ theorem (§8.2) |
| 7, 8, 9 | Set operations and the universe (§8.3) |
| 10, 14, 19 | Set identities, the logic underneath, why diagrams aren't proofs (§8.3, §8.5) |
| 11, 12 | Ordered pairs and Cartesian products (§8.4) |
| 15, 16, 17 | Sets in code: set, frozenset, complexity (§8.6) |