Warm ups for cs2212 1 Warm Up – CS2212 Software Engineering 1.What do you think the term...

25
Warm ups for cs2212 1 Warm Up – CS2212 Software Engineering 1. What do you think the term “Software Engineering” implies that is different from the typical program you wrote in cs1026 or cs1027 Some Possible Answers: Size of the project is much bigger Team work required We want reliable software which implies we must do lots of testing It would be nice if we also had reusable code The program may be in use for several year (needs to be long lasting) Engineering implies a systematic approach

Transcript of Warm ups for cs2212 1 Warm Up – CS2212 Software Engineering 1.What do you think the term...

Warm ups for cs2212 1

Warm Up – CS2212 Software Engineering 1. What do you think the term “Software Engineering” implies that is

different from the typical program you wrote in cs1026 or cs1027

Some Possible Answers:

• Size of the project is much bigger

• Team work required

• We want reliable software which implies we must do lots of testing

• It would be nice if we also had reusable code

• The program may be in use for several year (needs to be long lasting)

• Engineering implies a systematic approach

Warm ups for cs2212 2

Warm Up Questions: 1. What are the 5 key attributes of “Quality”

software?

2. List 3 of the 4 parts of the textbook’s definition of the term “Software Engineering”

3. What will format will the quiz be and what will it be testing?

4. When will the quiz be?

5. What day will you meet with your group…IT IS VERY IMPORTANT YOU SHOW UP THAT DAY IF YOU WANT YOUR GROUP TO PICK A MEETING TIME THAT SUITS YOUR SCHEDULE!

6. When is the individual assignment due?

7. When is the GUI workshop?

8. When is the first group assignment due?

ANSWERS

1. Usability, Reliability, Efficiency, Maintainability, Reusability

2. -Solving problems, -systematic development,-large high quality software, -within a time/cost constraint

3. Multiple choice, your knowledge of the project specifications

4. -8 See course outline…

Warm ups for cs2212 3

Warm Up Question Chapter 11: Draw a PERT diagram for the following tasks:

Task Preceding Task Description Duration

A None Write CS212 Exams 10

B A Photocopy Exam 2

C None Book Exam Room 1

D C Hire Proctors 4

E B,D Proctor Exam 3

Answer:

1 00

3 18

2 1010

4 1212 5 15

15E

3D

4

B

2A

10

C

1

Warm ups for cs2212 4

Warm Up Question Chapter 11: Draw a Gantt diagram for the following tasks:

Task Preceding Task Description Duration

A None Write CS212 Exams 10

B A Photocopy Exam 2

C None Book Exam Room 1

D C Hire Proctors 4

E B,D Proctor Exam 3

Answer:

Warm ups for cs2212 5

Warm Up Chapter 11

1. Name at least 2 software process models/methodologies2. Name/describe at least 2 of the cost estimations given in the text book3. Explain the difference between the following two PERT nodes:

Answers: Waterfall, Agile, Spiral, Phased Release, Evolutionary, Concurrent Divide and Conquer, Include all activities, Previous Experiences,

Account for Differences, Anticipate Worst Case, Combine Independent Estimates, Revise as you go

The first one has 3 hours of possible slack/give time, the second has NO

give time.

1013

7 1313

7

Warm Up Chapter 2 Organize each of the following items into sets of inheritance hierarchies of

classes. Remember the isa rule, you may need to add extra classes to act as super classes, you may want to remove things, you may find that two items correspond to the same class, you may find some classes are actually instances.

Warm ups for cs2212 6

Insurance Policy Policy Renewal Deductible ClaimInsurance Client Insured Property Auto PolicyHome Policy Life Insurance Beneficiary

Deductable

InsuredProperty

Person

InsuranceClient Beneficiary

Transaction

Claim PolicyRenewal

InsurancePolicy

AutoPolicy HomePolicy LifeInsPolicy

Warm Up Chapter 4 Classify the following requirements statement into one of:

F (functional), Q (non functional, quality requirements), PL (non functional, platform (environment/technology/system), PR (non functional, process (project plan/development methods) or X (should not be in the requirements document)

Warm ups for cs2212 7

1. The userid must be 6 characters long

2. DB2 will be used to store the data

3. The software must run using less than 50 MB of memory

4. A bubble sort will be used to order the last names of customers

5. The spiral methodology will be used when developing the software

6. Only 2 minutes of downtime per week will be permitted

7. Flight fares must include 7% GST and 7%PST

1. F

2. PL

3. Q

4. X

5. PR

6. Q

7. F

Warm Up Chapter 4 Draw a Use Case diagram for the following scenario:

A customer goes to an ATM and enters his/her pin number. The customer can withdraw cash, get the balance of an account, pay bills or deposit cheques. A teller can change set up the system to allow the customer to change his/her pin number.

Warm ups for cs2212 8

Enter PINWithdraw Cash

Deposit Cheque

Get Balance

Change PIN

Prepare For PIN Change

Pick Account

Account Empty<<exclude>>

<<include>>

<<include>>

<<include>>Customer

Teller

Warm Up Chapter 4 Draw a Use Case diagram for the following scenario (you must have at least

3 actors, 5 use cases, 1 extension and 1 inclusion):

Write a new email reader and composer/sender like PINE or Outlook.

Warm ups for cs2212 9

Send Email

Delete Address

Modify Address

Read Email

Compose Email

Add Address

Invalid EmailAddress

<<exclude>>

<<include>>

Sender

Receiver

Internet

Warm Up Chapter 5

Put the multiplicity markers on the following associations, be prepared to justify your answer:

Warm ups for cs2212 10

Customer Car* *Has rented

0..1 0..1Currently renting

Customer CarHas rented

Currently renting

Warm Up Chapter 5

Assume we have to make a UML class diagram for a Bridge Card Game Tournament. In bridge there are 4 players, players partner with the person across the table from them and every player gets 13 cards.

Assume our classes are: PLAYER, CARD, GAME and our associations are: DEALT, PARTNERS, PLAY

Warm ups for cs2212 11

Player Card1 13dealt

1

4 plays

Game

partners

11

Warm Up Chapter 5 A directed graph is a set of vertices, some of which are connected by

arrows.

1. Draw a class diagram for this graph to the right 2. Draw a class diagram if the graph is undirected

Warm ups for cs2212 12

. ...

..

Vertex Edge2 *connects

Vertex *

* joinsend

startVertex

Arrow* *

fromto

Warm Up Chapter 5 If we were modeling a courier system (like FedEx), what

might be some of the possible classes and associations. Draw a class diagram.

Warm ups for cs2212 13

Courier Package1..* * delivering

Destination

*

1addressed to

Warm Up Chapter 5 Assume we have 2 classes: MAN and WOMAN, draw a

class diagram for the association “has married” for each of the following three scenarios: There is no such thing as divorce ( or widows remarrying ) There is divorce We want to show the association “currently married to”

Warm ups for cs2212 14

MAN WOMAN0..1 0..1 has married

MAN WOMAN0..* 0..& has married

MAN WOMAN0..1 0..1 currentlymarried to

Warm Up Chapter 7 Think of at least 5 of the 12 Guidelines for design an interface:

Warm ups for cs2212 15

1. Do not rely on guidelines, test with users

2. Base GUI design on use cases

3. Make sure user can complete a task as simply as possible

4. Ensure user knows what to do next

5. Give good feedback and good error messages

6. Ensure user can go back or undo

7. Ensure response time is adequate

8. Use clear encoding techniques

9. Ensure UI is uncluttered

10. Consider needs of different types of users

11. Provide help

12. Be consistent

Warm Up Chapter 7 Find two ways to improve the following user interface (red is the user’s data

entry)

Warm ups for cs2212 16

CUSTOMER MENU

1. Add Customer

2. Modify Customer

3. Delete Customer

Enter your choice: 1

Enter Customer First Name: Homer

Enter Customer Last Name: <enter>

Error, Try Again

Enter Customer Last Name: Simpson

Done

Answers:1.Commands should NOT be numbers2.No way to quit3.Useless error message4.System is in control, not the user

Warm ups for cs2212 17

1. What Unix command allows you to see which groups you are assigned too?

2. What Unix command lists the groups for each file in a directory?

3. What would you type to put the file test1.c into the group fytemarkers

4. What would you type to allow other members in the fytemarkers group to have READ access to that file?

5. Can someone in the fytemarkers group READ the file called ReadMe.txt?

YESWhy?

Warm Up: Unix Commands

Chapter 8 Warm Up: Sequence Diagram Draw a sequence diagram to allow a customer to book a hotel room for several

days based on the following class diagram:

Warm ups for cs2212 18

HotelChain

ConstructorbookHotel(dates,hotel)

cancelBooking(dates,hotel)

Hotel

ConstructormakeReservation(date)roomAvailable(date)

cancelReservation(date)

Reservation

ConstructornotifyCustomer()

Confirmation

Constructor1 1

1 1..*1

*

aHotelChain:HotelChain

aHotel:Hotel

aReservation: Reservation

aConfirmation:Confirmation

bookHotel(date,aHotel) makeReservation(date)

create

create

notifyCustomer

loop

roomAvailable(date)

startDate…endDate

Chapter 8 Warm Up State Diagram Draw a state diagram for a door. The door can be in 1 of 3 states:

Opened, Closed, or Locked. NOTE: trigger[guard]/effect or action

Warm ups for cs2212 19

What causes the object to move from one state to another state.

Must be true to move to the next state.

Represents the task that ran causing the transition.

Eg. 1 reachedSecondSpeed[driveSelected]

Eg. 2 do/playMusic

Opened Closed

Locked

unlock/

closed/[doorway is empty]

lock/

open/

install door

Warm ups for cs2212 20

Warm Up – Coupling and Cohesion

1. We want ____________ coupling

2. We want ____________ cohesion

3. What is wrong, in terms of coupling and cohesion with the following function header:void junk (int a, int b, int c, int d, char x, char y, char z, char w);

Answers

1. Low

2. High

3. Too many parameters (data coupling), bad function name, clearly trying to do to many things (no functional cohesion), bad parameter names

Warm ups for cs2212 21

Warm Up – Coupling and Cohesion 1. Name 3 types of coupling listed in the book (there are 8 to choose

from)

2. Name 3 types of cohesion listed in the book (there are 7 to choose from)

3. Which type of coupling involves global variable?

4. Which type of cohesion involves passing data that was output from one method as input to another method?

Answers:

• Content, Common, Control, Stamp, Data, Type, Import/Inclusion, External

• Functional, Layer, Communicational, Sequential, Procedural, Temporal, Utility

• Common

• Sequential

Warm ups for cs2212 22

Warm Up – Testing

1. If you plan to test all the functions and methods at the lowest levels, you would need to write lots of ___________ to test those functions.

2. Functional testing is:a) Black box testingb) White box testing

3. Unit testing is the last type of testing done: TRUE OR FALSE

Answers:

• Drivers

• a)

• False

Warm ups for cs2212 23

Warm Up – Testing

1. gcov finds bugs: TRUE or FALSE

2. gcov generates extra files: TRUE or FALSE

3. Node coverage is stronger than edge cover: TRUE or FALSE

4. A whole c program could be on 1 line (no carriage returns) and thus always give 100% line coverage via gcov: TRUE or FALSE

Answers:

• FALSE

• TRUE

• FALSE

• TRUE

Warm ups for cs2212 24

Warm Up – Testing 1. Which lines would NOT be included

in gcov’s counting of the lines executed

2. In this situation, is line coverage for the above program the same as statement coverage?

3. What is the minimal number of test case(s) (show those test cases) to get 100% line coverage (if 100% line coverage is possible)?

Answers:

• The following lines are NOT counted: 1, 3, 4,13,16, 20 (for some reason, it counts line 2 BUT NOT line 20?????)

• No because of line 15

• You would need 2 test cases: Test case 1: x=-1, y=2 Test case 2: x=3, y=-1

int main() //1{ //2 int x; //3 int y; //4 int z=0; //5 printf("\nEnter x:"); //6 scanf ("%d", &x); //7 printf("\nEnter y:"); //8 scanf("%d", &y); //9 z = x+y; //10 if (z>x) //11 printf("\nHi"); //12 else //13 printf("\nBye"); //14 if (z>y) printf ("\nYes"); //15 else //16 printf("\nNo"); //17 printf("\nAll Done"); //18 return 0; //19} //20

Warm ups for cs2212 25

Warm Up – Functional Testing NOTE: this question was from the 2000 final exam) Create a minimal list of test

cases for size and arr to thoroughly test the functionality of this function:int second (int arr[], int size)

/* arr is an array of at most 5 integers; size is the actual number of integers stored in arr. second returns the position of the second largest value found in the first “size” locations of arr. A return value of -1 indicates an error */

Possible Answer:arr size Expected Result Tests

5 2 Typical case

1 -1 No second largest exists

0 -1 Empty array

4 -1 Size incorrect for num of elements in arr

-1 -1 Size negative

6 -1 Size bigger than possible arr

2 0 Only 2 elements, does it still work?

3 0 or 1 or 2 All numbers the same

7 8 9 10 7

9 12 15

11 15 20

2 4 1 9 7

7 8

7 7 7

7