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