question 1
The method runs on nmmmppp. How many characters has it written just after it reads the first p?
the answer, and why
the answer is B
Reading the first m ended n, so 1n. Reading the first p ended mmm, so 3m. 1n3m is 4 characters; ppp is written only at the end.
if you chose another
- That is 1n alone. Reading the first p also writes mmm's run, 3m.
- That is the whole code, 1n3m3p. The last run is written only at the end.
- That counts the runs met so far, n, mmm and p. Only runs that have ended are written.