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