Professional Documents
Culture Documents
2k19-Se-048 Exp-8
2k19-Se-048 Exp-8
TECHNOLOGICAL
UNIVERSITY
SOFTWARE
ENGINEERING
Experiment-8
Code:
# include<stlib.h>
(2) {
(3) int a, b, c, d, boolean = 0;
(4) double D;
(11) if ((a > =0) && (a < = 100) && (b > = 0) && (b < =100) && (c > =0) && (c <
=100)) {
(12) boolean = 1;
(13) if (a = = 0) {
(14) boolean = -1
(15) }
(16) }
(17) if (boolean = = 1) {
(18) d = b * b - 4 * a * c;
(19) if (d = = 0) {
(20) printf (“roots are equal and real r1= r2 = %f" b/(2 * float));
(21) }
(24) printf (“roots are real and are r1=%f and r2=%f" (-b – D)/(2 * a), (-b + D)/(2 *
a));
(25) }
(26) else {
(29) }
(30) }
(33) }
(34) else {
(36) }
(37) getch ( ):
(38) return 0;
(39) }
Flow Graph:
DD Path Graph:
Since, nodes 1-10 are sequential nodes in the above flow graph, hence they
are merged together as a single node i.e.,a. Since node 11 is a decision node,
thus we cannot merge it any more. Likewise we can go on deciding the
merging of nodes & arrive.
We get following decision table.
Here e are the number of edges and n are the number of nodes.
V(G) = 24 – 19 + 2
=7
Path 4: a -> b -> c -> d -> e -> g -> n -> o -> q -> r
Path 6: a -> b -> f -> g -> h -> i -> k -> m -> q -> r
Path 7: a -> b -> f -> g -> h -> j -> l -> m -> q -> r
Conclusion
Each of these paths consists of at least one new edge. Hence this basis set of
paths is NOT unique.
We must execute these paths at least once in order to test the program
thoroughly.
Code:
# include <stdlib.h>
(2) {
(11) if ((a + b) > c) && ((c + a) > b) && ((b + c) > a)) {
(12) boolean = 1;
(13) }
(14) }
(15) else {
(17) }
(18) if (boolean = = 1) {
(21) }
(24) }
(25) else {
(27) }
(28) }
(31) }
(32) else
(34) }
(35) getch ( );
(37) }
Flow Graph:
DD Path Graph
Since, nodes 1-9 are sequential nodes in the above flow graph, hence they are
merged together as a single node a.
Here e are the number of edges and n are the number of nodes.
V(G) = 23 – 18 + 2
=7
Identification of the basis-set with Seven Paths
Path 1: a -> b -> c -> e -> g -> n -> o -> q
Conclusion
Each of these paths consists of at least one new edge. Hence this basis set of
paths is NOT unique.
We must execute these paths at least once in order to test the program
thoroughly.