Exam # 1 Questions with Solution - Software Development Methods | CS 314, Exams of Computer Science

Material Type: Exam; Professor: France; Class: Software Development Methods; Subject: Computer Science; University: Colorado State University; Term: Fall 2013;

Typology: Exams

2013/2014

Uploaded on 01/06/2014

j-rad992
j-rad992 🇺🇸

5

(1)

5 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS314 Examination 1
October 3, 2013
Answer ALL SEVEN questions. There is also a BONUS
question worth 10 points that is optional.
Please read all questions carefully before answering.
Write your answers on the Exam. Write your name at the
top of each page in the space provided. If you need
more space to write your answers, use the back of each
page.
DATE:
NAME:
Question
Max Points
Points
1
5
2
10
3
10
4
15
5
15
6
15
7
30
TOTAL
100
Bonus
10
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Exam # 1 Questions with Solution - Software Development Methods | CS 314 and more Exams Computer Science in PDF only on Docsity!

CS314 Examination 1

October 3, 2013

Answer ALL SEVEN questions. There is also a BONUS

question worth 10 points that is optional.

Please read all questions carefully before answering.

Write your answers on the Exam. Write your name at the

top of each page in the space provided. If you need

more space to write your answers, use the back of each

page.

DATE:

NAME:

Question Max Points Points

TOTAL 100

Bonus 10

  1. ( 5 points ) State whether the following statements are true or false (circle TRUE or FALSE) a. One of the factors behind the emergence of software engineering is the difficulty of estimating the cost, time and effort needed to complete a software project. TRUE FALSE b. The Expert guideline states that responsibility for creating an object of a class B should be assigned to the class A that has the information needed to initialize the B objects. TRUE FALSE c. In a composition (strong aggregation) class structure, deletion of the whole results in deletion of the parts. TRUE FALSE d. A specialized class (a subclass) in a class diagram inherits the associations of its generalization (a superclass). TRUE FALSE e. In the Unified Process, iterations are time-boxed, that is, a team must complete the iteration in the time allocated to the iteration, even if it means that not all the features planned for the iteration are implemented. TRUE FALSE

f. Circle all the situations below in which it makes sense to ignore the cohesion guideline during object-oriented design i. A designer wants to reduce the number of classes in a design so that the design class model can fit on one page ii. A controller class is used as a single point of entry to the system. iii. A designer combines two classes to produce a new class that behaves more efficiently in a system that must perform efficiently iv. A designer wants to remove all coupling between classes by combining all classes that are associated g. Circle all the following that are true of a correct program. A correct program i. behaves as specified in a written specification ii. satisfies a user’s stated and unstated needs iii. is always a robust program iv. is always an evolvable program h. Implementation inheritance occurs when i. a class implements an interface ii. a subclass inherits the public members of a superclass iii. a method in a class calls a method in another class iv. a subclass overloads all the operations in the superclass i. Interface inheritance occurs when i. a class implements an interface ii. a subclass inherits the public members of a superclass iii. a method in a class calls a method in another class iv. a subclass overloads all the operations in the superclass j. The instances of an interface type are i. all the objects of classes that implement the interface ii. all the methods that implement the interface iii. all the classes that implement the interface iv. all the attributes of classes that implement the interface

  1. ( 10 points ) Complete the following sentences: a. If an organization defines and uses standard software development processes then it is at the Defined_ CMM level. b. A software project that is following the Unified Process (UP) and is currently detailing the requirements and implementing the core architecture is in the _Elaboration phase. c. In the Unified Process, workflows, such as Requirements and Test, cut across different phases. d. Overriding occurs when a subclass method redefines a superclass method. e. Refactoring occurs when code is changed to improve its quality but not its core functionality
  1. (15 points) Invariants and Method Specifications a. (7 points) Consider a class that implements a binary search tree. Write the invariants for this class. 1. Each node has at most 2 children 2. Each child has at most one parent; the root is the only node that does not have a parent 3. The left child is less than the parent and the right child is greater than the parent b. (8 points) Consider the following method and its Javadoc-formatted header: /** * Copies the values of Array A into array B in the same order. * The old values in B are lost. The array B must have the same * length as Array A. In addition, the number of elements in A must * be greater than the number of elements in B. */ public void copyArray(int[] A, int[] B){…} Write the precondition and postcondition for this method. precondition: The length of A is equal to the length of B and the number of elements in A is greater than the number of element in B postcondition: Each location in Array B has the content of Array A in the same location.
  1. (15 points) A programmer inherits who developed a List class in a previous program recognizes that he can reuse some of the functionality in that class to implement a Stack class and thus has Stack inherit from List. The design model he developed is given below (method specifications for only the methods in the superclass that are overridden in the subclass are shown; simple descriptions are given for the other List operations that are inherited without change). (10pts) a. What is the major problem with this design with respect to the operations that are inherited without redefinition? A stack user can now perform non-stack like operations such as get an element in any location and appending a list. This is bad because access to stack elements should be restricted to inserting, getting, and removing only elements at the top. b. Does the design model satisfy Liskov’s Substitutability Principle (LSP)? (You must give your answer in terms of the preconditions and postconditions of the methods involved, i.e., in terms of contravariance and covariance) No it does not. For addElem the precondition in the subclass is stronger (more restrictive) and thus there will be situations that are valid at the superclass level but invalid at the subclass level. Also, the
  1. (30 points) Program Design Model a. (20 points) Complete the following design class diagram for an interactive diagram editor that is used to create and modify drawings (you are free to add new classes, associations, etc.; you do not need to show attributes, methods nor navigability symbols ): A drawing contains one or more sheets. A sheet is a collection of lines and boxes. There must be at least one box in a sheet. Each box may optionally contain a single line of text. Text is allowed only in boxes. A line must connect two boxes and is composed of a series of line segments. A line segment is a part of only one line and is destroyed whenever the line it is a part of is destroyed. Two points specify each line segment. The end point of one segment is the start point of the next segment, if there is a next segment. A selection is a collection of highlighted lines and boxes in a sheet. A line or box cannot be in more than one selection. Express any constraints that cannot be expressed as multiplicities in English. Clearly state all assumptions you made in your design.

The? indicate points where assumptions are needed. If they give a multiplicity but state no corresponding assumption then deduct some marks (not all) for that multiplicity. There are also some multiplicity options given (e.g., 1..2 or 0..2); if they don’t give assumptions for these that’s OK (i.e., don’t deduct points). English constraint: A sheet must have at least box (or they can show an association from Sheet to Box with a multiplicity of 1.. at the Box end)*

BONUS : For question 6, there is another way to have Stack reuse methods in List other than through inheritance. Draw a design model that shows how this can be done and describe how it works. Instead of inheritance there will be a 1 to 1 association between Stack and List and the stack operations will call only the following List operations: addEelem(), removeElem() and getTop(). When it calls the add and remove operations it will use the top position as an argument.