Tag: testing

Questions Related to testing

Consider the following statements: i.100% statement coverage guarantees 100% branch coverage. ii.100% branch coverage guarantees 100% statement coverage. iii.100% branch coverage guarantees 100% decision coverage. iv.100% decision coverage guarantees 100% branch coverage. v.100% statement coverage guarantees 100% decision coverage.

  1. A. ii is True; i, iii, iv & v are False

  2. B. i & v are True; ii, iii & iv are False

  3. C. ii & iii are True; i, iv & v are False

  4. D. ii, iii & iv are True; i & v are False


Correct Option: D

AI Explanation

To answer this question, we need to understand the concepts of statement coverage, branch coverage, and decision coverage.

Statement coverage refers to the percentage of statements in the code that have been executed during testing. It measures how many statements have been covered by the test cases.

Branch coverage refers to the percentage of branches in the code that have been executed during testing. It measures how many branches have been covered by the test cases.

Decision coverage refers to the percentage of decision outcomes in the code that have been executed during testing. A decision outcome is a Boolean expression that results in a true or false value. It measures how many decision outcomes have been covered by the test cases.

Now let's go through each statement to determine its correctness:

i. 100% statement coverage guarantees 100% branch coverage. This statement is false. While achieving 100% statement coverage does cover all the branches, it does not guarantee that all the branches have been covered.

ii. 100% branch coverage guarantees 100% statement coverage. This statement is false. Achieving 100% branch coverage means that all the branches have been covered, but it does not guarantee that all the statements have been covered.

iii. 100% branch coverage guarantees 100% decision coverage. This statement is true. Achieving 100% branch coverage ensures that all the decision outcomes have been covered, as each branch represents a decision outcome.

iv. 100% decision coverage guarantees 100% branch coverage. This statement is true. Achieving 100% decision coverage ensures that all the branches have been covered, as each decision outcome corresponds to a branch.

v. 100% statement coverage guarantees 100% decision coverage. This statement is false. Achieving 100% statement coverage does not guarantee that all the decision outcomes have been covered.

Based on the explanations above, the correct answer is:

D. ii, iii & iv are True; i & v are False

  1. Observability

  2. Simplicity

  3. Stability

  4. All of the above


Correct Option: D
  1. Incorrect or missing functions

  2. Interface errors

  3. Performance errors

  4. All of the above

  5. None of the above


Correct Option: D
  1. Behavioral errors

  2. Logic errors

  3. Performance errors

  4. Typographical errors

  5. Both b and d


Correct Option: E

The cyclomatic complexity metric provides the designer with information regarding the number of

  1. Cycles in the program

  2. Errors in the program

  3. Independent logic paths in the program

  4. Statements in the program


Correct Option: C

AI Explanation

To answer this question, we need to understand the concept of cyclomatic complexity.

Cyclomatic complexity is a software metric that measures the complexity of a program by analyzing the number of independent paths through the program's source code. It provides the designer with information about the number of decision points or branches in the program.

Option A) Cycles in the program - This option is incorrect. Cyclomatic complexity is not directly related to cycles in the program. It measures the number of independent paths, not the number of cycles.

Option B) Errors in the program - This option is incorrect. Cyclomatic complexity does not provide information about errors in the program. It is a metric used to measure complexity, not to detect errors.

Option C) Independent logic paths in the program - This option is correct. Cyclomatic complexity measures the number of independent logic paths in the program. It helps the designer understand how complex the program is and identify potential areas of complexity that may require additional testing or refactoring.

Option D) Statements in the program - This option is incorrect. Cyclomatic complexity is not concerned with the number of statements in the program. It focuses on the number of decision points or branches.

Therefore, the correct answer is C) Independent logic paths in the program because cyclomatic complexity provides the designer with information about the number of independent logic paths in the program.

  1. Rely on basis path testing

  2. Exercise the logical conditions in a program module

  3. Select test paths based on the locations and uses of variables

  4. Focus on testing the validity of loop constructs


Correct Option: B