Buffer only contains [0, 1, 2, 3, 4, 5, 6, 7]
In second iteration, in.read(buffer) becomes "-1" . How is the answer F "0123456789234567" ? I ran the program & see only 01234567 in output file.
Correct answer is F
Buffer already contains 01234567 and we have 89 left so next time it will replace 0 with 8 and 1 with 9. As there is no data left so it will write 89234567.
Correct option is F, because the buffer is of size 8. Therefore, it can only read 8 characters at a time. First 8 digits in F are correct and the entire thing is of length 16. Although the first 8 digits in B and E are correct, the entire length doesn't add it. Doesn't make sense that the buffer first reads 8 chars, then 6 more in B or 7 more in E.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
xplorerpj
7 months, 2 weeks agoxplorerpj
7 months, 3 weeks agoj_jain
11 months, 1 week agojames2033
11 months, 3 weeks agosupersquax
1 year agoomegavalou
1 year ago4d8d7fe
6 months, 3 weeks agomeltedolive
1 year agoTojose
1 year ago