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