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