Question

Suppose we have two hierarchies of classes. C1 is a superclass with D1, E1, and F1...

Suppose we have two hierarchies of classes. C1 is a superclass with D1, E1, and F1 as concrete subclasses and C2 is a superclass with D2 and E2 as concrete subclasses. C1 has abstract methods f1() and g1() and C2 has abstract methods f2() and g2(). There is Bridge from C1 to C2.

Use the above scenario for answering questions 1-3.

Question 1 (1 point)

Each object of type C1 should hold a reference to an object of type C2.

Question 1 options:

a) True
b) False

Question 2 (1 point)

Methods _____ may utilize methods ____ to accomplish their respective functionalities

Question 2 options:

a)

f1() and g1() .... f2() and g2()

b)

f2() and g2() .... f1() and g1()

c)

Both (a) and (b)

d)

Neither (a) nor (b)

Question 3 (1 point)

Without using the Bridge pattern, the total number of classes in the two hierarchies would

Question 3 options:

a)

still be 5

b)

be less than 5

c)

be 6

d)

not be any of (a)-(c)

Question 4 (1 point)

Which of the following patterns is used for grouping Shape objects?

Question 4 options:

a)

Bridge

b)

Composite

c)

Compound

d)

Command

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution

Explanation

Bridge design pattern allows you to separate the abstraction from the implementation it is not used for grouping shape objects

Hence, Bridge pattern is incorrect

Composite design pattern is a structural design pattern that can be used when a group of objects can be treated the same as a single object in that group,therefore we can do the grouping of shape objects using this pattern

Hence, Composite pattern is the correct answer

Compound design pattern used to combine two patterns into a solution that used to solve a recurring or general problem. Here we are grouping shape object only

Hence, compound pattern is incorrect

Command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time

Hence, Command pattern is incorrect

Therefore
Composite pattern
option b is the correct answer

---

solved question with detailed explanation

really sorry couldnt able to finish the reamining

all the best

Add a comment
Know the answer?
Add Answer to:
Suppose we have two hierarchies of classes. C1 is a superclass with D1, E1, and F1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • plz write if it is in another class or package Question 1: 1. Create a new...

    plz write if it is in another class or package Question 1: 1. Create a new project in Eclipse (File > New > Java Project.) Name it Homework2Q1 2. Create a package for your classes 3. Create an abstract superclass with only non default constructor(s) 4. Create two different subclasses of that superclass 5. Create another class that is not related (you need a total of four classes up to this point) 6. Create an interface 7. Make the class...

  • Java Programming Questions (Multiple Choice) ** Please only answer if you know it, not just copy...

    Java Programming Questions (Multiple Choice) ** Please only answer if you know it, not just copy and paste from another user. Please explain the answer. 1) Given code: public abstract class A{ } public class B extends A { } The following code sequence would correctly create an object reference of class A holding an object reference for an object of class B: A c; c = new B(); TRUE FALSE ---------------------------------------------------------------------------------------------------------------------------------------- 2) After the following code sequence is executed,...

  • Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the...

    Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the following program? public class Quiz2B { public static void main(String[] args) { try { System.out.println("Welcome to Java"); int i = 0; int y = 2 / i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("Welcome to Java"); } finally { System.out.println("End of the block"); } } } Question 1 options: The program displays Welcome to Java two times. The program displays Welcome to...

  • java language Problem 3: Shape (10 points) (Software Design) Create an abstract class that represents a Shape and contains abstract method: area and perimeter. Create concrete classes: Circle, Rectang...

    java language Problem 3: Shape (10 points) (Software Design) Create an abstract class that represents a Shape and contains abstract method: area and perimeter. Create concrete classes: Circle, Rectangle, Triangle which extend the Shape class and implements the abstract methods. A circle has a radius, a rectangle has width and height, and a triangle has three sides. Software Architecture: The Shape class is the abstract super class and must be instantiated by one of its concrete subclasses: Circle, Rectangle, or...

  • Create a two new gate classes, one called NorGate the other called NandGate. NandGates work like...

    Create a two new gate classes, one called NorGate the other called NandGate. NandGates work like AndGates that have a Not attached to the output. NorGates work lake OrGates that have a Not attached to the output.Create a series of gates that prove the following equality NOT (( A and B) or (C and D)) is that same as NOT( A and B ) and NOT (C and D). Make sure to use some of your new gates in the...

  • Lab 1.java only Goal: This lab will give you experience with defining and using classes and...

    Lab 1.java only Goal: This lab will give you experience with defining and using classes and fields, and with conditionals and recursive functions. Getting Started --------------- Read the Fraction.java class into a text editor and compile it filling in the command javac -g Fraction.java. The program should compile without errors. In a shell window, run the program using "java Fraction". The program should run, although it will print fractions in a non-reduced form, like 12/20. Part I: Constructors (1 point)...

  • Q2) Interface Create a program that calculates the perimeter and the area of any given 2D...

    Q2) Interface Create a program that calculates the perimeter and the area of any given 2D shape. The program should dynamically assign the appropriate calculation for the given shape. The type of shapes are the following: • Quadrilateral 0 Square . Perimeter: 4xL • Area:LXL O Rectangle • Perimeter: 2(L+W) • Area:LxW Circle Circumference: I x Diameter (TT = 3.14) Area: (TT xD')/4 Triangle (assume right triangle) o Perimeter: a+b+c O Area: 0.5 x base x height (hint: the base...

  • ****Please read the following requirements and use java language w/ comments**** ****Can make this a multi...

    ****Please read the following requirements and use java language w/ comments**** ****Can make this a multi part question if needed**** Project requires a base class, a derived subclass, and an interactive driver (class with a main) that allows the user to utilize and manipulate the classes created. You may select one super class from the following:               Superclass                                    Example subclasses Ship class                                a) battleship, tugboat, icebreaker Person class                           b) manager, salaryworker, hourlyworker Aircraft class                         c) Learjet, cargoplane,...

  • CS 1102 Unit 5 – Programming Assignment In this assignment, you will again modify your Quiz...

    CS 1102 Unit 5 – Programming Assignment In this assignment, you will again modify your Quiz program from the previous assignment. You will create an abstract class called "Question", modify "MultipleChoiceQuestion" to inherit from it, and add a new subclass of "Question" called "TrueFalseQuestion". This assignment will again involve cutting and pasting from existing classes. Because you are learning new features each week, you are retroactively applying those new features. In a typical programming project, you would start with the...

  • I need help with a java error Question: Consider a graphics system that has classes for...

    I need help with a java error Question: Consider a graphics system that has classes for various figures—say, rectangles, boxes, triangles, circles, and so on. For example, a rectangle might have data members’ height, width, and center point, while a box and circle might have only a center point and an edge length or radius, respectively. In a well-designed system, these would be derived from a common class, Figure. You are to implement such a system. The class Figure is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT