Unit 5: Structural Testing Using Automated Tool - Practice Quiz

CSE376 — Automated Testing 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is the main basis for designing structural tests?

Structural Testing Easy
A. The feedback collected from users
B. The visual design of the interface
C. The wording of user documentation
D. The internal structure of the code

2 What is another common name for structural testing?

Structural Testing Easy
A. Acceptance testing
B. White-box testing
C. Black-box testing
D. Usability testing

3 What does code coverage measure?

Data and Code Coverage Easy
A. The amount of code executed by tests
B. The number of defects reported by users
C. The number of requirements in a project
D. The amount of code written each day

4 What does data coverage mainly examine?

Data and Code Coverage Easy
A. Whether every method has a short name
B. Whether every source file has comments
C. Whether relevant input data values are tested
D. Whether all screens use the same colors

5 What does 100% statement coverage mean?

Statement Coverage Easy
A. Every defect was detected at least once
B. Every possible path ran at least once
C. Every requirement passed at least once
D. Every executable statement ran at least once

6 Which formula calculates statement coverage?

Statement Coverage Easy
A. Executed branches divided by total branches
B. Tested methods divided by total methods
C. Detected defects divided by total defects
D. Executed statements divided by total statements

7 What does branch coverage check for an if statement?

Branch Coverage Easy
A. Whether the method returns a value
B. Whether the condition uses two variables
C. Whether both true and false outcomes execute
D. Whether the statement contains a comment

8 A decision has two possible branches, but tests execute only one. What is its branch coverage?

Branch Coverage Easy
A. 75%
B. 50%
C. 25%
D. 100%

9 What does path coverage measure?

Path Coverage Easy
A. The number of inputs in a test
B. The execution of possible program paths
C. The execution speed of program methods
D. The number of files in a project

10 Why can achieving 100% path coverage be difficult?

Path Coverage Easy
A. Programs may contain descriptive comments
B. Methods may contain meaningful names
C. Programs may contain many possible paths
D. Tests may contain expected results

11 What does method coverage measure?

Other Coverages and Understanding Their Differences Easy
A. The variables declared during testing
B. The branches selected during testing
C. The methods called during testing
D. The defects corrected during testing

12 What does condition coverage focus on?

Other Coverages and Understanding Their Differences Easy
A. Individual statements in documentation
B. Individual methods in source files
C. Individual Boolean conditions in decisions
D. Individual values in output reports

13 Which coverage type is generally stronger than statement coverage for testing decisions?

Other Coverages and Understanding Their Differences Easy
A. Branch coverage
B. Class coverage
C. Line coverage
D. Method coverage

14 What is EclEmma mainly used for?

Introduction to Code Coverage Tool EclEmma Easy
A. Designing database tables
B. Creating interface mockups
C. Measuring Java code coverage
D. Managing project requirements

15 EclEmma is commonly integrated with which development environment?

Introduction to Code Coverage Tool EclEmma Easy
A. Blender
B. Eclipse
C. Excel
D. Photoshop

16 Which coverage library is used by modern versions of EclEmma?

Introduction to Code Coverage Tool EclEmma Easy
A. JUnit
B. JaCoCo
C. Mockito
D. Selenium

17 In EclEmma's source highlighting, what does a green line normally indicate?

Interpreting Results of EclEmma Easy
A. The line was fully covered
B. The line was not covered
C. The line was partly covered
D. The line contains an error

18 In EclEmma's source highlighting, what does a red line normally indicate?

Interpreting Results of EclEmma Easy
A. The line was not covered
B. The line was fully covered
C. The line was partly covered
D. The line was recently edited

19 What does cyclomatic complexity measure?

Cyclomatic Complexity Easy
A. The number of files stored in a project
B. The number of independent paths through code
C. The number of comments written in code
D. The number of users running a program

20 A simple method has two decision points. What is its cyclomatic complexity using decisions plus one?

Cyclomatic Complexity Easy
A. 4
B. 2
C. 1
D. 3

21 A method validates an age, calculates a discount, and then formats the result. A tester designs cases by examining the method's conditions and loops rather than its requirements. Which testing approach is being applied?

Structural Testing Medium
A. Structural testing
B. Acceptance testing
C. Exploratory testing
D. Usability testing

22 A structural test suite executes every line of a sorting method but never checks whether the returned array is correctly ordered. What is the main weakness of this suite?

Structural Testing Medium
A. It may execute faults without detecting them
B. It must have zero branch coverage
C. It cannot measure statement coverage
D. It cannot test private methods

23 Tests execute all statements in a method, but they use only positive integer inputs. Which additional activity would most directly improve data coverage?

Data and Code Coverage Medium
A. Testing zero, negative, and boundary values
B. Running the same positive tests repeatedly
C. Refactoring the method into fewer lines
D. Removing duplicate assertion statements

24 A program contains 120 executable statements, and a test suite executes 90 distinct statements. What is its statement coverage?

Data and Code Coverage Medium
A.
B.
C.
D.

25 Consider the code: if (score >= 50) result = "Pass"; notifyUser();. Assuming both assignments and method calls are executable statements, which single test is sufficient for statement coverage?

Statement Coverage Medium
A. score = 50
B. score = 0
C. score = 49
D. score = -1

26 A test suite has statement coverage for a method containing an if statement without an else. What can be concluded?

Statement Coverage Medium
A. Every condition value ran independently
B. Every feasible path ran at least once
C. Every executable statement ran at least once
D. Every decision outcome ran at least once

27 For the decision if (age >= 18 && hasId), which test set achieves branch coverage of the overall decision using the fewest tests?

Branch Coverage Medium
A. (17, true) only
B. (18, false) and (17, false)
C. (18, true) only
D. (18, true) and (17, true)

28 A method contains three independent if statements, each with a true and a false outcome. A test suite covers five of the six outcomes. What is the branch coverage?

Branch Coverage Medium
A.
B.
C.
D.

29 A method contains two sequential, independent if statements and no loops. How many combinations of true and false outcomes must be considered for complete path coverage?

Path Coverage Medium
A. 3 paths
B. 6 paths
C. 4 paths
D. 2 paths

30 Why is complete path coverage usually impractical for a method containing an input-controlled loop?

Path Coverage Medium
A. The loop makes assertions impossible to evaluate
B. The loop always creates infeasible branches
C. The loop can produce an unbounded number of paths
D. The loop prevents statements from being instrumented

31 For if (A || B), tests use (A=true, B=false) and (A=false, B=true). They achieve a true result in both cases. Which coverage requirement is definitely not satisfied?

Other Coverages and Understanding Their Differences Medium
A. Line coverage
B. Statement coverage
C. Method coverage
D. Decision coverage

32 A test suite calls every method in a class, but several branches inside those methods are never taken. Which coverage can still be ?

Other Coverages and Understanding Their Differences Medium
A. Path coverage
B. Condition coverage
C. Branch coverage
D. Method coverage

33 Which test set provides condition coverage for if (x > 0 && y > 0) but does not provide branch coverage of the overall decision?

Other Coverages and Understanding Their Differences Medium
A. (1, -1) and (-1, 1)
B. (1, 1) and (-1, 1)
C. (1, 1) and (-1, -1)
D. (1, 1) and (1, -1)

34 A developer wants to measure coverage for a JUnit test class in Eclipse using EclEmma. Which action should be selected?

Introduction to Code Coverage Tool EclEmma Medium
A. Coverage As > JUnit Test
B. Debug As > Eclipse Application
C. Profile As > Maven Build
D. Run As > Java Application

35 What is EclEmma's primary role during automated Java testing in Eclipse?

Introduction to Code Coverage Tool EclEmma Medium
A. Replacing JUnit with a test framework
B. Recording which code elements tests execute
C. Generating assertions from method outputs
D. Repairing defects found by JUnit tests

36 After running tests with EclEmma, a source line is highlighted red. What does this normally indicate?

Interpreting Results of EclEmma Medium
A. The line was not executed
B. The line contains invalid syntax
C. The line executed every branch
D. The line caused a test failure

37 EclEmma highlights a line containing an if statement in yellow after all tests pass. What is the best interpretation?

Interpreting Results of EclEmma Medium
A. The line has complete path coverage
B. The line contains a failed assertion
C. The line was never loaded
D. The line was only partially covered

38 EclEmma reports line coverage but branch coverage for a class. What should the developer investigate first?

Interpreting Results of EclEmma Medium
A. Decision outcomes not exercised by tests
B. Assertions that execute too frequently
C. Methods that contain no statements
D. Classes that were never loaded

39 A method has four binary decision points and one connected control-flow component. What is its cyclomatic complexity?

Cyclomatic Complexity Medium
A. 8
B. 5
C. 4
D. 6

40 A control-flow graph has 12 edges, 9 nodes, and 1 connected component. Using , what is its cyclomatic complexity?

Cyclomatic Complexity Medium
A. 3
B. 6
C. 4
D. 5

41 A payment method achieves 100% statement and branch coverage, but no test checks whether the charged amount matches the business rule. Which conclusion is most defensible?

Structural Testing Hard
A. The method requires only path coverage to prove the business rule
B. The method is structurally exercised, but functional faults may remain undetected
C. The method is correct because every control-flow outcome was executed
D. The method is fault-free unless it contains an infeasible execution path

42 A required authorization check was accidentally omitted from an implementation. Tests are derived only from the implemented control-flow graph and achieve every selected structural coverage target. What is the principal testing risk?

Structural Testing Hard
A. The missing check will increase cyclomatic complexity without changing coverage
B. The missing check will be detected whenever statement coverage reaches 100%
C. The missing check may remain invisible because it creates no structure to cover
D. The missing check will necessarily appear as an uncovered branch in the report

43 Consider:

JAVA
int x = 1;          // d1
if (a) x = 2;       // d2
consume(x);         // u1



Assuming both values of a are feasible, which test requirement is necessary to cover both definition-use pairs ending at u1?

Data and Code Coverage Hard
A. Run one test with a false and one test with a true
B. Run only a test with a true because it executes both definitions
C. Run two tests with a true but different values of x
D. Run only a test with a false because d1 dominates u1

44 In data-flow testing, a path from a definition of variable v to a use of v contains another assignment to v before that use. How should the original definition-use pair be classified?

Data and Code Coverage Hard
A. It is not covered because the intervening assignment kills the definition
B. It is covered only when the second assignment stores the same value
C. It is covered because both the definition and use execute on one path
D. It is infeasible because a variable cannot have multiple definitions

45 For the following code, what is the minimum number of tests required for 100% statement coverage, assuming a and b can independently be true or false?

JAVA
if (a) {
    s1();
} else if (b) {
    s2();
} else {
    s3();
}

Statement Coverage Hard
A. Three tests selecting s1, s2, and s3 separately
B. One test because all statements belong to one conditional chain
C. Four tests covering every combination of a and b
D. Two tests selecting s1 once and both other statements together

46 A single test uses a = true and b = true for the following code:

JAVA
int x = 0;
if (a) x = 1;
if (b) x = 2;
return x;



Which coverage assessment is correct?

Statement Coverage Hard
A. It achieves path coverage because the executed path contains every statement
B. It achieves statement coverage but misses both false branch outcomes
C. It achieves statement and branch coverage because both bodies execute
D. It misses statement coverage because the initial assignment is overwritten

47 For the short-circuit decision if (A && B), a suite contains (A=true, B=true) and (A=false, B=true). Which statement is correct?

Branch Coverage Hard
A. Branch coverage is incomplete because the body executes only once
B. Decision coverage is complete, but B=false has not been exercised
C. Path coverage is complete because the decision has two final outcomes
D. Condition coverage is complete because both input variables have two values

48 What is the minimum number of tests needed for 100% branch coverage of the following code, assuming all combinations are feasible?

JAVA
if (A) {
    if (B) s1();
} else {
    s2();
}

Branch Coverage Hard
A. Three tests for (true,true), (true,false), and one A=false case
B. One test with both conditions evaluating to true
C. Four tests for all combinations of A and B
D. Two tests for (true,true) and (false,false)

49 For two sequential independent decisions, if (A) s1(); followed by if (B) s2();, a suite contains only (true,true) and (false,false). What has the suite achieved?

Path Coverage Hard
A. Full path coverage but only half of the branch outcomes
B. Full branch coverage but only two of the four complete paths
C. Full condition coverage and all four complete execution paths
D. Full statement coverage without complete branch coverage

50 Consider:

JAVA
if (x > 0) s1();
if (x <= 0) s2();



Which statement best characterizes its complete start-to-end paths?

Path Coverage Hard
A. All four outcome combinations are feasible with boundary values
B. Three paths are feasible because x = 0 creates a third case
C. Only the path executing both statements is infeasible
D. Two of the four syntactic outcome combinations are feasible

51 Which four-test suite provides MC/DC for the decision (A && B) || C, assuming logical conditions are considered independently?

Other Coverages and Understanding Their Differences Hard
A. (T,T,F), (F,T,F), (T,F,F), (T,F,T)
B. (T,T,T), (T,T,F), (F,F,T), (F,F,F)
C. (T,T,F), (F,F,T), (T,F,T), (F,T,T)
D. (T,T,T), (F,F,F), (T,F,T), (F,T,F)

52 Under the usual assumption that only feasible, terminating control-flow paths are considered, which implication is generally valid?

Other Coverages and Understanding Their Differences Hard
A. Complete branch coverage implies MC/DC, which implies complete path coverage
B. Complete condition coverage implies path coverage, which implies data-flow coverage
C. Complete path coverage implies branch coverage, which implies statement coverage
D. Complete statement coverage implies branch coverage, which implies path coverage

53 Which description most accurately explains how EclEmma gathers Java coverage information?

Introduction to Code Coverage Tool EclEmma Hard
A. It modifies Java source files by inserting permanent logging statements
B. It uses JaCoCo instrumentation to record execution of Java bytecode
C. It statically explores every feasible source-level execution path
D. It parses JUnit assertions to infer which source statements are correct

54 Why can EclEmma display surprising source-level coverage for compiler-generated constructs such as synthetic methods, implicit branches, or transformed expressions?

Introduction to Code Coverage Tool EclEmma Hard
A. Coverage is collected from bytecode and then mapped back to source lines
B. Coverage treats each source line as exactly one bytecode instruction
C. Coverage is estimated from source formatting and Eclipse syntax coloring
D. Coverage ignores compiled instructions whenever source code is available

55 An EclEmma report shows 100% instruction coverage and 75% branch coverage for a package. Which interpretation is valid?

Interpreting Results of EclEmma Hard
A. Every branch executed, but one-quarter of assertions were unsuccessful
B. Every counted instruction executed, but some decision outcomes did not
C. Every source line executed, so the branch percentage must be inaccurate
D. Every source path executed, but some instructions lacked debug information

56 After collecting coverage, a developer recompiles a class and then generates a report using the earlier execution data. EclEmma reports that the class does not match the execution data. What is the most likely cause?

Interpreting Results of EclEmma Hard
A. The class has a cyclomatic complexity greater than the configured limit
B. The test suite omitted at least one branch in the recompiled class
C. The analyzed class bytes differ from those used during coverage collection
D. The source file contains statements that the Java compiler optimized

57 A method is marked as covered, yet its complexity counter reports Missed: 2 and Covered: 3. What is the best interpretation?

Interpreting Results of EclEmma Hard
A. Two infeasible paths were detected and removed from the coverage percentage
B. Some independent control-flow complexity remains associated with uncovered branches
C. Two source statements failed while three source statements completed successfully
D. The method executed twice unsuccessfully and three times successfully

58 A connected control-flow graph has 14 edges and 11 nodes. Using with , what is its cyclomatic complexity?

Cyclomatic Complexity Hard
A.
B.
C.
D.

59 A method contains three independent binary if decisions and one switch with four possible targets, including default. Assuming no other decisions, what is its cyclomatic complexity?

Cyclomatic Complexity Hard
A.
B.
C.
D.

60 A method has cyclomatic complexity . Which conclusion follows directly from this value?

Cyclomatic Complexity Hard
A. Its control-flow graph has six linearly independent paths
B. Exactly six tests will achieve complete feasible path coverage
C. At least six defects must be present in its decision logic
D. Exactly six executable statements occur in the method