question 1
The method runs on ooaaat. How many characters has it written just after it reads the first t?
the answer, and why
the answer is D
Reading the first a ended oo, so 2o. Reading the first t ended aaa, so 3a. 2o3a is 4 characters; t is written only at the end.
if you chose another
- That is 2o alone. Reading the first t also writes aaa's run, 3a.
- That is the whole code, 2o3a1t. The last run is written only at the end.
- That counts the runs met so far, oo, aaa and t. Only runs that have ended are written.