question 1
The method runs on mmmqqccc. How many characters has it written just after it reads the first c?
the answer, and why
the answer is A
Reading the first q ended mmm, so 3m. Reading the first c ended qq, so 2q. 3m2q is 4 characters; ccc is written only at the end.
if you chose another
- That is 3m alone. Reading the first c also writes qq's run, 2q.
- That is the whole code, 3m2q3c. The last run is written only at the end.
- That counts the runs met so far, mmm, qq and c. Only runs that have ended are written.