AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Theory of Computation
Sets and Set Notation
- 2 things to know
- Paper 1
Overview
Recall questions on what a set is, the two notations for specifying one, and the meaning of the symbols in a set comprehension.
What you need to know
Answer each one before you reveal it.
Is the set of real numbers countable? Explain the significance of the answer.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is a set?
Model answer
A set is an unordered collection in which no value appears more than once. Because it is unordered, {1, 2, 3} and {3, 1, 2} are the same set, and because each value occurs at most once, writing a value twice adds nothing.
- 2
Give the two notations for specifying a set, with an example of each.
Model answer
Either list the members between curly braces — A = {1, 2, 3, 4, 5} — or define them by a property they satisfy, which is set comprehension: A = {x | x ∈ ℕ ∧ x ≥ 1}. The second form says that A contains exactly those x for which the stated condition holds, here every natural number of at least 1. Listing suits small finite sets; comprehension is the only workable option for very large or infinite ones.
- 3
In the set comprehension A = {x | x ∈ ℕ ∧ x ≥ 1}, what does each symbol mean?
Model answer
The vertical bar | is read 'such that'. The symbol ∈ is the membership test, so x ∈ ℕ asserts that x belongs to ℕ. ℕ names the natural numbers, {0, 1, 2, 3, 4, …}. The symbol ∧ is logical AND, joining the two conditions, so x ≥ 1 imposes a second requirement: x must be at least 1. Taken as a whole, the expression denotes every x that is both a natural number and no smaller than 1 — that is, {1, 2, 3, 4, …}, with 0 excluded by the second condition.
- 4
Write in set comprehension notation the set of even natural numbers greater than 10, and list its first four elements.
Model answer
E = {x | x ∈ ℕ ∧ x > 10 ∧ x mod 2 = 0}. Read: the set of all x such that x is a natural number and x is greater than 10 and x divides exactly by 2. Its first four elements are 12, 14, 16 and 18.
- 5
How does Python let you construct a set, and what is a set comprehension in Python?
Model answer
Curly braces build a set object directly, so {1, 2, 3} is a set of three elements. A set comprehension derives a new set from an existing one by stating a rule for its members: evaluating {2 * x for x in {1, 2, 3}} yields {2, 4, 6}, each element being double the corresponding element of the original. Python describes this as a comprehension over {1, 2, 3}, and it is the programming counterpart of the mathematician's {2x | x ∈ {1, 2, 3}}.
- 6
What is the empty set, and what are the two ways of writing it?
Model answer
The empty set is the set with no elements. It is written {} or, using the alternative symbol, Ø.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Theory of Computation, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.