Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

M363

Software Engineering with Objects


Practice Questions for Final Exam
1.You are required to practice all exercises and SAQs from the units

2. You are required to practice questions similar to the following:

 Draw a sequence diagram that is equivalent to the given communication diagram


 Draw a communication diagram that is equivalent to the given sequence diagram
 Draw a communication diagram that is equivalent to the given activity diagram
 Answer questions based on the given use case/class/ sequence/state chart/
communication diagram

3. You are required to practice the following examples to find Integrity


of the server

Formula: integrityattack = 1 - threatattack (1 - securityattack)

Question-1

A web server has been running for a month. From the log files for that month we see
that, of 2000 accesses, 100 attacks were made. Of these, 50 were denial-of-service
attacks, of which 10 were successful, 25 were password guessing (of which none were
successful) and 25 were accidental attacks (caused by errors on the part of the user), of
which 25 were successful. Find the integrity of the server.

Solution

Step1: Determine the type of attacks and fill up the first column

Step2: Compute the value threatattack and fill up the second column

threatattack = number of attacks/total accesses

Practice Questions Page 1


Step3: Compute the value securityattack and fill up the third column

securityattack = number of failures/number of attacks

Step4: Compute the value Integrity and fill up the fourth column

integrityattack = 1 - threatattack (1 - securityattack)

Step5: Compute the value Integrity

integrity = Σattack integrityattack

Attack Type Threat Security Integrity

Denial of Service 50/2000=0.025 40/50=0.8 1- 0.025 x (1-08)=0.995

Password 25/2000=0.0125 25/25=1 1-0.0125 x (1-1) = 1


Guessing

Accidental 25/2000=0.0125 0/25=0 1-0.025 x (1-0)= 0.9875

The integrity of the server = 0.995 + 1 + 0.9875 = 2.9825

Question-2

A web server has been running for a month. From the log files for that month we see
that, of 10000 accesses, 500 attacks were made. Of these 300 denial-of-service
attacks, of which 99 were successful. 200 password guessing, of which none were
successful. Find the integrity of the server

Solution

Step1: Determine the type of attacks and fill up the first column

Step2: Compute the value threatattack and fill up the second column

threatattack = number of attacks/total accesses

Step3: Compute the value securityattack and fill up the third column

securityattack = number of failures/number of attacks

Step4: Compute the value Integrity and fill up the fourth column

integrityattack = 1 - threatattack (1 - securityattack)

Step5: Compute the value Integrity

Practice Questions Page 2


integrity = Σattack integrityattack

Attack Type Threat Security Integrity

Denial of service 300/10000 = 0.03 201/300 = 0.67 1 - 0.03*(1-0.67) = 0.9901

Password 200/10000 = 0.02 200/200 = 1 1 - 0.02*(1-1) = 1


Guessing

The integrity of the server = 0.9901 + 1 = 1.9901

4. You are required to practice the following examples to find LOC


and cyclomatic complexity

Question 1

1. Calculate the following metrics for the given Java method Test
a. LOC
b. cyclomatic complexity metrics
2. Determine an appropriate set of white box tests for the Test method as follows:
a. a value of x to skip the while loop
b. a value of x to enter the while loop once
c. a value of x to enter the while loop more than once

public void Test(int x) {


while ((x==10) || (x==9)) {
System.out.println(“x = “ + x);
x--;
} // end while
}

Solution

1. a. LOC = 6 (number of lines in the given Java Method)


b. cyclomatic complexity = 3

cyclomatic complexity starts with a value 1 + 1 while loop + 1 OR (II) statement = 3

2. a. x = 5 (or any value except 9 and 10)

b. x = 9

c. x =10

Practice Questions Page 3


Question 2

1. Calculate the following metrics for the given Java method Test
a. LOC
b. cyclomatic complexity metrics

2. Determine an appropriate set of white box tests for the Test method as follows:
a. A value of x to skip the while loop.
b. A value of x to enter the while loop once
c. A value of x to enter the while loop more than once.

Public double Test ( int x, int max )

int result = 0 , i = 0 ;

if (x < 0)

x = - x ;

while (( x >=1 ) && ( x <= 10 ))

{ i := i + 1 ;

result := result + i ;

if (result <= max)

System.out.println( result );

else

System.out.println ( “too large” )

Solution
1. a. LOC = 12 (number of lines in the given Java Method)
b. cyclomatic complexity = 5

cyclomatic complexity starts with a value 1 + 1 while loop + 1 AND (&&) statement + 2 if
statements= 5

2. a. X = 0, or (any value > 10, and any value < -10)

Practice Questions Page 4


b. x = 10, or x = -10
c. any value between 1..9 or -9..-1

5. You are required to practice performing FP analysis and apply the


basic COCOMO model: Examples
Question 1

1. Apply the CBO metric to class Loan


2. Perform a FP Analysis and apply the basic COCOMO model to obtain the effort
and the duration to develop a software system for the library using given use case
and class diagrams. Assuming that:

 The weight of each use case is 7 and the weight of each class is 9.
 The summation value for all of the 14 complexity factors (Fj ) is 25.
 The system is simple and it will be written using Java language.

Practice Questions Page 5


Solution

1. CBO : Coupling-between-objects (CBO) metric is = 2


2. Steps

Step 1: Find FP

Number of use cases: Fu = 6

Weight of use cases: Wu = 7

Number of classes: Fc = 3

Wight of classes: Wc = 9

According to these information: FP = Fu x W u + Fc x W c = 6 x 7 + 3 x 9 = 42 + 27 = 69

Based on the equation: 𝐹𝑃𝑎𝑑𝑗𝑢𝑠𝑡𝑒𝑑 = 𝐹𝑃 ×(0.65+0.01 ×Σ𝐹𝑗 )

Given that Fj = 25, Then: (The summation value for all of the 14 complexity
factors is 25)

𝐹𝑃𝑎𝑑𝑗𝑢𝑠𝑡𝑒𝑑 = 69 x (0.65 + 0.01 x 25) = 69 x 0.9 = 62.1

Step 2: apply COCOMO to obtain effort and duration

Find LOC using Table 2.1:

LOC = 60 (Java) per FP

LOC = 60 * 62 = 3750 (approximately) = 3.75 KLOC

With the aid of parameters in Table 2.2

(The system is simple, so a= 2.4 and c= 2.5)

Effort is:

E = a∙(KLOC)b

E = 2.4 X (3.75)1.05 = 9.6 person-month.

Duration is:

D = c∙Ed

D = 2.5 X (9.6)0.38 = 5.9 months.

Practice Questions Page 6


Question 2
1. What are the CBO and DIT of Class Assignment in figure
2. Perform a FP analysis and apply the basic COCOMO model (showing all your
calculations) to obtain the effort and the duration of the system appeared in figure
assuming that:
 The weight of each use case is 6 and the weight of each class is 7.
 The summation value for all of the 14 complexity factors is 30.
 The system is embedded and it will be written using object oriented language.
Hint: FPadjusted = FP × ( 0.65 + 0.01 × ∑Fi )

Solution

1. CBO : Coupling-between-objects (CBO) metric is = 2


DIT: Depth-of-inheritance-tree (DIT) metric is 0
2. Steps

Practice Questions Page 7


Step 1: Find FP

Number of use cases: Fu = 4

Weight of use cases: Wu = 6

Number of classes: Fc = 3

Wight of classes: Wc = 7

According to these information: FP = Fu x W u + Fc x W c = 4x6 + 3x7 = 24+21 = 45

Based on the equation:

𝐹𝑃𝑎𝑑𝑗𝑢𝑠𝑡𝑒𝑑 = 𝐹𝑃 ×(0.65+0.01 ×Σ𝐹𝑗 )

Given that Fj = 30, Then: (The summation value for all of the 14 complexity
factors is 30)

𝐹𝑃𝑎𝑑𝑗𝑢𝑠𝑡𝑒𝑑 = 45*(0.65 + 0.01*30) = 43

Step 2: apply COCOMO to obtain effort and duration

Find LOC using Table 2.1:

LOC = 30 (Object oriented language) per FP

LOC = 43x30=1290 LOC (approximately)

= 1.290 KLOC

With the aid of parameters in Table 2.2

(The system is embedded, so a= 3.6 and c= 2.5)

Effort is:

E = a∙(KLOC)b

E = 3.6x(1.290)1.20 = 4.88 person-month.

Duration is:

D = c∙Ed

D = 2.5x(4.88)0.32 = 4.2 months

Wish youGood Luck 

Practice Questions Page 8

You might also like