Java Exam 7 November 2014

10 Questions | Attempts: 49
Share
SettingsSettings
Please wait...
  • 1/10 Questions

    Which statement(s) are true? (Choose all that apply.)

    • Cohesion is the OO principle most closely associated with hiding implementation details
    • Cohesion is the OO principle most closely associated with making sure that classes know about other classes only through their APIs
    • Cohesion is the OO principle most closely associated with making sure that a class is designed with a single, well-focused purpose
    • Cohesion is the OO principle most closely associated with allowing a single object to be seen as having many types
Please wait...
About This Quiz

Java Exam 7 November 2014 - Quiz

Quiz Preview

  • 2. 

    Given:What is the result? 

    • 5 7

    • 5 8

    • 8 7

    • 8 8

    • Compilation fails

    • An exception is thrown at runtime

    Correct Answer
    A. Compilation fails
  • 3. 

    Given:What is the result? (Choose all that apply.) 

    • Compilation succeeds

    • Compilation fails due to an error on line 8

    • Compilation fails due to an error on line 10

    • Compilation fails due to an error on line 12

    • Compilation fails due to an error on line 14

    Correct Answer
    A. Compilation fails due to an error on line 10
  • 4. 

    Given:What is the result? 

    • Furry bray

    • Stripes bray

    • Furry generic noise

    • An exception is thrown at runtime

    • Stripes generic noice

    • Compilation fails

    Correct Answer
    A. Furry bray
  • 5. 

    Given:What is the result? 

    • Compilation fails

    • Button key lint nickel nickel lint key button

    • Nickel button key lint button key lint nickel

    • Nickel button key lint nickel button key lint

    • Nickel button key lint nickel lint key button

    • An exception is thrown at runtime

    Correct Answer
    A. Compilation fails
  • 6. 

    Given:What is the result? 

    • -124

    • -134

    • -424

    • -434

    • -444

    • Compilation fails

    Correct Answer
    A. -434
  • 7. 

    Given:

    • 2

    • 4

    • An exception is thrown at runtime

    • Compilation fails due to an error on line 4

    • Compilation fails due to an error on line 5

    • Compilation fails due to an error on line 6

    • Compilation fails due to an error on line 7

    Correct Answer
    A. An exception is thrown at runtime
  • 8. 

    Which are true? (Choose all that apply.)

    • It is appropriate to use assertions to validate arguments to methods marked public

    • It is appropriate to catch and handle assertion errors

    • It is NOT appropriate to use assertions to validate command-line arguments

    • It is appropriate to use assertions to generate alerts when you reach code that should not be reachable

    • It is NOT appropriate for assertions to change a program’s state

    Correct Answer(s)
    A. It is NOT appropriate to use assertions to validate command-line arguments
    A. It is appropriate to use assertions to generate alerts when you reach code that should not be reachable
    A. It is NOT appropriate for assertions to change a program’s state
  • 9. 

    Which are true about a static nested class? (Choose all that apply.)

    • You must have a reference to an instance of the enclosing class in order to instantiate it

    • It does not have access to non-static members of the enclosing class

    • Its variables and methods must be static

    • If the outer class is named MyOuter, and the nested class is named MyInner, it can be instantiated using new MyOuter.MyInner();

    • It must extend the enclosing class

    Correct Answer(s)
    A. It does not have access to non-static members of the enclosing class
    A. If the outer class is named MyOuter, and the nested class is named MyInner, it can be instantiated using new MyOuter.MyInner();
  • 10. 

    Given:Which could be used to create an appropriate catch block? (Choose all that apply.) 

    • ClassCastException

    • IllegalStateException

    • IllegalStateException

    • IllegalStateException

    • ExceptionInInitializerError

    • ArrayIndexOutOfBoundsException

    Correct Answer(s)
    A. IllegalStateException
    A. IllegalStateException

Quiz Review Timeline (Updated): Mar 15, 2022 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 15, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 05, 2014
    Quiz Created by
    Kuskus
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.