Self-Assessment Quiz: Functions

Twenty questions to check your grip on functions, their properties, composition, and inverses. Answer before opening the key. Aim for 16+.


Question 1

A function $f\colon A \to B$ is, formally, a subset of $A \times B$ such that:

A) every $b \in B$ pairs with exactly one $a \in A$ B) every $a \in A$ pairs with exactly one $b \in B$ C) every $a \in A$ pairs with at least one $b \in B$ D) no two elements of $A$ pair with the same $b \in B$

Question 2

The phrase "exactly one output per input" encodes two conditions. They are:

A) injectivity and surjectivity B) totality (at least one) and single-valuedness (at most one) C) commutativity and associativity D) domain equals codomain, and range equals codomain

Question 3

For $f\colon \mathbb{R} \to \mathbb{R}$, $f(x) = x^2$, the codomain and the range are:

A) both $\mathbb{R}$ B) codomain $[0,\infty)$, range $\mathbb{R}$ C) codomain $\mathbb{R}$, range $[0,\infty)$ D) both $[0,\infty)$

Question 4

The notation $f^{-1}(T)$ for a set $T \subseteq B$ denotes:

A) the inverse function applied to $T$, which exists only if $f$ is bijective B) the set of all inputs whose output lies in $T$ — defined for every function C) the complement of $f(T)$ D) the image of $T$ under $f$

Question 5

A function $f$ is injective exactly when:

A) every codomain element is hit B) $f(a_1) = f(a_2)$ implies $a_1 = a_2$ (no collisions) C) the range equals the codomain D) $f$ has an inverse function

Question 6

A function $f\colon A \to B$ is surjective exactly when:

A) distinct inputs give distinct outputs B) $\operatorname{range}(f) = B$ (nothing is missed) C) $\lvert A \rvert = \lvert B \rvert$ D) $f$ is also injective

Question 7

In the composition $g \circ f$, the function applied to the input first is:

A) $g$ B) $f$ C) whichever is injective D) they are applied simultaneously

Question 8 (True/False, justify)

True or false: Function composition is commutative — $g \circ f = f \circ g$ for all $f, g$ for which both are defined. Justify in one sentence.

Question 9

The central theorem of the chapter states that a function $f\colon A \to B$ is invertible if and only if it is:

A) injective B) surjective C) bijective D) total

Question 10

In the proof that bijectivity implies invertibility, surjectivity supplies _ and injectivity supplies ___ of the inverse's value $g(b)$:

A) uniqueness; existence B) existence; uniqueness C) totality; surjectivity D) commutativity; associativity

Question 11

$\lfloor -3.4 \rfloor$ equals:

A) $-3$ B) $-4$ C) $3$ D) $4$

Question 12 (True/False, justify)

True or false: For all real $x$, $\lfloor x \rfloor$ equals $x$ with its decimal part chopped off ("truncation"). Justify in one sentence.

Question 13

Paginating $n = 47$ items at $10$ per page requires how many pages, and which function expresses it?

A) $\lfloor 47/10 \rfloor = 4$ B) $\lceil 47/10 \rceil = 5$ C) $47 \bmod 10 = 7$ D) $\lfloor 47/10 \rfloor = 5$

Question 14

Why must a hash function from all 64-bit integers into a 256-slot table have collisions?

A) hash functions are poorly designed B) the domain ($2^{64}$ values) is far larger than the codomain (256), so no injection exists C) modular arithmetic is not deterministic D) it actually need not have collisions if the hash is good

Question 15

Which property of a function makes lossless compression possible (so the file can always be recovered)?

A) surjectivity B) injectivity C) idempotence D) commutativity

Question 16

A pure function in programming corresponds to which mathematical idea?

A) a surjection B) a function in the §9.1 sense — output depends only on inputs (well-defined), with an output for every input (total) C) an inverse function D) the identity function

Question 17 (True/False, justify)

True or false: The function $x \mapsto x \bmod n$ from $\mathbb{Z}$ onto $\{0,1,\dots,n-1\}$ is surjective but not injective. Justify in one sentence.

Question 18

The mod, exponential, and log functions: which pair are inverse bijections of each other on their natural domains?

A) floor and ceiling B) $x \bmod n$ and $x \cdot n$ C) $b^{(\cdot)}\colon \mathbb{R} \to (0,\infty)$ and $\log_b\colon (0,\infty) \to \mathbb{R}$ D) $x^2$ and $\sqrt{x}$ on all of $\mathbb{R}$

Question 19 (Short answer)

State the two proof templates from §9.3 in one line each: how do you prove injectivity, and how do you prove surjectivity?

Question 20 (Short answer)

In one sentence, explain why the same rule $x \mapsto 2x$ can be a non-surjective function onto $\mathbb{Z}$ but a bijective function onto the even integers — i.e., why classification depends on more than the rule.


Answer Key

Q Ans Note
1 B A function pairs each input with exactly one output (the "exactly one" rule).
2 B "At least one" = totality; "at most one" = single-valuedness.
3 C Codomain is the declared $\mathbb{R}$; range is the values actually hit, $[0,\infty)$.
4 B The preimage is a set and exists for every function — no inverse required.
5 B Injective = no two inputs collide.
6 B Surjective = range fills the codomain.
7 B In $g \circ f$, the right-hand function $f$ runs first ($g(f(a))$).
8 False $g \circ f \ne f \circ g$ in general; e.g. with $f(x)=2x$, $g(x)=x+3$, $(g\circ f)(5)=13 \ne 16=(f\circ g)(5)$.
9 C Invertible $\Leftrightarrow$ bijective (the chapter's threshold theorem).
10 B Surjectivity → a preimage exists; injectivity → it is unique.
11 B Floor rounds toward $-\infty$, so $\lfloor -3.4 \rfloor = -4$.
12 False Truncation rounds toward zero; floor rounds toward $-\infty$. They disagree on negatives ($\lfloor -3.4\rfloor=-4$ vs. truncation $-3$).
13 B Pages $= \lceil 47/10 \rceil = \lceil 4.7 \rceil = 5$.
14 B Strictly smaller codomain forces a collision (the finite theorem / pigeonhole).
15 B Decompression is the inverse; an inverse exists only if the map is injective.
16 B A pure function is the §9.1 definition enforced in code.
17 True Every remainder is hit (surjective), but infinitely many integers share each remainder (not injective).
18 C $\exp$ and $\log$ undo each other: $\log_b(b^x)=x$, $b^{\log_b x}=x$.
19 Injectivity: assume $f(a_1)=f(a_2)$, derive $a_1=a_2$. Surjectivity: take arbitrary $b\in B$, construct an $a$ with $f(a)=b$.
20 A function is the rule plus its codomain; changing the codomain changes whether the range fills it, hence changes surjectivity (and thus bijectivity).

Topics to review by question

Questions Topic Section
1–2 Definition of a function (totality + single-valuedness) §9.1
3 Domain, codomain, range §9.2
4 Image and preimage of a set (preimage ≠ inverse) §9.2
5–6, 19 Injective / surjective definitions and proof templates §9.3
14, 17 The finite theorem, mod, and hashing §9.3, §9.5, §9.6
7, 8 Composition (order; not commutative) §9.4
9–10, 15 Inverses and the invertibility theorem §9.4
11–13 Floor, ceiling, pagination §9.5
18 Exponential / logarithm as inverse bijections §9.5
16 Pure functions §9.6
20 The codomain is part of the function §9.1–9.3