Description of this paper

Loading

QUESTION 1 QUESTION 17 If a subclass constructor does not-(Answered)

Description

Step-by-step Instant Solution


Question

QUESTION 1QUESTION 17

If a subclass constructor does not explicitly call a superclass constructor, the superclass default (no argument) constructor is always called automatically.

?True

?False

  1. The Java keyword that ensures that a block of code will always be executed whether or not an exception is thrown is:

    A.

    always

    B.

    execute

    C.

    finally

    D.

    do


QUESTION 16
  1. Select the best answer.

    ?

    A(n) ____ can add instance variables and methods to an existing class.

    A.

    subclass

    B.

    constructor

    C.

    package

    D.

    interface


  1. The main purpose of a constructor is:

    A.

    Construct a method

    B.

    Initialize instance variables

    C.

    Return a value

    D.

    Name the method

4 points ??

QUESTION 2
  1. Assume the following class definition:

    ?public class MyClass
    {
    ????public void myMethod()
    ????{
    ????????...
    ????}
    }

    ?You define the following subclass:

    ?public class OurClass extends MyClass
    {
    ????public void ourMethod()
    ????{
    ????????myMethod();
    ????????...
    ????}
    }

    ?What happens when you try to compile?OurClass?

    A.

    It will compile

    B.

    It will compile but an object of?OurClass?cannot be created

    C.

    It will not compile

    D.

    It will compile but an object of?MyClass?cannot be created

QUESTION 5
  1. ????????????????

    A?subclass?can?directly?access?all?public?and?private?instance?variables?of?its?superclass?

    ????????????????

    ?True

    False

QUESTION 7
  1. A checked exception
    A.
    Cannot be analyzed by the compiler
    B.
    Must either be caught or declared within the method where it may be thrown
    C.
    Is any subclass of RuntimeException
    D.
    Can be ignored and left to Java to handle
QUESTION 20
  1. Suppose the class?Sub?inherits from the superclass?Sandwich.? Which of the following gives a syntax error??

    Sandwich x = new Sandwich();
    Sub y = new Sub();

    A.

    x = y;

    B.

    y = new Sub();

    C.

    y = x;

    D.

    x = new Sub();


QUESTION 22
  1. ????????????????

    The?compiler?will?generate?an?error?if?the?same?name?but?different?signature?is?used?for?more?than?one?method?or?constructor.

    ????????????????

    ?True

    ????????????????

    ?False



QUESTION 23
  1. A(n) __________________ exception describes a problem that is likely to occur at times, no matter how careful you are.

    A.

    RuntimeException

    B.

    Error

    C.

    unchecked

    D.

    checked


 

Paper#9256486 | Written in 27-Jul-2016

Price : $16
SiteLock