question 1
The method runs on arrrbbb. How many characters has it written just after it reads the first b?
the answer, and why
the answer is D
Reading the first r ended a, so 1a. Reading the first b ended rrr, so 3r. 1a3r is 4 characters; bbb is written only at the end.
if you chose another
- That is 1a alone. Reading the first b also writes rrr's run, 3r.
- That is the whole code, 1a3r3b. The last run is written only at the end.
- That counts the runs met so far, a, rrr and b. Only runs that have ended are written.