question 1
The method runs on adds. How many characters has it written just after it reads the first s?
the answer, and why
the answer is C
Reading the first d ended a, so 1a. Reading the first s ended dd, so 2d. 1a2d is 4 characters; s is written only at the end.
if you chose another
- That is 1a alone. Reading the first s also writes dd's run, 2d.
- That is the whole code, 1a2d1s. The last run is written only at the end.
- That counts the runs met so far, a, dd and s. Only runs that have ended are written.