Professional Documents
Culture Documents
2. Identify the appropriate process model for suitable software product development.
3. Interpret the requirements, analysis, design of product and able to test it with recent software
development tools.
4. Test the software for its quality using various testing tools as per the framework.
5. Demonstrate the new product with existing component-based development and perform
configuration management.
Class Test
Q.No Questions Marks CO BTL
1. Calculate 10 1 4
cyclomatic
complexity for the
given code-
IF A = 354
THEN IF B > C
THEN A = B
ELSE A = C
END IF
END IF
PRINT A
2 Calculate 10 1 2
cyclomatic
complexity for the
given code-
{ int i, j, k;
p[i] = 1;
k = p[i]; j=1;
p[j] = p[j-1];
j--;
p[j]=k;
3 Calculate 10 1 3
cyclomatic
complexity for the
given code-
begin int x, y,
power;
float z;
input(x, y);
if(y<0)
power = -y;
else power = y;
z=1;
while(power!=0)
{ z=z*x;
power=power-1;
} if(y<0)
z=1/z;
output(z);
end
ANSWERS
1. To calculate the cyclomatic complexity of the given code, we need to determine the number of
independent paths through the code. The formula for cyclomatic complexity is given by:
M = E - N + 2P
Where:
M = Cyclomatic complexity
E = Number of edges
N = Number of nodes
In this case, let's break down the code into nodes, edges, and connected components:
Nodes:
1. IF A = 354
2. THEN IF B > C
3. THEN A = B
4. ELSE A = C
5. END IF
6. END IF
7. PRINT A
Edges:
Connected Components:
N = 7 (number of nodes)
E = 7 (number of edges)
M = E - N + 2P
= 7 - 7 + 2(1)
=2
2. To calculate the cyclomatic complexity of the given code, we need to determine the number of
independent paths through the code. The formula for cyclomatic complexity is given by:
M = E - N + 2P
Where:
M = Cyclomatic complexity
E = Number of edges
N = Number of nodes
In this case, let's break down the code into nodes, edges, and connected components:
Nodes:
9. Assignment statement (j = 1)
Edges:
Connected Components:
N = 13 (number of nodes)
E = 13 (number of edges)
M = E - N + 2P
= 13 - 13 + 2(1)
=2
3. To calculate the cyclomatic complexity of the given code, we need to determine the number of
independent paths through the code. The formula for cyclomatic complexity is given by:
M = E - N + 2P
Where:
M = Cyclomatic complexity
E = Number of edges
N = Number of nodes
In this case, let's break down the code into nodes, edges, and connected components:
Nodes:
6. Else statement
8. Assignment statement (z = 1)
Edges:
Connected Components:
N = 16 (number of nodes)
E = 17 (number of edges)
M = E - N + 2P
= 17 - 16 + 2(1)
=3