question 1
The method runs on rzy. How many characters has it written just after it reads the first y?
the answer, and why
the answer is D
Reading the first z ended r, so 1r. Reading the first y ended z, so 1z. 1r1z is 4 characters; y is written only at the end.
if you chose another
- That is 1r alone. Reading the first y also writes z's run, 1z.
- That is the whole code, 1r1z1y. The last run is written only at the end.
- That counts the runs met so far, r, z and y. Only runs that have ended are written.