Week 4 Flashcards

1
Q

Please choose the correct order in terms of the power of the different levels of control flow coverage.

Statement coverage < decision/condition coverage < decision coverage < multiple condition coverage

Statement coverage < decision coverage < decision/condition coverage < multiple condition coverage

Statement coverage < decision coverage < multiple condition coverage < decision/condition coverage

Decision coverage < Statement coverage < decision/condition coverage < multiple condition coverage

A

Statement coverage < decision coverage < decision/condition coverage < multiple condition coverage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Question 5
Given the code below, how many test cases are needed to achieve 100% multiple condition coverage?

If a < 12 and b = 5 or c > 15

X = 50;

Else

X = 25;

1 point

8

3

2

6

A

8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Given the code below, which set of test cases will achieve 100% decision condition coverage?

If a < 12 and b = 5 or c > 15

X = 50;

Else

X = 25;

1 point

3

6

8

2

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Prompt: Given the code below, which set of test cases will achieve 100% decision coverage?

If a < 12 and b = 5 or c > 15

X = 50;

Else

X = 25;

If X = 25

Z = 12;

Else

Z = 15;

1 point

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 1: A = 11, B=5, C=20, X=50

Test Case 1: A=15, B=3, C=8, X=25

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 2: A=15, B=3, C=8, X=25

A

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 2: A=15, B=3, C=8, X=25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Given the code below, which set of test cases will achieve 100% statement coverage?

If a < 12 and b = 5 or c > 15

X = 50;

Else

X = 25;

If X = 25

Z = 12;

Else

Z = 15;

1 point

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 2: A=15, B=3, C=8, X=25

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 1: A=15, B=3, C=8, X=25

Test Case 1: A = 11, B=5, C=20, X=50

A

Test Case 1: A = 6, B=5, C=17, X=50

Test Case 2: A=15, B=3, C=8, X=25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False? Thoroughly executing all requirements guarantees full code coverage.

1 point

False

True

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the cyclomatic complexity of the given control flow diagram?

1

4

3

7

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

TF_T, F_TT, TT_T, F_FT, TF_F are possible basis paths for the given control flow diagram.

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True or False? The number of basis paths is the minimum number of paths needed to build test cases and linear combinations for every other possible path.

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is not a variable set used in definition use coverage?

S-Use(i)

P-Use(i)

Def(i)

C-Use(i)

A

S-Use(i)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False? A definition use path is not always along a definition clear path.

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Given the code below, what is the correct set of DU Paths?

1 / 1 point

Def1(a) = USEI(a) || USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def1(a) = USEI(a) || USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c)

Def3(c) = USE4(c)

Def1(a) = USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

Def1(a) = USEI(a) || USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

A

Def1(a) = USEI(a) || USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Based on the code and the DU paths determined in Q3, what coverage do the test cases below provide?

A = 3; B=2

A=6, B=5

4/8

5/8

7/8

6/8

A

Def1(a) = USEI(a) || USE3(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

6/8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False? Static analysis models the flow of the data in a program by looking at where variables are defined and used.

1 / 1 point

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is not an example of a data flow anomaly?

1 / 1 point

Variable defined then redefined without being referenced

Defining a variable but never using it

Referencing an undefined variable

Variable is defined then referenced

A

Variable is defined then referenced

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Question 1

Given the code below, what is the final symbolic value of X?

(0) Input X, Y
(1) Y = X + 1
(2) Z = Y
(3) X = X + Z

1 / 1 point

2x0 + 2

2X0

2X0 + 1

X0 + 1

A

2X0 + 1

17
Q

True or False? Symbolic execution must be performed for each path if there are multiple paths.

A

True

18
Q

GQ - True or False? Statement coverage always satisfies decision coverage.

A

False

19
Q

GQ - Given the code below, which set of test cases will achieve 100% statement coverage?

If a < 5 or b > 7

X = 50;

c = a + b;

Else

X = 25;

c = a – b;

If X = 50 and c > 6

Z = 10;

Else

Z = 12;

1 point

Test Case 1: a=3, b=10, c=13, X=50

Test Case 2: a=1, b=2, c=3, X=50

Test Case 1: a=2, b=10, c=12, X=25

Test Case 2: a=3, b=4, c=4, X=25

Test Case 1: a=3, b=10, c=13, X=50

Test Case 2: a=5, b=1, c=4, X=25

Test Case 1: a=2, b=10, c=12, X=50

Test Case 2: a=5, b=1, c=4, X=25

A

Test Case 1: a=3, b=10, c=13, X=50

Test Case 2: a=5, b=1, c=4, X=25

20
Q

GQ - Given the code below, how many test cases are needed to achieve 100% multiple condition coverage?

If a < 10 or b < 5 or c > 15 or d > 2

X = 10;

Else

X = 20;

1 point

8

2

4

16

A

16

21
Q

GQ - Given the code below, which set of test cases will achieve 100% decision coverage?

If a < 5 or b > 7

X = 50;

c = a + b;

Else

X = 25;

c = a – b;

If X = 50 and c > 6

Z = 10;

Else

Z = 12;

1 point

Test Case 1: a=2, b=10, c=12, X=25

Test Case 2: a=3, b=4, c=4, X=25

Test Case 1: a=3, b=10, c=13, X=50

Test Case 2: a=1, b=2, c=3, X=50

Test Case 1: a=3, b=10, c=13, X=50

Test Case 2: a=3, b=4, c=4, X=25

Test Case 1: a= 3, b=10, c=13, X=50

Test Case 2: a=5, b=1, c=4, X=25

A

Test Case 1: a= 3, b=10, c=13, X=50

Test Case 2: a=5, b=1, c=4, X=25

22
Q

GQ - True or False? Structured testing provides a strategy for testing a subset of paths.

1 point

True

False

A

true

23
Q

GQ - Given the code below, what is the correct set of DU Paths?

1 point

Def1(a) = USEI(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c)

Def3(c) = USE4(c)

Def1(a) = USEI(a)

Def1(b) = USEII(b)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

Def1(a) = USEI(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def1(a) = USEI(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

A

Def1(a) = USEI(a)

Def1(b) = USEII(b)

Def1(x) = USE2(x)

Def2(c) = USE4(c) || USE5(c)

Def3(c) = USE4(c) || USE5(c)

24
Q

GQ - True or False? Data flow definition / use testing strives to ensure each definition is testing with all of its uses along a definition clear path.

A

True

25
Q

GQ - True or False? Huang’s Theorem helps reduce the number of iterations over a path during anomaly testing.

A

True

26
Q

GQ - Given the code below, what is the final symbolic value of Z?

(0) Input X, Y, Z
(1) Y = 2*X + Z
(2) W = Y + X
(3) Z = W + Y

5X0​+{{2Z_0}}2Z0​

{5X_0}5X0​+{{Z_0}}Z0​

{3X_0}3X0​+{{2Z_0}}2Z0​

{3X_0}3X0​+{{Z_0}}Z0​

A

5X0​+{{2Z_0}}2Z0​

27
Q

What is the correct path condition representation for a False False path given the code below?

If (x <= 0) or (y <= 0) (0)

then

x = x2 (1)

y = y2

else

x = x + 1 (2)

y = y + 1

endif

if (x < 1) or (y < 1)

then

x = x + 1 (3)

y = y + 1

else

x = x – 1 (4)

y = y - 1

endif

1 point

[({x_0}x0​ > 0) or ({y_0}y0​ > 0)] and [(({x_0}x0​ >= 0) or ({y_0}y0​>= 0)]

[({x_0}x0​ > 0) and ({y_0}y0​ > 0)] and [({x_0}x0​ >= 0) or ({x_0}x0​ >= 0)]

[({x_0}x0​ > 0) and ({y_0}y0​ > 0)] and [(({x_0}x0​ >= 0) and ({y_0}y0​>= 0)]

[({x_0}x0​ > 0) or ({y_0}y0​ > 0)] and [({x_0}x0​ >= 0) and ({y_0}y0​ >= 0)]

A

[({x_0}x0​ > 0) and ({y_0}y0​ > 0)] and [(({x_0}x0​ >= 0) and ({y_0}y0​>= 0)]