Appendix F. Annotated Answers to Mock Exam I
This appendix provides annotated answers to the questions in the mock exam for the Java SE 8 Programmer I certification found in Appendix E.
Annotated Answers
Q1 (a), (b), (c), and (e)
Only local variables need to be explicitly initialized before use. Fields are assigned a default value if not explicitly initialized.
Q2 (e)
Giving parameters (2, 3)
to the method substring()
constructs a string consisting of the characters from index 2 (inclusive) to index 3 (exclusive) of the original string; that is, the string returned contains the character at index 2. The first character is at index 0 and the last character is at index 1 less than the number of characters in the string.
Q3 (c)
The loop prints ...
Get A Programmer’s Guide to Java® SE 8 Oracle Certified Associate (OCA) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.