2. Person A and Person B are playing a card game. There are 40 cards in total, each card has a number from 1 to 10, and each number has four different suits. At the beginning, each person has 20 cards. Each person removes pairs of cards that differ by 5. In the end, Person B has two cards left, with the numbers 4 and $a$, and Person A also has two cards left, with the numbers 7 and $b$. What is the value of $|a-b|$?
(A) 3
(B) 4
(C) 6
(D) 7
2. D.

Only cards with numbers $x+5$ and $x$ (where $x$ is a positive integer not greater than 5) can be removed together, 4 can only be removed with 9, and 7 can only be removed with 2, so, $\{a, b\}=\{2,9\}$.
Thus, $|a-b|=7$.