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 visual design of the interface
B. The internal structure of the code
C. The wording of user documentation
D. The feedback collected from users

2 What is another common name for structural testing?

Structural Testing Easy
A. Usability testing
B. Black-box testing
C. White-box testing
D. Acceptance 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 amount of code written each day
D. The number of requirements in a project

4 What does data coverage mainly examine?

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

5 What does 100% statement coverage mean?

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

6 Which formula calculates statement coverage?

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

7 What does branch coverage check for an if statement?

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

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

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

9 What does path coverage measure?

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

10 Why can achieving 100% path coverage be difficult?

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

11 What does method coverage measure?

Other Coverages and Understanding Their Differences Easy
A. The methods called during testing
B. The branches selected during testing
C. The defects corrected during testing
D. The variables declared 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 values in output reports
D. Individual Boolean conditions in decisions

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. Method coverage
D. Line coverage

14 What is EclEmma mainly used for?

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

15 EclEmma is commonly integrated with which development environment?

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

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

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

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

Interpreting Results of EclEmma Easy
A. The line was not covered
B. The line was partly covered
C. The line was fully 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 fully covered
B. The line was recently edited
C. The line was not covered
D. The line was partly covered

19 What does cyclomatic complexity measure?

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

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

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

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. Exploratory testing
B. Usability testing
C. Acceptance testing
D. Structural 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 cannot measure statement coverage
C. It must have zero branch 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. Removing duplicate assertion statements
B. Refactoring the method into fewer lines
C. Testing zero, negative, and boundary values
D. Running the same positive tests repeatedly

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 = -1
D. score = 49

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 executable statement ran at least once
B. Every decision outcome ran at least once
C. Every condition value ran independently
D. Every feasible path 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. (18, true) only
B. (18, true) and (17, true)
C. (18, false) and (17, false)
D. (17, true) only

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. 2 paths
B. 3 paths
C. 6 paths
D. 4 paths

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

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

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. Decision coverage
B. Line coverage
C. Statement coverage
D. Method 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. Method coverage
C. Condition coverage
D. Branch 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. Profile As > Maven Build
B. Coverage As > JUnit Test
C. Run As > Java Application
D. Debug As > Eclipse Application

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

Introduction to Code Coverage Tool EclEmma Medium
A. Generating assertions from method outputs
B. Recording which code elements tests execute
C. Replacing JUnit with a test framework
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 contains invalid syntax
B. The line executed every branch
C. The line caused a test failure
D. The line was not executed

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 contains a failed assertion
B. The line was only partially covered
C. The line was never loaded
D. The line has complete path coverage

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

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

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

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

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

Cyclomatic Complexity Medium
A. 4
B. 3
C. 6
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 is correct because every control-flow outcome was executed
B. The method is structurally exercised, but functional faults may remain undetected
C. The method is fault-free unless it contains an infeasible execution path
D. The method requires only path coverage to prove the business rule

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 may remain invisible because it creates no structure to cover
C. The missing check will be detected whenever statement coverage reaches 100%
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 only a test with a false because d1 dominates u1
B. Run one test with a false and one test with a true
C. Run two tests with a true but different values of x
D. Run only a test with a true because it executes both definitions

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 covered only when the second assignment stores the same value
B. It is infeasible because a variable cannot have multiple definitions
C. It is covered because both the definition and use execute on one path
D. It is not covered because the intervening assignment kills the definition

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. Two tests selecting s1 once and both other statements together
B. One test because all statements belong to one conditional chain
C. Four tests covering every combination of a and b
D. Three tests selecting s1, s2, and s3 separately

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 misses statement coverage because the initial assignment is overwritten
B. It achieves statement coverage but misses both false branch outcomes
C. It achieves path coverage because the executed path contains every statement
D. It achieves statement and branch coverage because both bodies execute

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. Decision coverage is complete, but B=false has not been exercised
B. Path coverage is complete because the decision has two final outcomes
C. Condition coverage is complete because both input variables have two values
D. Branch coverage is incomplete because the body executes only once

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. Two tests for (true,true) and (false,false)
C. One test with both conditions evaluating to true
D. Four tests for all combinations of A and B

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 condition coverage and all four complete execution paths
B. Full path coverage but only half of the branch outcomes
C. Full branch coverage but only two of the four complete 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. Only the path executing both statements is infeasible
B. Two of the four syntactic outcome combinations are feasible
C. Three paths are feasible because x = 0 creates a third case
D. All four outcome combinations are feasible with boundary values

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,T), (T,T,F), (F,F,T), (F,F,F)
B. (T,T,F), (F,T,F), (T,F,F), (T,F,T)
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 statement coverage implies branch coverage, which implies path coverage
B. Complete condition coverage implies path coverage, which implies data-flow coverage
C. Complete branch coverage implies MC/DC, which implies complete path coverage
D. Complete path coverage implies branch coverage, which implies statement coverage

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

Introduction to Code Coverage Tool EclEmma Hard
A. It uses JaCoCo instrumentation to record execution of Java bytecode
B. It statically explores every feasible source-level execution path
C. It modifies Java source files by inserting permanent logging statements
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 ignores compiled instructions whenever source code is available
B. Coverage treats each source line as exactly one bytecode instruction
C. Coverage is collected from bytecode and then mapped back to source lines
D. Coverage is estimated from source formatting and Eclipse syntax coloring

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 source line executed, so the branch percentage must be inaccurate
C. Every counted instruction executed, but some decision outcomes did not
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 test suite omitted at least one branch in the recompiled class
B. The analyzed class bytes differ from those used during coverage collection
C. The source file contains statements that the Java compiler optimized
D. The class has a cyclomatic complexity greater than the configured limit

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. Some independent control-flow complexity remains associated with uncovered branches
B. Two source statements failed while three source statements completed successfully
C. Two infeasible paths were detected and removed from the coverage percentage
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. At least six defects must be present in its decision logic
B. Exactly six executable statements occur in the method
C. Its control-flow graph has six linearly independent paths
D. Exactly six tests will achieve complete feasible path coverage