Quiz 6

advertisement

Quiz 6

Dennis - Chapter 10 Method and Class Design

Multiple choice

1.

Detailed design is important for two reasons. First, preexisting classes and components need to be understood, organized, and pieced together, and second, _____. a.

it is common for the project team to write some code and produce original classes that support the application logic of the system b.

it is tempting to jump in without planning c.

modular design is outdated d.

the SDLC continues to be used instead of a more reliable method of analysis for systems e.

top-down modular approaches are an acceptable method of analysis that must be performed during the planning phase

2.

In an object-oriented system, changes can take place at the following level of abstraction. a.

variable b.

method c.

class/object d.

cluster (examples: partition, package) e.

all of the above

3.

_____ has emerged as the standard for the design of object-oriented systems. a.

Java b.

C++ c.

VisualBasic d.

UML e.

Microsoft .NET

4.

In terms of levels of abstraction, which of the following is at the lowest level relative to the rest? a.

system b.

partition/package c.

library d.

class/object e.

method

5.

The basic building block of a system is the _____. a.

object b.

attribute c.

message d.

partition e.

method

6.

_____ means having the ability to send the same message to different objects, which can be interpreted differently by different objects.

a.

encapsulation b.

polymorphism c.

inheritance d.

coupling e.

cohesion

7.

8.

_____ suggests that only the information required to use an object should be available outside the object. a.

encapsulation b.

information hiding c.

polymorphism d.

inheritance e.

cohesion

In order to get an object to perform a method, a(n) _____ is sent to the object. a.

state b.

object c.

attribute d.

message e.

instance

_____ refers to the level of interdependency or interrelationship among the modules in a 9.

system. a.

coupling b.

cohesion c.

connascence d.

multiple inheritance e.

single inheritance

10.

A class/object should only represent one thing, and a method should only solve a single task. This principle is often referred to as _____. a.

coupling b.

cohesion c.

connascence d.

multiple inheritance e.

none of the above

11.

What are the two types of coupling in object-oriented systems? a.

interaction, data b.

data, inheritance c.

data, stamp d.

interaction, inheritance e.

data, common

12.

Which of the following types of interaction coupling is “best?” a.

stamp b.

data

c.

content or pathological d.

common or global e.

control

13.

Of all of the types of interaction coupling, _____ is the worst. a.

stamp b.

data c.

content or pathological d.

common or global e.

control

14.

When a global data area exists outside individual objects, the resulting system has _____ interaction coupling. a.

stamp b.

data c.

content or pathological d.

common or global e.

control

15.

When a method of one object refers to the inside hidden parts of another object, these methods are exhibiting _____ coupling. a.

data b.

stamp c.

control d.

common or global e.

content or pathological

16.

Object-oriented systems have three general types of cohesion: _____, _____, and _____. a.

method, class, inheritance b.

method, generalization/specialization, inheritance c.

generalization/specialization, class, object d.

method, class, generalization/specialization e.

functional, sequential, procedural

17.

A class has an attribute in which a range of values has a semantic meaning. This class has

_____ connascence. a.

Name b.

Type or Class c.

Convention d.

Algorithm e.

Position

18.

Fan-out refers to _____. a.

the number of attributes a class has b.

the number of messages sent by a method c.

the number of times a message is sent by a method d.

the number of times an attribute is passed from a class

e.

none of the above

19.

Which of the following Structured English statements is an advanced form of an IF statement? a.

action statement b.

For statement c.

While statement d.

Case statement e.

Do statement

20.

The audience for pseudocode is the _____. a.

analyst b.

programmer c.

manager d.

user e.

customer

True/False

1.

Many project teams are too quick to jump into writing code for classes without first designing them.

2.

Polymorphism is the mechanism that combines the processes and data into a single object.

3.

Dynamic binding refers to the ability of object-oriented systems to defer the data typing of objects to run time.

4.

Subclasses inherit the appropriate attributes and methods from the superclass above them.

5.

Because of potential problems, developers must be aware of the effects of modifications in a superclass and in each of the subclasses that will inherit the modification.

6.

It is impossible for a subclass to inherit from more than one superclass.

7.

C++ forces programmers to write code with good levels of interaction coupling.

8.

High levels of inheritance coupling in a system are always good and desirable.

9.

Coincidental is the worst type of method cohesion.

10.

You should maximize connascence within an encapsulation boundary and minimize connascence between the encapsulation boundaries.

11.

The programmers of a system should decide what errors the system is expected to handle.

12.

Fan-out refers to the number of attributes passed by one object to another.

13.

A derived attribute results from storing the value of a computation.

14.

Contracts document the message passing that takes place between objects.

15.

A post-condition is one that must be valid for a method to execute.

16.

Method specifications can be somewhat vague, as the programmers will have a good idea of what the analyst needs done in the system.

17.

Clicking a mouse can be an event.

18.

A Case statement is an advanced form of an If statement.

19.

A For statement simply performs some action.

20.

Pseudocode is useful for writing algorithm specifications.

21.

When a calling method passes a variable to the called method, the two exhibit content or pathological coupling.

22.

Functional method cohesion is the “best” type of method cohesion.

23.

The worst type of method cohesion is logical method cohesion.

24.

A method that combines two functions that use the same attributes to execute exhibits

Communicational cohesion.

25.

A method that performs multiple functions that are unrelated to one another exhibits

Coincidental cohesion, and this type of cohesion is undesirable.

26.

Method cohesion is concerned with the level of cohesion among the attributes and methods of a class.

27.

Generalization/specialization cohesion addresses the sensibility of the inheritance hierarchy.

28.

You should try to maximize the cohesion within an encapsulation boundary and minimize the coupling between the encapsulation boundaries.

29.

Class cohesion addresses the cohesion within each individual method of a class.

30.

Mixed-role class cohesion is the worst type of class cohesion.

31.

The order of the code in a method is critical for the method to execute correctly. This method has position connascence.

32.

The signature of a method is completely specified by the name of the method and the parameters that must be passed to the method.

33.

A self-contained, encapsulated piece of software that can be plugged into a system is often referred to as a design a pattern.

34.

Method signatures, in conjunction with frameworks, class libraries and design patterns, offer excellent opportunities for reuse.

35.

Using an attribute to store the value of a computation is the use of a derived attribute.

36.

Moving the attributes to a calling class when it is the only class that needs those attributes is not a method of optimizing the design of a system?

37.

A post-condition is a constraint that must be met for a method to execute.

38.

A pre-condition is a constraint that must be met after the method executes.

39.

Invariants model constraints that must always be true for all instances of a class.

40.

Contracts contain a detailed algorithmic description of how the method is to work.

41.

A listing of the items that trigger the functionality in the program is known as events.

42.

A detailed outline of the lines of code that need to be written is known as pseudocode.

43.

Written documents that include explicit instructions on how to write the code to implement the method are called method specifications.

44.

A Case statement in Structured English specifies some action to be performed.

45.

An If statement in Structured English controls actions that are performed under different conditions.

46.

A Case statement in Structured English has several mutually exclusive branches.

Short Answer

1.

What is coupling ? Is this desirable or undesirable in a system? Why?

2.

What is interaction coupling? How can interaction coupling be minimized?

3.

What is inheritance coupling? How can inheritance coupling be minimized?

4.

What is cohesion ? Is this desirable or undesirable in a system? Why?

5.

Describe the concept of inheritance. How does this impact the development of objectoriented systems?

6.

Explain the concept of polymorphism.

7.

What is method cohesion?

8.

What is class cohesion?

9.

What is Generalization/Specialization cohesion?

10.

What is connascence ? Is this desirable or undesirable in a system? Why?

11.

What are the four opportunities for reuse identified in the text?

12.

What are the five optimizations that should be done to create a more efficient design?

13.

What are the three types of constraints typically captured in object-oriented design?

14.

Use Structured English or pseudocode to write the logic for the process “register for a class” at your college or university. Focus on a single class, but consider the possible exceptions that may occur when you try to register for that class.

15.

Why is it necessary for an analyst to detail the specifications for the individual classes and methods? What techniques are useful for doing this documentation?

Support: Software Design Metrics

True and False

1. The definitions of a measure is that it provides a quantitative indication of the extent, amount, dimension, capacity, or size of some attribute of a product or process

2. The IEEE definition of a Metric is “a quantitative measure of the degree to which a system, component, or process possesses a given attribute.”

3. An i ndicator is a metric or combination of metrics that provide insight into the software process, a software project, or the product itself

4. Measuring how fast programmers code after a particular training would be an example of a product metric.

5.

Measureing the quality of the code after training would be an example of a product metric.

6.

Function points are derived using an empirical relationship based on countable (direct) measures of software's information domain and assessments of software complexity

7.

Halstead has an example of a code metric

8.

McCabe is an example of a Design Metric

9.

The best type of cohesion is no cohesion.

10.

The best type of coupling is no coupling.

11.

Cohesion is the measure of the functionality of a module.

12.

Cohesion is a widely accepted measurement of good code.

13.

Cohesion in OO development addresses that only one output exist for that module.

Multiple Choice

1, The four steps of defining metrics include a. Formulation, Collection, Analysis and Interpretation b. Investigation, Collection, Analysis and Interpretation c. Formulation, Collection, Documentation, and Interpretation d. Gathering, Investigation, Documentation and Interpretation

2.

UCFP we use in our project is most like what other metric. a.

Function Point Analysis b.

Complexity Metrics c.

LOC d.

Cohesion Metric

3.

Information domain values for FPA are defined in the following manner: a.

number of inputs screens, output reports, queries to the database, and files used for parameters b.

number of external inputs , external outputs, inquiries, logical files and interface files c.

number of function points d.

number of use case points

4.

Whitmire [WHI97] size as a characteristic of the following items below. Which of these items are UCP based on. a.

Volume – number of Database references or, Transactions, or Database updates, etc b.

Length – lines of code, number of classes, number of instances, etc c.

Functionality – using function point analysis or use case point analysis

5.

The metric of size was proposed by which of the following a.

Chidamber and Kemerer: b.

The MOOD Metrics Suite c.

Lorenz and Kidd [LOR94]: d.

All of the above

6.

A method which changes no values of variable and produces no outputs but has a loop would be what type of cohesion a. Functional Cohesion

b. Sequential Cohesion c. Communicational Cohesion d. Iterative Cohesion e. Conditional Cohesion f. Coincidental Cohesion g. Not decidable

7.

A method that displays a screen would be what type of cohesion. a. Functional Cohesion b. Sequential Cohesion c. Communicational Cohesion d. Iterative Cohesion e. Conditional Cohesion f. Coincidental Cohesion g. Not decidable

8.

A method with a loop would be what type of cohesion. a. Functional Cohesion b. Sequential Cohesion c. Communicational Cohesion d. Iterative Cohesion e. Conditional Cohesion f. Coincidental Cohesion g. Not decidable

9.

A method with an if statement would be what type of cohesion? a. Functional Cohesion b. Sequential Cohesion c. Communicational Cohesion d. Iterative Cohesion e. Conditional Cohesion f. Coincidental Cohesion g. Not decidable

10.

A method with no variables would be what type of cohesion. a. Functional Cohesion b. Sequential Cohesion c. Communicational Cohesion d. Iterative Cohesion e. Conditional Cohesion f. Coincidental Cohesion g. Not decidable

11.

A method that accesses another methods public variables is using what type of coupling a.

No coupling b.

Sequential coupling c.

Computational coupling

d.

Conditional coupling e.

Common coupling f.

Content coupling

12.

A method that updates a pointer in another method has what type of coupling. a.

No coupling b.

Sequential coupling c.

Computational coupling d.

Conditional coupling e.

Common coupling f.

Content coupling

Download