Software Testing Week 3 Assignment Answers

1. Which of the following represents a basic block in a control flow graph?

  • A basic block of statements is a set of all statements that are a part of a function that the control flow graph represents.
  • A basic block of statements is a sequence of statements such that if the first statement the sequence is executed then all the statements in the sequence will also be executed.
Answer : b

2. Consider a variable count of type int. Suppose there is a method that has a statement of the type count++;. Which of the following statements are correct regarding the data flow definition of count ?

  • The statement is a definition of count.
  • The statement is a use of count.
  • The statement is both a definition and use of count.
  • The statement is neither a definition nor a use of count.
Answer : c

3. Consider a variable x of type double and suppose a particular method in Java has a statement if(Math.log(x)) >= 4.2, will it be considered a definition of x or a use of x ?

  • The statement is a definition of x
  • The statement is a use of x.
Answer : b

4. State true or false: Consider a variable x in a program. Not every definition of x will always reach a use.

  • True.
  • False.
Answer : a

5. Which of the following best defines a du-path for a variable x ?

  • A du-path is a simple path from a definition of x to a use of x without any further definitions of x in-between.
  • A du-path is a path from a definition of x to a use of x without any further definitions of x in-between.
  • A du-path is a simple path from a definition of x to a use of x without any further uses of x in-between.
  • A du-path is a path from a definition of x to a use of x without any further uses of x in-between.
Answer : a

6. State yes or no: We group du-paths with respect to a variable by their definitions.

  • Yes.
  • No.
Answer : a

7. Is it true that the all-du-paths data flow coverage criterion subsumes prime path coverage?

  • Yes.
  • No.
Answer : b

8. Which of the following statements are true when it comes to comparing traditional source code coverage criteria with graph based coverage criteria?

  • Node and statement coverage are the same, edge and branch coverage are the same.
  • Edge and decision coverage are the same.
Answer : a

9. Which of the following defines a linearly independent path of execution in a control flow graph?

  • A path in which there are no branches.
  • A path which does not contain other paths within it.
  • A path that represents structural complexity of a program.
  • A path within a connected component.
Answer : b

10. State true or false: Node and edge coverage, as test requirements for structural coverage over graphs, are given with the input graph itself.

  • True.
  • False.
Answer : a