IS2043-ExamOne

¡Supera tus tareas y exámenes ahora con Quizwiz!

Using the protected keyword gives a member:

package access

Superclass methods with this level of access cannot be called from subclasses.

private

When a subclass redefines a superclass method by using the same signature, the subclass is said to overload that superclass method.

False

Whether an operation is public or private is indicated by either + for private or - for public.

False

Failure to implement a superclass's abstract methods in a subclass is a compilation error unless the subclass is also declared abstract.

True

In a class diagram, properties may be related to the instance variables of a class.

True

It is permissable to leave get and set methods for the instance variables of a class out of the class diagram.

True

Polymorphism allows a subclass to override operations of a superclass, thus specializing the operation for the subclass.

True

Superclass constructors are not inherited by subclasses.

True

The features of a class can refer to both properties and operations.

True

To use an interface, a concrete class must specify that it implements the interface and must declare each method in the interface with the signature specified in the interface declaration.

True

Operations in a class diagram correspond to _____ in Java.

methods

An object of a subclass automatically

nherits all the attributes and operations of its superclass.

Inheritance is also known as the

"is-a" relationship.

Which of the following is not possible?

A class that inherits from two classes.

For which of the following would polymorphism not provide a clean solution?

A program to compute a 5% savings account interest for a variety of clients.

Which statement best describes the relationship between superclass and subclass types?

A subclass reference can be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable.

(JAVACH9) Which of the following statements is false?

A superclass object is a subclass object.

Choose the answer that lists the complete set of statements that are true:

A. A subclass is more specific than its superclass. C. A subclass can access the protected members of its superclass. D. A superclass method can be overridden in a subclass. E. The first task of any subclass constructor is to call its direct superclass's constructor.

Which of the following may be found in an attribute notation (select all that apply).

A. Name 33.333% C. Type 33.333% D. Visibility 33.333%

Which statement is true when a superclass has protected instance variables?

ALL OF THE ABOVE 1. A subclass object can assign an invalid value to the superclass's instance variables, thus leaving an object in an inconsistent state 2. Subclass methods are more likely to be written so that they depend on the superclass's data implementation. 3. We may need to modify all the subclasses of the superclass if the superclass implementation changes.

Which of the following statements is (are) true? A. We can use inheritance to customize existing software. B. A superclass specifies commonality. C. A superclass can be modified without modifying subclasses D. A subclass can be modified without modifying its superclass.

All of the above.

Answer by choosing the correct set of true statements: A. Objects cannot be created from an abstract class. B. The purpose of an abstract class is to provide an appropriate superclass from which other classes can inherit and share the same design. C. You make a class abstract by declaring it with keyword abstract. D. Abstract classes are used as superclasses in inheritance hierarchies.

All the statements are true.

The UML syntax for operations includes which of the following:

An argument list containing properties and types A return type and property

Which of the following statements about interfaces is false?

An interface describes a set of methods that can be called on an object, providing a default implementation for the methods.

The ways objects may be related are:

Association, Aggregation, Composition.

Which of the following is an example of a functionality that should not be "factored out" to a superclass?

Both ducks and geese are birds that know how to start flying from the water. All vehicles know how to start and stop. All paints have a color. (CORRECT ANSWER) All animals lay eggs, except for mammals.

Consider the abstract superclass below: public abstract class Foo { private int a; public int b; public Foo( int aVal, int bVal ) { a = aVal; b = bVal; } // end Foo constructor public abstract int calculate(); } // end class Foo Any concrete subclass that extends class Foo:

Both (a) and (b).

A Car class has a has-a relationship with the Vehicle class.

False

A has-a relationship is implemented via inheritance.

False

All methods in an abstract class must be declared as abstract methods.

False

Class ________ represents an image that can be displayed on a JLabel.

ImageIcon

(CH9) ____________ is a form of software reusability in which new classes acquire the members of existing classes and embellish those classes with new capabilities.

Inheritance

Consider classes A, B and C, where A is an abstract superclass, B is a concrete class that inherits from A and C is a concrete class that inherits from B. Class A declares abstract method originalMethod, implemented in class B. Which of the following statements is true of class C?

None of the above.

The UML standard is owned by which of the following?

OMG

Every class in Java, except ________, extends an existing class.

Object

The acronynm OMG (when discussing UML) stands for which of the following:

Object Management Group

An advantage of inheritance is that:

Objects of a subclass can be treated like objects of their superclass.

Which of the following statements describe the type(s) of relationships that may be described by class diagrams?

Only static relationships can be defined by class diagrams.

Which of the following should be visible to other objects?

Operations

Two things that must be remembered about specific objects are (select two):

Operations that my be performed by or on an object. Values of an object's attributes.

Overriding a method differs from overloading a method because:

Overridden methods have the same signature.

Another way to talk about a superclass is:

Parent

A superclass defines a method called findArea. A subclass of that superclass also defines a method called findArea, but the subclass method uses a different formula. This is an example of ________.

Polymorphism

Which of the following may be represented in a class diagram?

Properties of a class. Operations or methods of a class. Constraints on relationships between classes.

Which of the following is not a superclass/subclass relationship?

Sailboat/Tugboat

Consider the classes below, declared in the same file: class A { int a; public A() { a = 7; } } class B extends A { int b; public B() { b = 8; } } Which of the statements below is false?

TRUE Both variables a and b are instance variables. After the constructor for class B executes, the variable a will have the value 7. After the constructor for class B executes, the variable b will have the value 8. FALSE (CORRECT ANSWER) A reference of type A can be treated as a reference of type B.

If two objects belong to the same class, which of the following statements about those objects is true?

The procedure for carrying out a specific operation will be the same for both objects.

A subclass may add attributes, operations, and relationships to those inherited from the superclass.

True

Attributes and operations defined at the class level will be shared by all objects of that class.

True

Something a business must track or that participates in the business may generally be called _________.

a business object

All of the following methods are implicitly final except:

a method in an abstract class.

If a class contains at least one abstract method, it's a(n) ___________ class.

abstract

Which of the following statements about abstract superclasses is true?

abstract superclasses may contain data.

(JAVACH10) A(n) class cannot be instantiated.

abstract.

:A class that implements an interface but does not declare all of the interface's methods must be declared:

abstract.

A "method" is:

an operation.

Interfaces can have methods.

any number of

Assigning a subclass reference to a superclass variable is safe:

because the subclass object is an object of its superclass.

Fields labeled private in a superclass can be accessed in a subclass

by calling public or protected methods declared in the superclass.

Private fields of a superclass can be accessed in a subclass

by calling public or protected methods declared in the superclass.

Polymorphism refers to the ability of _________ to take many "shapes".

objects & operations

Which of the following does not complete the sentence correctly? An interface

can be instantiated.

Classes from which objects can be instantiated are called __________ classes.

concrete

Non-abstract classes are called:

concrete classes.

A subclass explicitly inherits from this kind of superclass.

direct superclass

Polymorphism allows for specifics to be dealt with during:

execution

This type of class cannot be a superclass.

final

Classes and methods are declared final for all but the following reasons:

final methods are static.

Every object in Java knows its own class and can access this information through method.

getClass

The UML distinguishes an interface from other classes by placing the word "interface" in above the interface name.

guillemets

In a(n) _______ relationship, a class object has references to objects of other classes as members.

has-a

In single inheritance, a class exists in a(n) _______________ relationship with its subclasses.

hierarchical

Which keyword is used to specify that a class will define the methods of an interface?

implements.

Failure to prefix the superclass method name with the keyword super and a dot (.) separator when referencing the superclass's method causes ________.

infinite recursion

To avoid duplicating code, use ________, rather than ________.

inheritance, the "copy-and-past" approach.

If the superclass contains only abstract method declarations, the superclass is used for:

interface inheritance.

In a(n) ______ relationship, an object of a subclass can also be treated as an object of its superclass.

is-a

Declaring a method final means:

it cannot be overridden.

It is a UML convention to denote the name of an abstract class in:

italics.

Which of the following is the superclass constructor call syntax?

keyword super, followed by a set of parentheses containing the superclass constructor arguments.

When a superclass variable refers to a subclass object and a method is called on that object, the proper implementation is determined at execution time. What is the process of determining the correct method to call?

late binding

(CH10) Polymorphism enables you to:

program in the general.

This access modifier offers an intermediate level of access. Variables declared with this modifier in a superclass can be accessed by members of the superclass, by members of its subclasses, and by members of other classes in the same package.

protected

Which superclass members are inherited by all subclasses of that superclass?

protected instance variables and methods.

Which of the following could be used to declare abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)?

public abstract int method1();

A superclass's ____________ and ___________ members can be accessed in the superclass declaration and in subclass declarations.

public and protected

An interface may contain:

public static final data and public abstract methods.

Which method changes the text the label displays?

setText

The default implementation of method clone of Object performs a ________.

shallow copy

Inheritance is sometimes referred to as ___________________.

specialization

Constants declared in an interface are implicitly

static.

Subclass constructors can call superclass constructors via the keyword _________.

super

Which of the following keywords allows a subclass to access a superclass method even when the subclass has overridden the superclass method?

super

When a subclass constructor calls its superclass constructor, what happens if the superclass's constructor does not assign a value to an instance variable?

the program compiles and runs because the instance variables are initialized to their default values.

The proper way to indicate that a class property may have no value entered into it is ____________.

to use a lower bound of zero.

The default equals implementation determines:

whether two references refer to the same object in memory.


Conjuntos de estudio relacionados

CISA Ch 2 - Governance and Management of IT

View Set

gero final questions (12, 21-25)

View Set

Chapter 13 Ethical, Servant, Spiritual, and Authentic Leadership

View Set

7. Analyzing Ethernet LAN Switching

View Set

ATI Real Life 4.0 RN Maternal Newborn Preclampsia

View Set

BUS 125 Business Math Chapter 11 Quiz

View Set

Fundamentals of Personnel Recovery (PR 102)

View Set

Religion - What is the Incarnation?

View Set

Multiplication Set 15 (9x7, 9x8, 9x9, 9x10)

View Set