Theory of computation · A level · AQA 7517 4.4.2.2 · about 20 min
Set notation and comprehension, finite and countably infinite sets, cardinality, Cartesian product, subsets, union, intersection and difference.
[1 mark]A = {3, 5, 7} and B = {a, b, c, d}. What is |A × B|?
[1 mark]A = {1, 2, 3, 4} and B = {3, 4, 5}. List A \ B (the difference), as numbers separated by commas in ascending order.
[1 mark]Which set is {2x | x ∈ ℕ ∧ x < 4}?
[1 mark]Which of these sets are countably infinite?
Tick every answer that is true.
[1 mark]A = {1, 3, 5}. Which statement is false?
[1 mark]What does this program print?
A = {1, 3, 7, 9}
B = {2, 3, 9}
print(sorted(A | B))
print(sorted(A & B))
print(len(A - B), len(B - A))Two robots patrolled the same room and logged the marker ids they saw, with repeats. Let A be the set of ids robot A saw and B the set robot B saw.
- Start from the two lists in the starter. Do not type any of the answers.
- Print exactly these eight lines, in this order. A list of ids is written in ascending order separated by single spaces:
1. A: then the members of A
2. B: then the members of B
3. union: then the members of A ∪ B
4. intersection: then the members of A ∩ B
5. A minus B: then the members of A \ B
6. pairs: then the cardinality of A × B, as a whole number
7. subset: then True or False: whether {7, 9} is a proper subset of A
8. even: then the members of {x | x ∈ A ∪ B ∧ x is even}, built with a set comprehension
For example, if A were {2, 5} the first line would be A: 2 5.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() seen_by_a = [3, 7, 1, 7, 9, 3] seen_by_b = [7, 2, 9, 9, 4]
Plan your program here, then type it in and press Run.
{x² | x ∈ ℕ ∧ x < 6} by listing its members, then check with a Python set comprehension.|A × B × C| if |A| = 3, |B| = 2 and |C| = 4? Why?{x | x ∈ ℤ ∧ x < 0} finite, countably infinite, or neither? Show how to count it off.