Java Exam Oct. #1

10 Questions | Attempts: 338
Share

SettingsSettingsSettings
Java Exam Oct. #1 - Quiz

Java


Questions and Answers
  • 1. 
    Given:Which is most likely true? (Choose the most likely.)
    • A. 

      ClassD has low cohesion

    • B. 

      ClassA has weak encapsulation

    • C. 

      ClassB has weak encapsulation

    • D. 

      ClassB has strong encapsulation

    • E. 

      ClassC is tightly coupled to ClassA

  • 2. 
    Which collection class(es) allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? (Choose all that apply.)
    • A. 

      Java.util.HashSet

    • B. 

      Java.util.LinkedHashSet

    • C. 

      Java.util.List

    • D. 

      Java.util.ArrayList

    • E. 

      Java.util.Vector

    • F. 

      Java.util.PriorityQueue

  • 3. 
    Given the proper import statement(s), and:Which are true? (Choose all that apply.)
    • A. 

      The size of s is 4

    • B. 

      The size of s is 5

    • C. 

      The size of s is 7

    • D. 

      The size of subs is 3

    • E. 

      An exception is thrown at runtime

  • 4. 
    Which is a correct class? (Choose all that apply.)
    • A. 

      Public abstract class Frob implements Frobnicate { public abstract void twiddle(String s) { } }

    • B. 

      Public abstract class Frob implements Frobnicate { }

    • C. 

      Public class Frob extends Frobnicate { public void twiddle(Integer i) { } }

    • D. 

      Public class Frob implements Frobnicate { public void twiddle(Integer i) { } }

    • E. 

      Public class Frob implements Frobnicate { public void twiddle(String i) { } public void twiddle(Integer s) { } }

  • 5. 
    The following block of code creates a Thread using a Runnable target:Which of the following classes can be used to create the target, so that the preceding codecompiles correctly? 
    • A. 

      Public class MyRunnable extends Runnable{public void run(){}}

    • B. 

      Public class MyRunnable extends Object{public void run(){}}

    • C. 

      Public class MyRunnable implements Runnable{public void run(){}}

    • D. 

      Public class MyRunnable implements Runnable{void run(){}}

    • E. 

      Public class MyRunnable implements Runnable{public void start(){}}

  • 6. 
    Which are true? (Choose all that apply.) 
    • A. 

      The notifyAll() method must be called from a synchronized context

    • B. 

      To call wait(), an object must own the lock on the thread

    • C. 

      The notify() method is defined in class java.lang.Thread

    • D. 

      When a thread is waiting as a result of wait(), it releases its lock

    • E. 

      The notify() method causes a thread to immediately release its lock

  • 7. 
    Which method names follow the JavaBeans standard? (Choose all that apply.)
    • A. 

      AddSize

    • B. 

      GetCust

    • C. 

      DeleteRep

    • D. 

      IsColorado

    • E. 

      PutDimensions

  • 8. 
    Given: What is the result?
    • A. 

      13

    • B. 

      Compilation fails due to multiple errors

    • C. 

      Compilation fails due to an error on line 6

    • D. 

      Compilation fails due to an error on line 7

    • E. 

      Compilation fails due to an error on line 11 Answer:

  • 9. 
    Given: What is the result?
    • A. 

      1 2

    • B. 

      1 2 3 45 6

    • C. 

      1 2 3 4 5 6

    • D. 

      1 2 a 3 45 6

    • E. 

      Compilation fails

    • F. 

      1 2 followed by an exception

  • 10. 
    Given: Instances of which class(es) can be serialized? (Choose all that apply.)
    • A. 

      Car

    • B. 

      Ford

    • C. 

      Dodge

    • D. 

      Wheels

    • E. 

      Vehicle

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.