Your method of removing the last number, doubling, and subtracting from the remainder is a way of determining that a number is divisible by 7 but it is not the only way. I had never seen your way before but it is slick and easy to remember. Its drawback is that it only tells you whether or not a number is divisible by 7. If the number isn't divisible by 7 (and 6 out of 7 numbers will not be) then the test doesn't tell you what numbers are.
This problem's test is entirely different. For a six digit number, $a_5a_4a_3a_2a_1a_0$ will have the same remainder as $a_0 - a_3 + 3 (a_1 - a_4) + 2 (a_2 - a_5)$. The number will be divisible by 7 if and only if $a_0 - a_3 + 3 (a_1 - a_4) + 2 (a_2 - a_5)$ has remainder $0$. If $a_0 - a_3 + 3 (a_1 - a_4) + 2 (a_2 - a_5)$ has remainder, $m$, then $a_5a_4a_3a_2a_1a_0$ will be also have remainder $m$ and will $m$ larger than a multiple of 7.
The proof is easy.
$b = \sum_{i=0}^5 10^ia_i \equiv a_0 - a_3 + 3 (a_1 - a_4) + 2 (a_2 - a_5) \mod 7 \iff$
$\sum_{i=0}^5 10^ia_i -(a_0 - a_3 + 3 (a_1 - a_4) + 2 (a_2 - a_5)) \equiv 0 \mod 7 \iff$
$(10^5 + 2)a_5 + (10^4 + 3)a_4 + (10^3 + 1)a_3 + (10^2 - 2)a_2 + 7a_1 \equiv 0 \mod 7 \iff$
$100002a_5 + 10003a_4 + 1001a_3 + 98a_2 + 7a_1 \equiv 0 \mod 7 \iff$
$100002a_5 + 10003a_4 + 1001a_3 + 98a_2 + 7a_1 \equiv 0 \mod 7 \iff$
As 7 divides 100002, 10003, 1001, 98, and 7 this is true.
$10^6 = 1 \mod 7$ is a result of Fermat's little theorem that as gcd(10,7) = 1 $10^{7-1} \equiv 1 \mod 7$.
If you don't know Fermat's little theorem, this can be shown to be true by noting that:
$10^6 - 1 = (10^3 -1)(10^3 + 1) = (10-1)(10^2 + 10 + 1)(10 + 1)(10^2 - 10 + 1) = 9*111*11*91$ and noting $7|91$ so $7|10^6 - 1$ so $10^6 \equiv 1 \mod 7$.
We can extend this result to numbers larger than 6 digits by noting
$B = \sum_{i=0}^n10^ia_i = \sum_{i=0}^m{10^{6i}}(\sum_{l=0}^510^la_l \equiv \sum_{i=0}^m(-1)^i(a_{6i} - a_{6i+3} + 3 (a_{6i +1} - a_{6i+4}) + 2 (a_{6i+2} - a_{6i+5}) \mod 7$.
(In other words, do the above in groups of 6 digits.)
I am utterly certain the point of the exercise was NOT to discover a new divisibility test. I have utterly no intention of remembering this test or ever using it again.
====
Addendum: So why does your test work.
$B =\sum_{i=0n}^n10^ia_i \equiv 0 \mod 7 \iff$
$\sum_{i=1}^n10^ia_i \equiv -a_0 \mod 7 \iff$
$10\sum_{i=1}^n10^{i-1}a_i \equiv -a_0 \mod 7 \iff$
$50\sum_{i=1}^n10^{i-1}a_i \equiv -5a_0 \mod 7 \iff$
$\sum_{i=1}^n10^{i-1}a_i \equiv -5a_0 \mod 7 \iff$
$\sum_{i=1}^n10^{i-1}a_i \equiv 2a_0 \mod 7 \iff$
$\sum_{i=1}^n10^{i-1}a_i - 2a_0\equiv 0 \mod 7 \iff$
$\lfloor B/10 \rfloor - 2a_0\equiv 0 \mod 7 \iff$