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