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