13.07.2015 Views

OCP Java SE 6 Programmer Practice Exams (Exam 310 ... - Kitabxana

OCP Java SE 6 Programmer Practice Exams (Exam 310 ... - Kitabxana

OCP Java SE 6 Programmer Practice Exams (Exam 310 ... - Kitabxana

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

292Chapter 6: <strong>Practice</strong> <strong>Exam</strong> 3Which are true? (Choose all that apply.)A. Compilation fails.B. No output is produced.C. The output will contain "t1 "D. The output will contain "t2 "E. The output will contain "!= "F. The output is "t1 ", followed by an exception.Answer (for Objective 2.1): D is correct. Unboxing automatically converts the Boolean objects to booleanprimitives. The Boolean(String) constructor views null Strings AND Stringsthat don’t have the value of "true" (case-insensitive) to be false. It’s legal for "if"tests to be based on method calls that return a boolean. Finally, when "==" or "!=" isused to compare a wrapper object with a primitive, the wrapper is unwrapped before thecomparison. A, B, C, E, and F are incorrect based on the above.27. Which are valid command-line switches when working with assertions? (Choose all that apply.)A. -eaB. -daC. -dsaD. -evaE. -enableassertionsAnswer (for Objective 2.3): A, B, C, and E are valid command-line switches. D is incorrect because -eva does not exist.28. Given:4. class Account { Long acctNum, password; }5. public class Banker {6. public static void main(String[] args) {7. new Banker().go();

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!