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