Wednesday, March 24, 2010


some clarification of some answers, for the first sample test:
(6) The position of the lowercase letter L is as the third position in the string. But counting begins at 0, so it is 2.

(9) This is what Trim does. As discussed in the book, It takes a string, and strips out any leading and trailing spaces.

(10) The person who wrote this question made an error. Here is a trace. In the first line, x is 0. After the second line, x is 4. In the third line, x+=2 is the same as x=x+2, which is x=4+2, so x is 6. In the fourth line, while we modify x by something, we don't assign anything to it with the = operator, so x itself remains unchanged. Thus, x is still 6, not 18.

(12) The explanation for this one is the same as for question 6. The position of lowercase letter T is as the sixth position. But since counting begins at 0, that would be position 5.

(14) I suppose that (A) is really what was intended, and this is also acceptable. And this was likely what was intended. But one could also say (D), since the number would still remain as the Double data type.

No comments:

Post a Comment