Summary: Oca/ocp Java Se 7 Programmer I & Ii Study Guide (Exams 1Z0-803 & 1Z0-804) | Kathy Sierra, et al

Summary: Oca/ocp Java Se 7 Programmer I & Ii Study Guide (Exams 1Z0-803 & 1Z0-804) | Kathy Sierra, et al Book cover image
  • This + 400k other summaries
  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
PLEASE KNOW!!! There are just 46 flashcards and notes available for this material. This summary might not be complete. Please search similar or other summaries.
Use this summary
Remember faster, study better. Scientifically proven.
Trustpilot Logo

Read the summary and the most important questions on OCA/OCP Java SE 7 Programmer I & II Study Guide (Exams 1Z0-803 & 1Z0-804) | Kathy Sierra; Bert Bates

  • 1 Declarations and Access Control

    This is a preview. There are 2 more flashcards available for chapter 1
    Show more cards here

  • 1. Which are true? (Choose all that apply.) A. “X extends Y” is correct if and only if X is a class and Y is an interface.B. “X extends Y” is correct if and only if X is an interface and Y is a class.C. “X extends Y” is correct if X and Y are either both classes or both interfaces.D. “X extends Y” is correct for all combinations of X and Y being classes and/or interfaces.

    C

    A is incorrect because classes implement interfaces, they don’t extend them. B is incorrect because interfaces only “inherit from” other interfaces. D is incorrect based on the preceding rules. (OCA Objective 7.6)
  • 2. Given:Which are true? (Choose all that apply.)A. As the code stands, the output is bangB. As the code stands, the output is sh-bangC. As the code stands, compilation fails.D. If line A is uncommented, the output is bang bangE. If line A is uncommented, the output is sh-bang bangF. If line A is uncommented, compilation fails.

    B and F are correct. Since Rocket.blastOff() is private, it can’t be overridden, and it is invisible to class Shuttle. A, C, D, and E are incorrect based on the above. (OCA Objective 6.6)
  • Given that the for loop’s syntax is correct, and given:And the command line:java _ - A .What is the result?A. -A B. A.C. -A.D. _A.E. _-A.F. Compilation failsG. An exception is thrown at runtime

    C is correct. This question is using valid (but inappropriate and weird) identifiers, static imports, main(), and pre-incrementing logic.
  • Given:What is the result? A. woof burbleB. Multiple compilation errorsC. Compilation fails due to an error on line 2D. Compilation fails due to an error on line 3E. Compilation fails due to an error on line 4F. Compilation fails due to an error on line 9

    A is correct; enums can have constructors and variables. B, C, D, E, and F are incorrect; these lines all use correct syntax. (OCP Objective 2.5)
  • Given two files:What is the result? (Choose all that apply.) A. 5 6 7B. 5 followed by an exceptionC. Compilation fails with an error on line 7D. Compilation fails with an error on line 8E. Compilation fails with an error on line 9F. Compilation fails with an error on line 10

    D and E are correct. Variable a has default access, so it cannot be accessed from outside the package. Variable b has protected access in pkgA.
  • Given:What is the result? (Choose all that apply.)A. Compilation succeedsB. Compilation fails with an error on line 6C. Compilation fails with an error on line 7D. Compilation fails with an error on line 8E. Compilation fails with an error on line 9

    C and D are correct. Variable names cannot begin with a #, and an array declaration can’t include a size without an instantiation. The rest of the code is valid.
  • Given:What is the result? (Choose all that apply.) A. TUEB. WEDC. The output is unpredictableD. Compilation fails due to an error on line 4E. Compilation fails due to an error on line 6F. Compilation fails due to an error on line 8G. Compilation fails due to an error on line 9

    B is correct. Every enum comes with a static values() method that returns an array of the enum’s values, in the order in which they are declared in the enum.
  • Given:Which are true? (Choose all that apply.) A. The class Tablet will NOT compileB. The interface Gadget will NOT compileC. The output will be plug in show bookD. The abstract class Electronic will NOT compileE. The class Tablet CANNOT both extend and implement

    A is correct. By default, an interface’s methods are public so the Tablet.doStuff method must be public, too. The rest of the code is valid
  • Given that the Integer class is in the java.lang package, and given:Which, inserted independently at line 1, compiles? (Choose all that apply.) A. import static java.lang;B. import static java.lang.Integer;C. import static java.lang.Integer.*;D. static import java.lang.Integer.*;E. import static java.lang.Integer.MAX_VALUE;F. None of the above statements are valid import syntax

    C and E are correct syntax for static imports. Line 4 isn’t making use of static imports, so the code will also compile with none of the imports.
  • 2 Object Orientation

    This is a preview. There are 12 more flashcards available for chapter 2
    Show more cards here

  • Given;public abstract interface Frobnicate { public void twiddle(String s); }Which is correct?

    B and E are correct. B is correct because an abstract class need not implement any or all of an interface’s methods. E is correct because the class implements the interface method and additionally overloads the twiddle() method.
PLEASE KNOW!!! There are just 46 flashcards and notes available for this material. This summary might not be complete. Please search similar or other summaries.

To read further, please click:

Read the full summary
This summary +380.000 other summaries A unique study tool A rehearsal system for this summary Studycoaching with videos
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

Topics related to Summary: Oca/ocp Java Se 7 Programmer I & Ii Study Guide (Exams 1Z0-803 & 1Z0-804)