retagged by
5,209 views
2 2 votes

Find if the following statements in the context of software testing are TRUE or FALSE.
(S1): Statement coverage cannot guarantee execution of loops in a program under test.

(S2): Use of independent path testing criterion guarantees execution of each loop in a program under test more than once.

  1. True, True
  2. True, False
  3. False, True
  4. False, False

4 Answers

2 2 votes

The statement coverage strategy aims to design test cases so that every
statement in a program is executed at least once
. The principal idea governing
the statement coverage strategy is that unless a statement is executed, it is very
hard to determine if an error exists in that statement. Unless a statement is
executed, it is very difficult to observe whether it causes failure due to some
illegal memory access, wrong result computation, etc. However, executing some
statement once and observing that it behaves properly for that input value is no
guarantee that it will behave correctly for all input values. 

Example: Consider the Euclid’s GCD computation algorithm:
 int compute_gcd(x, y) 
 {

  int x, y;
  while (x! = y){
   if (x>y) then
      x= x – y;
   else

     y= y – x;
  }
  return x;
 }

By choosing the test set {(x=3, y=3), (x=4, y=3), (x=3, y=4)}, we can exercise the 
program such that all statements are executed at least once. 

Thus we can conclude that (S1) is FALSE.


The path-coverage testing does not require coverage of all paths but only coverage of linearly independent paths.The path coverage-based testing strategy requires us to design test cases such that all linearly independent paths in the program are executed at least once.

Linearly independent path ( WRT Control Flow Graph )

A linearly independent path is any path through the program that introduces at least one new edge that is not included in any other linearly independent paths. If a path has one new node compared to all other linearly independent paths, then the path is also linearly independent.

Thus (S2) is TRUE.

C) is the answer.

0 0 votes
The correct answer is False, False.

(S1) is false because statement coverage is a testing criterion that aims to ensure that every statement in the program under test is executed at least once. This includes statements inside loops, so statement coverage can guarantee the execution of loops in a program.

(S2) is also false. Independent path testing is a testing criterion that aims to ensure that every independent path through the program is executed at least once. An independent path is a sequence of statements that can be executed without the execution of any other statements in the program. However, independent path testing does not guarantee the execution of each loop in a program more than once. It only guarantees that every independent path is executed at least once, regardless of whether it includes a loop or not.
0 0 votes

Let's evaluate each statement:

(S1): Statement coverage cannot guarantee execution of loops in a program under test.

  • True: Statement coverage ensures that all statements in the code are executed at least once. However, this does not guarantee that loops will be executed multiple times or even cover all possible loop iterations. For example, a loop may be executed only once or not at all (if the loop condition is false initially), and statement coverage would still consider it covered. So, statement coverage does not ensure that loops are exercised adequately.

(S2): Use of independent path testing criterion guarantees execution of each loop in a program under test more than once.

  • False: Independent path testing, which is part of basis path testing in structured testing, ensures that all independent paths (each new path introduces a unique set of conditions) in the program are executed. However, this criterion does not specifically ensure that loops are executed more than once. For loops, independent path testing might execute a loop zero or one time but does not guarantee execution beyond that.

Conclusion:

  • (S1) is True.
  • (S2) is False.

Correct Answer:

(b) True, False.

Answer:
Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
3.5k
3.5k views
Ishrat Jahan asked Oct 28, 2014
3,529 views
Which of the following requirement specifications can be validated?S1: If the system fails during any operation, there should not be any loss of dataS2: The system must ...
0 0 votes
2 2 answers
2.5k
2.5k views
Ishrat Jahan asked Oct 28, 2014
2,492 views
A software engineer is required to implement two sets of algorithms for a single set of matrix operations in an object oriented programming language; the two sets of algo...
0 0 votes
1 answers 1 answer
4.5k
4.5k views
Ishrat Jahan asked Oct 28, 2014
4,464 views
A software project plan has identified ten tasks with each having dependencies as given in the following table:TaskDepends OnT1-T2T1T3T1T4T1T5T2T6T3T7T3, T4T8T4T9T5, T7, ...
2 2 votes
1 answers 1 answer
3.6k
3.6k views
Ishrat Jahan asked Oct 28, 2014
3,605 views
Which of the following are NOT considered when computing function points for a software project?(O1) External inputs and outputs(O2) Programming language to be used f...