Object-Oriented Design

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

Which is the proper way to show inheritance in a UML class diagram? Choose one of the four options below:

c) Inheritance is shown in UML with an open arrowhead pointing to the superclass.

Choose the correct state diagram for a car which has a state called "HasGas:"

c) The state goes at the top, variables in the middle, and activities (including exit and entry activities) in the bottom.

There are three different relationships that objects can have. Which of these best describes the relationship between a Chair and its Legs?

composition

The first stage of the two-stage design process is _______ design.

conceptual

When during the design process are you likely to produce CRC cards the most?

conceptual design

You create an object that compares values from two different sources. It then updates the smaller value to be equal to the larger one. What kind of object is this?

control

Select the object pairing that has a composition relationship:

Book - Page

During model checking, what is the name for a violation of the desired properties of the model?

Counterexample

When two processes cannot run because they are waiting on the same resource, it's called...

Deadlock

Select the object pairing that has an association relationship:

Hiker - Trail

You are writing out a CRC card for a bank machine component. Under which section should you put "Track Cash Remaining."

Responsibility

How can you apply the principle of Separation of Concerns in object-oriented programming?

Separate objects or components according to their role in the software

Select the object pairing that has an aggregation relationship:

Stapler - Staple

Which one of these classes is in most need of being decomposed?

Store

What is the purpose of model checking?

To check the software for errors before release

For which of these situations would you use a sequence diagram?

To show the collaborative behaviour of objects in your program.

Choose the two answers that correctly complete the following sentence: : "We say that a class has low cohesion if..."

- ...its purpose is unclear. - ...it tries to encapsulate too many unrelated responsibilities.

Choose the three examples of inheritance used poorly:

- A method in the superclass is overwritten with different behaviour by a subclass. - A subclass inherits methods from the superclass and adds extra, new, unrelated functionality - Inheritance is used to share behaviour without specializing

Which two of these are likely to be a part of conceptual design?

- CRC Cards - Mockups

Two classes are tightly coupled. What are some ways you might be able to tell? Choose the two correct answers.

- In order to understand one class, you need to open up the other to look at the implementation - They are very highly reliant on each other

What are the best ways to promote Conceptual Integrity in your software? Choose the two correct answers.

- Regular code reviews - Planning the architecture of the system

What are the phases of Model Checking? Choose the 3 correct answers.

- Running Phase - Modeling Phase. - Analysis Phase

You are planning a Professor class as part of your software design. Which of these will you consider a collaborator ? Choose the two correct answers.

- Student - Course

What are some advantages of object-oriented programming in a language like Java? Choose the three correct answers.

- abstract data types - mimic the real-world structure of the problem - data management

During conceptual design, once the problem is mapped into components, what are the other two critical pieces of information that you must specify for these classes or components? Choose the two correct answers.

- collaborators - responsibilities

Identify two outcomes of the design process. Choose the two correct answers.

- conceptual design - technical design

Which of these terms are used to describe coupling? Choose the 3 correct answers.

- degree - ease - flexibility

You are writing the CRC card for a Bear component. Choose the three collaborators.

- den - tree - bear

Select the three categories of objects generally present in object-oriented software.

- entity - boundary - control

Which keywords allow your classes to achieve polymorphism in Java? Choose the two correct answers.

- extends - implements

You are writing the CRC card for a Bear component. Choose the two responsibilities.

- hunger - eat berries

Which of these are desirable characteristics of a software design? Choose the three correct answers.

- maintainability - flexible - reusability

Which of these conceptual design techniques will help you analyze the problem space to determine classes for your object-oriented software? Choose the two correct answers.

- mockups -CRC

Which of the following are examples of non-functional requirements? Choose the three correct answers.

- performance - availability - security

What are some keywords you might use for information hiding in Java? Select the three correct answers.

- private - protected - [none]

During conceptual design, you will talk about... (Choose the three correct answers):

- requirements - tradeoffs - mockups

What are elements of a state in a State diagram (see diagram)? Choose the three correct answers.

- state name - state variables - activities

In order to provide good encapsulation, fill-in-the-blanks on this UML class diagram: (Replace the underscores _ from top to bottom with minus signs ("-") or plus signs ("+"); your answer will be a string of six + or - signs with no spaces)

--++++

What is an abstract data type?

a type of data defined by the developer rather than the language.

You are writing a simple soccer video game. Select the best example of proper abstraction:

a)

Which of these UML class diagrams depicts an aggregation ("has-a") relationship between the two classes?

a) An open diamond indicates a weak "has a" or aggregation relationship.

Which of these elements represents a termination in a UML State diagram?

a) black filled circle inside another circle

Which of these sequence diagrams is correct?

b)

Which of these UML class diagrams shows an association relationship?

b) A simple association relationship is shown with a plain line, often with numbers indicating how many of each object can be associated.

Which UML class diagram is a good example of encapsulation? Choose one of the four options below:

b) This class has hidden the variables, then used getters and setters to allow access to them (and potentially add gatekeeping or value checking).

What is the term for reducing a class or object to its inputs and outputs in modelling?

black box thinking

An object which is responsible for showing data to the user could be considered which category of object?

boundary

You create an object that represents a dialog box. It creates buttons and text fields, etc, for the user to interact with, and it logs those interactions. What kind of object is this?

boundary

Which of these UML class diagrams depicts a composition, or a strong "has-a" relationship?

d) A filled diamond indicates a composition - or strong "has a" - relationship.

Sam decided that the DeliveryDriver class was getting too complex, so she split it up, moving its behaviour into several related classes, like DeliveryCar and DeliveryOrder. She just demonstrated which important object-oriented design principle?

decomposition

Information Hiding is closely related to one of the core design principles of object-oriented design. Which one?

encapsulation

Sam identified the important attributes and behaviours of a delivery driver and put them all into a DeliveryDriver class, like "takeOrder", "deliverOrder", and "DeliveryArea." She exposed some of these to other classes. She just demonstrated an important part of object-oriented design. Which of these concepts best describes what you did?

encapsulation

You create an object that represents a user, storing important information about them such as their preferences. What kind of object is this?

entity

Sam realized that her DeliveryDriver class had some behaviour and attributes that could be shared by other classes, like BusDriver and TaxiDriver, so she made a class called Driver that these classes inherited behaviour from. Which object-oriented design principle did she use?

generalization

Which design principle enables developers to follow the guideline D.R.Y. ("Don't Repeat Yourself"):

generalization

Which is the most desirable?

high cohesion, loose coupling

Some of the earliest computing languages supported:

main program and subroutines

Add the necessary keyword to complete this instance variable declaration in a class if you are using the encapsulation design principle to hide this variable from all other classes: ______ String message;

private

The second stage of the two-stage design process is ________ design.

technical

What is a requirement of this form called? "As a ____, I want to ____, so that ____".

user story

You are a programmer creating software for a bank machine system. Which section of a CRC card for the bank machine component will the "User" go into?

Collaborator

Which of these is an example of a quality tradeoff?

Adding security knowing it will reduce speed

When is Model Checking conducted?

After development

Sam was asked to create a DeliveryDriver class. Sam thought about the problem, and reduced it to its most essential aspects... things like takeOrder, DeliveryArea, etc. She ignored things that were not important in the context, like the driver's height or eye colour. She just applied an important object-oriented design principle. Which of these concepts best describes what she just did?

abstraction

Which of these violates Liskov's Substitution Principle?

an operation in the superclass is replaced by a different operation in the subclass

Which is the proper way to show an abstract method in a UML class diagram?

anOperation()


Conjuntos de estudio relacionados

Ch 1 Introduction to Computers and Programming

View Set

Introduction to Ethics Challenge 3

View Set

BIO 112 - Final Exam Study Guide, Pt. 2

View Set

Web Programming C298 (JavaScript)

View Set