16.35 midterm debrief october 30, 2002 malia kilpinen

21
16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Post on 19-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

16.35 Midterm Debrief

October 30, 2002

Malia Kilpinen

Page 2: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 1 What are process models? Compare and

contrast the spiral model of development with another model of your choice. (1+5p)

Page 3: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 1 - Process Model A software process model is an abstract

representation of a process. It presents a description of a process from some particular perspective.

Page 4: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 1 - Spiral Model Process is represented as a spiral rather than as a

sequence of activities with backtracking. Each loop in the spiral represents a phase in the

process. No fixed phases such as specification or design -

loops in the spiral are chosen depending on what is required.

Risks are explicitly assessed and resolved throughout the process.

Page 5: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 1 - Spiral Model Objective Setting Risk assessment and reduction Development and validation Planning

<<There is a picture in Van Vliet pg 62.>>

Page 6: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 2 Who are the expected readers of a

requirement specification and what properties do they want the specification to have? (5p)

Page 7: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 2 Users and the customer (in case of custom-made

product) want readability, completeness, consistency,

correctness, may serve as a contract (testability) Designers

readability, consistency, non-ambiguity, traceability Testers

testability Maintenance staff

completeness, traceability

Page 8: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 3 Consider the following piece of program, which

assumes a large integer C and an array A(0..C). It is intended to assign the maximum of A to the variable max.

max := A(0);

i := 1;while i < C loop

i := i+1;if A(i) > max

then max := A(i);end if;

-- max is the maximum of A(0..i);end loop;

Page 9: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 3 (cont.) a) Show what steps must be taken to find

test cases for coverage testing, using this program as an example. Show the distinction between node-coverage and branch-coverage. (5p)

b) What method(s) of verification are both practical and would likely reveal the error? Note that C is large. Motivate your answer. (3p)

Page 10: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 3 - Part a 1) draw flow-chart, identify nodes and branches 2) find a collection of paths that visits all

nodes/branches 3) find input data that makes the program follow each

path (if it turns out that there is no such data, the path is infeasible, go back to 2 and replace it by other paths) in this case, the difference is that branch coverage requires

that the test A(i)>max is true sometimes, and false sometimes. For node coverage, it may always be true. In any case, only one test is necessary. Say C=3, and A=[5,2,3,6]

Page 11: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 3 - Part b The error is that A(1) is never checked. A statistical

test has probability 1/C to detect this. From a) we can see that it is easy to achieve branch

coverage and yet miss the error. A boundary value test might detect it, if you have a

rather broad definition of “boundary”. Such a definition will soon be unworkable. Inspection has a good chance.

(Formal verification, that can be done mostly automatically when loop invariants are provided, is another candidate.)]

Page 12: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 4 Describe the architectures repository model

and client-server. Compare their pros and cons. (6p)

Page 13: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 4 - Repository Advantages

Efficient way to share large amounts of data Sub-systems need not be concerned with how data is

produced Centralized management e.g. backup, security, etc.

Disadvantages Sub-systems must agree on a repository data model.

Inevitably a compromise Data evolution is difficult and expensive No scope for specific management policies Difficult to distribute efficiently

Page 14: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 4 - Client Server Advantages

Distribution of data is straightforward Makes effective use of networked systems. May require

cheaper hardware Easy to add new servers or upgrade existing servers

Disadvantages No shared data model so sub-systems use different data

organisation. data interchange may be inefficient Redundant management in each server No central register of names and services - it may be hard

to find out what servers and services are available

Page 15: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 20 Cow-moon Ada code trace problem. (2p)

Page 16: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 20 Output is:

3 14 Moo! Moo! Moo! Moo! 7 6

Page 17: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 21 What does it mean to declare a variable as

private? When would you declare a variable as private? (1p)

Page 18: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 22 Write a program to calculate the cube of a

user-inputted integer. Your program should include error checking. (6p)

Page 19: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 22 Should use Skip_Line function in error

checking. Simplified version of problem set 2.

Page 20: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Question 23 Assume that a record type Beep has been defined.

The following pointers are then declared: (1p)type BeepPointer is access Beep;

Audi, BMW: BeepPointer;Audi : new Beep;BMW : new Beep;

What is the difference between the following commands?

BMW := Audi;

BMW.all := Audi.all;

Page 21: 16.35 Midterm Debrief October 30, 2002 Malia Kilpinen

Solution 23 Discussed in Ada Compendium. BMW := Audi;

BMW points to Audi’s memory location BMW.all := Audi.all;

BMW holds same values as Audi