NATIONAL INSTITUTE OF TECHNOLOGY ROURKELA-769008
MID-SEMESTER EXAMINATION, 2022
SESSION: 2021 – 2022 (Spring)
B. Tech. 8th / M. Tech. 2ndSemester
Subject code: CS6404 Subject Name: Software Testing Dept. Code: CS
No. of pages: 10 Full Marks: 60 (Sub-40+Quiz-20) Duration: 2hrs
Figures at the right hand margin indicate marks.
All parts of a question should be answered at one place.
Answer all questions.
Subjective Questions
Q. No. Particulars Marks
1. 2*10=20
(a) Design a black-box test suite for a function named find-rectangle-intersection that
accepts four floating point numbers representing two pairs of co-ordinates (x1, y1), (x2,
y2), (x3, y3) , (x4, y4). The first two points (x1, y1) and (x2, y2) represent the lower
left and upper right points of the first rectangle. The second two points (x3, y3) and (x4,
y4) represent the lower left and upper right points of the second rectangle. It is assumed
that the length and width of the rectangle are parallel to either the x-axis or y-axis. The
program computes the points of intersection of the two rectangles and prints their points
of intersection.
Design test cases for the following withdraw cash function of a bank ATM using
(b) decision table-based testing:
To withdraw cash, first a valid customer identification is required. For this, the
customer is prompted to insert his ATM card in the card checking machine. If his card
is found to be invalid, the card is ejected out along with an appropriate apology
message displayed. If the card is verified to be a valid card, the customer is prompted to
type his password. If the password is invalid, an error message is shown and the
customer is prompted to enter his password again. If the customer enters incorrect
password consecutively for three times, then his card is seized and he is asked to
contact the bank manager. On the other hand, if the customer enters his password
correctly, then he is considered to have validly identified himself and is prompted to
enter the amount he needs to withdraw. If he enters an amount that is not a multiple of
Rs. 100, he is prompted to enter the amount again. After he enters an amount that is a
multiple of Rs. 100, the cash is dispensed if sufficient amount is available in his
account, his balance is updated, and his card is ejected; otherwise his card is ejected out
without any cash being dispensed along with a message display regarding insufficient
fund position in his account.
2. 2*10=20
(a) Write a function for finding the even numbers in between 1-100. .
i. Construct the CFG of the above function.
ii. Determine its cyclometic complexity.
iii. Identify the linearly independent paths in the CFG.
iv. Design a test suite for the above function that satisfies path coverage.
P.T.O.
1
(b) Consider the following program:
#include<stdio.h>
main()
{
int p, q, r, s;
clrscr;
printf(“Enter the two variables p, q”);
scanf(“%d %d”, &p, &q);
printf (“Enter the options 1:Addition, 2:substraction, 3:multiplication,
4:division”);
scanf(“%d”, &r);
switch(r)
{
case 1:s = p+q;
printf(“Addition of two numbers = %d”, s);
break;
case 2:s = p-q;
printf(“Subtraction of two numbers = %d”, s);
break;
case 3:s = p*q;
printf(“Multiplication of two numbers = %d”, s);
break;
case 4:s = p/q;
printf(“Division of two numbers = %d”, s);
break;
}
}
Perform static data flow analysis for the above program by finding out the define-use-
kill patterns for the variables p and s in the source code.
2
FM - 20