Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 What term is used to identify when an object hands off some functionality to another object? Delegate Client Slave Minion 2 points QUESTION

QUESTION 1

  1. What term is used to identify when an object hands off some functionality to another object?

    Delegate

    Client

    Slave

    Minion

2 points

QUESTION 2

  1. image text in transcribed Given the inheritance tree in the accompanying figure, which is a list of all subclasses?

    UnpoweredVehicle, PoweredVehicle

    UnpoweredVehicle, PoweredVehicle, Bicycle, Skateboard, Motorcycle, Car

    Bicycle, Skateboard, Motorcycle, Car

    Cannot be determined from the diagram

2 points

QUESTION 3

  1. What is the output of the following code? public class Rectangle{ // Instance variables private double length; private double width; // Getters and setters for length and width public double getLength(){ return length; } public void setLength(double length){ this.length = checkData(length); } public double getWidth(){ return width; } public void setWidth(double width){ this.width = checkData(width); } // Constructor public Rectangle(double length, double width){ this.length = checkData(length); this.width = checkData(width); } // Error-checking method public double checkData(double val){ // If value is negative, make it positive if(val

    Rectangle 1: Length: 4.0 Width: 2.0 Area: 8.0 Perimeter: 12.0 Rectangle 2: Length: 8.0 Width: 6.0 Area: 48.0 Perimeter: 28.0

    Rectangle 1: Length: -4.0 Width: 2.0 Area: -8.0 Perimeter: -12.0 Rectangle 2: Length: 8.0 Width: 6.0 Area: 48.0 Perimeter: 28.0

    Rectangle 1: Length: -4.0 Width: 2.0 Area: -8.0 Perimeter: -4.0 Rectangle 2: Length: 8.0 Width: 6.0 Area: 48.0 Perimeter: 28.0

    Rectangle 1: Length: -4.0 Width: 2.0 Area: 8.0 Perimeter: 12.0 Rectangle 2: Length: 8.0 Width: 6.0 Area: 48.0 Perimeter: 28.0

2 points

QUESTION 4

  1. In the following code, which lines make up all of the accessor methods? 0 public class Bus { 1 private BankAccount ba; 2 private double fuelLeft; 3 private final double FUEL_MAX = 40.0; 4 private final double FUEL_COST = 3.54; 5 public Bus(BankAccount baRef) { 6 fuelLeft = 0; 7 ba = baRef; 8 } 9 public void fillTank() { 10 double cost = (FUEL_MAX - fuelLeft) * FUEL_COST; 11 if (ba.pay(cost) == true) { 12 fuelLeft = FUEL_MAX; 13 } 14 } 15 public double getFuelLeft() { 16 return fuelLeft; 17 } 18 }

    Lines 9-14

    Lines 15-17

    Lines 9-17

    Lines 5-8

2 points

QUESTION 5

  1. Which of the following is NOT an example of a best practice?

    Using an Application Programming Interface (API)

    Using inheritance

    Using accessor methods

    Using the Model-View-Controller design pattern

2 points

QUESTION 6

  1. Variables whose scope is the entire class are called instance variables.

    True

    False

2 points

QUESTION 7

  1. Which Java keyword forces all subclasses to create their own version of, or override, the method?

    abstract

    model

    template

    frame

2 points

QUESTION 8

  1. Design patterns are just another name for best practices.

    True

    False

2 points

QUESTION 9

  1. To use an inherited method, an object must be cast to the superclass before using that method.

    True

    False

2 points

QUESTION 10

  1. The following HTML code is most likely in which tier of the Model-View-Controller design pattern?

    Circles

    Program Calculates Area and Perimeter of Circles

    Enter the radius:

    Model

    View

    Controller

    Unable to determine

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Compare the different types of employee separation actions.

Answered: 1 week ago

Question

Assess alternative dispute resolution methods.

Answered: 1 week ago

Question

Distinguish between intrinsic and extrinsic rewards.

Answered: 1 week ago