Sunteți pe pagina 1din 2

Software Testing(cse5325)

Group Assignment (15 mark)


1. Use the following program to answer the question below
w=x; // node 1
if(m>0){
w++; // node 2}
else{
w=w*2; // node 3}
// node 4 (no executable statement)
if(y<=10){
x=5*y; // node 5}
else{
x=3+y*5; // node 6}
z=w+x; // node 7}
A)
B)
C)
D)

Draw a control flow graph for this program fragment


Which nodes have defs for variable w?
Which nodes have uses for variable w?
Are there any du-paths with respect to variable w from node 1 to 7? If not,
explain why not. If any exist ,show one
E) List all du-paths for variable w and x
2. Given the following program answer the question below
A) Draw data flow graph
B) Identify a data flow anomaly in the code given
C) Find a set of complete paths satisfying the all-defs selection criterion with
respect to variable mid
D) Find a set of complete paths satisfying the all-defs selection criterion with
respect to variable high
int binsearch (int x,int V[],int n){
int low,int high,int mid;
low=0;
high=n-1;
while (low<=high){
mid=(low + high)/2
if (x < V[mid])
high = mid - 1;
else if(x>V[mid])
low=mid+1;
else
return mid;}
return -1;
}
3. What is meant by the gap between all -branches testing and all -paths testing
and how does data flow testing fill the gap?

Software Testing(cse5325)
Group Assignment (15 mark)

S-ar putea să vă placă și