You are on page 1of 2

AL-RZHAR UNIVERSITY — GAZA

FACULTY OF EIT — SE DEPARTMENT

SOFTWARE TESTING: ITSE 4305


TAKE-HOME FINAL Ex ( 2 PAGES) DM DATE: JUN. 14,2021

.2

Q1) Rewrite the program segment such that compound conditions are replaced by nested if-then-else statements.
Compare the cyclomatic complexity of both versions.
if (a xor (not b or c)) then
print "stmt 1"
else if (a or (b and c)) then
print "stmt 2"
else
print "stmt 3"

Q2) Draw program graph for the following code segment then calculate the cyclomatic complexity of the graph.

int sea(int[] nums, int item) ( int asize = nums.length;


int bsize = (int)Math.floor(Math.sqrt(asize));
int pitem = 0;
while (nums[Math.min(bsize, asize)-1]

item) ( pitem = bsize;


bsize +=
(int)Math.floor(Math.sqrt(asize)); if
(pitem I= asize) return -1;

while (nums[pitem]

item) ( pitem ++;


if (pitem == Math.min(bsize, asize)) return -1;

if (nums[pitem] == item) return

1
Q3) Identify redundant and inconsistent rules of the following decision table. What is the total number of rules?

conditions Rule 1 Rule 2 Rule 3 Rule 4 Rule S Rule 6 Rule 7 Rule 8


C1 T T F F F T T
C2 T F T T F F
C3 T T T F F T T
A1 X X X X
A2 X X X
A3 X

Q4) Identify the DD-paths and the corresponding case definition for the following program graph.

Q5) Develop a limited entry decision table for the following problem for a book store company. The company
offers sales using their mobile app, website, or phone sales. The company provides discount based on order
method.
The details of actions are as follows:
If the customer uses mobile app to make an order and the order is more than $100, the discount is %10.
If the customer uses mobile app to make an order and the order is less than or equals to $100, the
discount is %7.
If the customer uses the website to make an order and the order is more than $200, the discount is to10.
If the customer uses the website to make an order and the order is less than or equals to $200, the
discount is %7.
If the customer uses phone to make an order and the order is more than $500, the discount is %10.
If the customer uses phone to make an order and the order is less than or equals to $500, the discount is
9o7.

You might also like