We are given four candidate hash functions and asked to determine which one distributes the keys $i = 0, 1, 2, \dots, 2020$ most uniformly across 10 buckets labeled $0$ through $9$. A uniform distribution means that each bucket receives approximately the same number of keys. Since the total number of keys is $2021$, an ideal hash function would assign either $\lfloor 2021/10 \rfloor = 202$ or $\lceil 2021/10 \rceil = 203$ keys to each bucket.
Because all candidate functions are defined modulo $10$, their behavior is periodic with period $10$. Thus, it suffices to examine the output of each function for $i = 0$ to $9$; the pattern will repeat every 10 inputs. Over $2021$ keys, there are $202$ complete cycles of $10$ (covering $i = 0$ to $2019$) and one extra value ($i = 2020$). Therefore, uniformity is determined by how many distinct residues modulo $10$ each function produces and whether those residues are equally frequent within one period.
We now analyze each option.
Option A: $h(i) = i^2 \mod 10$
Compute $i^2 \mod 10$ for $i = 0$ to $9$:
\[
\begin{array}{|c|c|c|}
\hline
i & i^2 & i^2 \mod 10 \\
\hline
0 & 0 & 0 \\
1 & 1 & 1 \\
2 & 4 & 4 \\
3 & 9 & 9 \\
4 & 16 & 6 \\
5 & 25 & 5 \\
6 & 36 & 6 \\
7 & 49 & 9 \\
8 & 64 & 4 \\
9 & 81 & 1 \\
\hline
\end{array}
\]
The set of residues is ${0, 1, 4, 5, 6, 9}$ — only 6 distinct buckets are used. Buckets $2, 3, 7, 8$ never receive any keys. Hence, the distribution is highly non-uniform.
Option B: $h(i) = i^3 \mod 10$
Compute $i^3 \mod 10$ for $i = 0$ to $9$:
\[
\begin{array}{|c|c|c|}
\hline
i & i^3 & i^3 \mod 10 \\
\hline
0 & 0 & 0 \\
1 & 1 & 1 \\
2 & 8 & 8 \\
3 & 27 & 7 \\
4 & 64 & 4 \\
5 & 125 & 5 \\
6 & 216 & 6 \\
7 & 343 & 3 \\
8 & 512 & 2 \\
9 & 729 & 9 \\
\hline
\end{array}
\]
The residues are ${0, 1, 2, 3, 4, 5, 6, 7, 8, 9}$ — all 10 buckets appear exactly once in each period of 10. Therefore, over 202 full periods, each bucket receives exactly 202 keys. The final key ($i = 2020$) satisfies $2020 \equiv 0 \pmod{10}$, so $h(2020) = 0^3 \mod 10 = 0$, giving bucket $0$ one extra key (total 203). All other buckets have 202 keys. This is as uniform as possible.
Option C: $h(i) = (11 \cdot i^2) \mod 10$
Since $11 \equiv 1 \pmod{10}$, we have
$$
h(i) = (11 \cdot i^2) \mod 10 = (i^2) \mod 10.
$$
This is identical to Option A, and thus also uses only 6 buckets. The distribution is non-uniform.
Option D: $h(i) = (12 \cdot i^2) \mod 10$
Note that $12 \equiv 2 \pmod{10}$, so
$$
h(i) = (2 \cdot i^2) \mod 10.
$$
Compute for $i = 0$ to $9$:
\[
\begin{array}{|c|c|c|c|}
\hline
i & i^2 & 2i^2 & (2i^2) \mod 10 \\
\hline
0 & 0 & 0 & 0 \\
1 & 1 & 2 & 2 \\
2 & 4 & 8 & 8 \\
3 & 9 & 18 & 8 \\
4 & 16 & 32 & 2 \\
5 & 25 & 50 & 0 \\
6 & 36 & 72 & 2 \\
7 & 49 & 98 & 8 \\
8 & 64 & 128 & 8 \\
9 & 81 & 162 & 2 \\
\hline
\end{array}
\]
The residues are ${0, 2, 8}$ only 3 buckets are used. This is the least uniform of all options.
Conclusion
Only Option B produces a complete and balanced set of residues modulo $10$, resulting in a near-perfect uniform distribution across all buckets. All other options suffer from significant clustering due to algebraic properties of squaring or scalar multiplication modulo $10$.
$$
\boxed{\text{B. } h(i) = i^3 \mod 10}
$$