Software Testing · Quiz 1 · Sep 2024
Software Testing · Quiz 1 · Sep 2024
← Course papers · Start practice / exam
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
17 / 18 published solutions
Based on the above data, answer the given subquestions.
How many prime paths are present in the given CFG?
6
7
8
9
**1. Enumerate prime paths:** [1,2,3,4], [1,2,6,7], [1,5,7], [2,3,4,2], [3,4,2,3], [3,4,2,6,7], [4,2,3,4], [5,5].
**2. Count:** Three cycle rotations, one self-loop, and four maximal noncyclic paths give eight requirements.
**Answer: C — 8.**
A: **Incorrect:** The derived count is 8, not 6.
B: **Incorrect:** The derived count is 8, not 7.
C: **Correct:** The derived count is 8, which matches this option.
D: **Incorrect:** The derived count is 8, not 9.
Question 3 MSQ · 6.0 marks
Based on the above data, answer the given subquestions.
From the following options, identify the set(s) of test paths that provide edge-pair coverage.
{[1, 5, 7], [1, 2, 3, 4, 2, 3, 4, 2, 6, 7], [1, 5, 5, 5, 7]}
{[1, 2, 6, 7], [1, 2, 3, 4, 2, 3, 4, 2, 6, 7], [1, 5, 5, 5, 7]}
{[1, 2, 6, 7], [1, 5, 7], [1, 2, 3, 4, 2, 3, 4, 2, 6, 7], [1, 5, 5, 5, 7]}
{[1, 2, 6, 7], [1, 5, 7], [1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 6, 7], [1, 5, 5, 5, 7]}
Published solution
**1. Check short-branch requirements:** Edge-pair coverage requires both [1,2,6] and [1,5,7]. A looping path cannot replace these consecutive edge pairs.
**2. Check loop requirements:** The longer cycle tests cover [2,3,4], [3,4,2], [4,2,3], [4,2,6]; the self-loop test covers [1,5,5], [5,5,5], [5,5,7]. Both C and D cover all requirements.
**Answer: C, D — Sets C and D.**
A: **Incorrect:** It lacks consecutive pair [1,2,6].
B: **Incorrect:** It lacks consecutive pair [1,5,7].
C: **Correct:** It includes both nonloop branch pairs and all loop pairs.
D: **Correct:** The extra loop iteration preserves complete edge-pair coverage.
Question 4 MCQ · 6.0 marks
3
4
5
6
Published solution
**1. Count decisions:** Bubble sort contains two for-loop conditions and one if comparison: three decisions.
**2. Add the base path:** \(V=3+1=4\).
**Answer: B — 4.**
A: **Incorrect:** The derived count is 4, not 3.
B: **Correct:** The derived count is 4, which matches this option.
C: **Incorrect:** The derived count is 4, not 5.
D: **Incorrect:** The derived count is 4, not 6.
Question 5 MCQ · 6.0 marks
Consider a prime path [1, 2, 5, 6] and a test path P=[1, 2, 3, 4, 2, 3, 4, 5, 6]. Which of the following
sub-paths is toured by P with a side-trip but not a detour?
[3, 4, 2, 3]
[3, 4, 5, 6]
[1, 2, 3, 4]
[2, 3, 4, 5]
Published solution
**1. Identify the closed excursion:** In P, the segment [3,4,2,3] leaves node 3 and returns to node 3. It is a closed side excursion, while the other listed segments do not return to their starting node.
**2. Interpret the intended question:** A is the listed segment having the shape of a sidetrip, rather than an excursion returning at a different successor node.
**Answer: A — [3,4,2,3].**
**Convention note:** The wording is imprecise: the stated prime path [1,2,5,6] is not toured with sidetrips because P never traverses edge 2→5. Also, formal sidetrip touring implies the weaker node-order detour criterion. A is the intended closed-excursion answer, not proof of the literal “sidetrip but not detour” claim.
A: **Correct:** It is a closed excursion returning to its start.
B: **Incorrect:** It ends at 6 rather than returning to 3.
C: **Incorrect:** It ends at 4 rather than returning to 1.
D: **Incorrect:** It ends at 5 rather than returning to 2.
Question 6 MCQ · 6.0 marks
It accepts all strings that have odd number of 0s and odd number of 1s.
It accepts all strings that have even number of 0s and even number of 1s.
It accepts all strings that have odd number of 0s and even number of 1s.
It accepts all strings that have even number of 0s and odd number of 1s.
Published solution
**1. Assign parity states:** State 1 is (even zeros, even ones); state 2 is (odd, even); state 4 is (even, odd); state 3 is (odd, odd). Reading 0 toggles zero parity, while reading 1 toggles one parity.
**2. Identify acceptance:** Only state 1 is accepting, so both symbol counts must be even.
**Answer: B — It accepts all strings that have even number of 0s and even number of 1s..**
A: **Incorrect:** This ends in nonaccepting state 3.
B: **Correct:** Both even counts return to accepting state 1.
C: **Incorrect:** This ends in nonaccepting state 2.
D: **Incorrect:** This ends in nonaccepting state 4.
Question 7 MCQ · 6.0 marks
At which process maturity level is the objective of testing to reduce the risk associated with
software usage, wherein testers and developers collaborate to reduce risk?
Level-0
Level-1
Level-2
Level-3
Level-4
Published solution
**1. Identify the concept:** Level 3 in the testing-maturity model focuses on reducing software-usage risk through cooperation between developers and testers.
**Answer: D — Level-3.**
A: **Incorrect:** Level 0 equates testing with debugging.
B: **Incorrect:** Level 1 emphasizes demonstrating that the program works.
C: **Incorrect:** Level 2 emphasizes showing failures.
D: **Correct:** Level 3 introduces the stated cooperative risk-reduction objective.
E: **Incorrect:** Level 4 is a broader quality discipline; Level 3 is the minimum here.
Question 8 MCQ · 6.0 marks
b > 100
a - b < 0 && b > 100
a - b < 0 && a*b > 100
a - b < 0 && a*b <= 100
Published solution
**1. Enter the outer branch:** The initial values x=a and y=b require \(a-b<0\).
**2. Substitute the assignment:** Inside that branch y becomes \(ab\). Reaching the error then requires \(ab>100\), so both conditions are needed.
**Answer: C — \(a-b<0\land ab>100\).**
A: **Incorrect:** It ignores the outer branch and the changed value of y.
B: **Incorrect:** The inner condition uses updated y=ab, not original b.
C: **Correct:** It combines the outer condition with the correct updated inner condition.
D: **Incorrect:** This negates the required inner condition.
Question 9 MCQ · 5.0 marks
Consider using a memory block to interface between two modules, where the modules can read
from or write to, while a third module can create the memory block.
Identify the interface between the modules.
Procedure call interface
Shared memory interface
Message-passing interface
None of these
Published solution
**1. Identify the concept:** Both modules exchange information by reading and writing the same memory block. This is a shared-memory interface.
**Answer: B — Shared memory interface.**
A: **Incorrect:** The scenario does not describe invoking the other module’s procedure.
B: **Correct:** The common readable/writable memory block is shared memory.
C: **Incorrect:** No exchange of discrete messages is described.
D: **Incorrect:** Shared memory directly matches the mechanism.
Question 10 MCQ · 5.0 marks
Which of the following integration testing approaches does not require **scaffolding**?
Top-down
Bottom-up
Sandwich
Big bang
Published solution
**1. Identify the concept:** Big-bang integration combines the available real components at once, avoiding the temporary drivers and stubs needed to replace missing components during incremental integration.
**Answer: D — Big bang.**
A: **Incorrect:** Missing lower-level components normally require stubs.
B: **Incorrect:** Missing higher-level callers normally require drivers.
C: **Incorrect:** It combines approaches that use drivers and stubs.
D: **Correct:** Real components are integrated together rather than replaced by integration scaffolding.
Question 11 MCQ · 5.0 marks
Any single vertex with out-degree _____________, which is a decision vertex, is a DD-path.
Fill in the blank with appropriate option.
= 0
< 2
= 1
≥ 2
Published solution
**1. Identify the concept:** A decision vertex has at least two outgoing alternatives. Such a branching singleton qualifies as a DD-path.
**Answer: D — ≥ 2.**
A: **Incorrect:** Out-degree zero identifies an exit, not a decision.
B: **Incorrect:** Fewer than two outgoing edges do not form a branch.
C: **Incorrect:** One outgoing edge provides no choice.
D: **Correct:** At least two outgoing edges make it a decision vertex.
Question 12 MCQ · 5.0 marks
The inter-procedural DU pairs are defined by the ______(1)_____ of variables before calls to and
returns from the called units and the______(2)______ inside modules and after calls.
Fill in the blanks with the appropriate option.
(1) first definitions, (2) first uses
(1) first definitions, (2) last uses
(1) last definitions, (2) first uses
(1) last definitions, (2) last uses
Published solution
**1. Identify the concept:** A value crossing a call boundary comes from the last definition before the call or return and reaches its first relevant use in the receiving module or after the call.
**Answer: C — (1) last definitions, (2) first uses.**
A: **Incorrect:** An earlier definition may already have been overwritten.
B: **Incorrect:** Neither the earliest definition nor the last use identifies the boundary transfer.
C: **Correct:** Last definitions and first uses identify the inter-procedural transfer.
D: **Incorrect:** The first use is the receiving boundary event, not the last use.
Question 13 MSQ · 5.0 marks
Which of the following can be white-box testing?
Unit testing
Integration testing
System testing
Acceptance testing
Beta testing
Published solution
**1. Identify the concept:** White-box testing derives tests from internal code or structure. That approach can be used at unit, integration and system levels; acceptance and beta testing are normally driven by external requirements and user behaviour.
**Answer: A, B, C — Unit testing; Integration testing; System testing.**
A: **Correct:** Individual units can be tested using internal branches and paths.
B: **Correct:** Interactions can be tested using internal call and data-flow structure.
C: **Correct:** Whole-system tests can also target internal structure.
D: **Incorrect:** Acceptance testing normally verifies externally specified user requirements.
E: **Incorrect:** Beta testing normally relies on user operation rather than source-code analysis.
Question 14 MSQ · 5.0 marks
Only node coverage.
Node coverage and edge coverage.
Edge coverage but not edge-pair coverage.
Edge-pair coverage.
Published solution
**1. Check edge coverage:** The paths [1,2,5,6] and [1,2,3,4,3,5,6] collectively traverse every edge and visit every node.
**2. Identify missing pairs:** [2,3,5] and [4,3,4] are valid consecutive edge pairs but occur in neither test. Hence edge-pair coverage is not achieved.
**Answer: B, C — Node and edge coverage; no edge-pair coverage.**
A: **Incorrect:** Edge coverage is achieved as well.
B: **Correct:** Both nodes and edges are covered.
C: **Correct:** Every edge is covered but some consecutive pairs are missing.
D: **Incorrect:** The valid pairs [2,3,5] and [4,3,4] are absent.
Question 15 MSQ · 5.0 marks
Published solution
**1. Apply subsumption:** C2 subsumes C1, so satisfying the stronger criterion C2 implies C1. C3 subsumes C2 and therefore C1 by transitivity.
**2. Apply to the test sets:** T2 and T3 necessarily satisfy the weaker C1 requirements represented by T1; the reverse implications are not guaranteed.
**Answer: B, D — T2 satisfies C1; T3 satisfies C1.**
**Convention note:** The question loosely says one test set “satisfies” another; the precise implication concerns the coverage criteria those sets satisfy.
A: **Incorrect:** Satisfying weaker C1 does not imply stronger C2.
B: **Correct:** C2 subsumes C1.
C: **Incorrect:** Satisfying C2 does not imply stronger C3.
D: **Correct:** C3 subsumes C2, which subsumes C1.
Question 16 MSQ · 6.0 marks
testCase1()
testCase2()
testCase3()
testCase4()
Published solution
**1. Trace search:** The loop starts at index 1, so it skips the 20 at index 0. Searching for 20 returns −1, making test 3’s equality-to-zero assertion fail.
**2. Check the absent key:** Searching for 100 returns the integer −1, boxed as a non-null Integer for assertNull. Thus test 4 fails. Searches for 10 and 50 return the expected indices 1 and 4.
**Answer: C, D — testCase3() and testCase4().**
A: **Incorrect:** The method finds 10 at index 1.
B: **Incorrect:** The method finds 50 at index 4.
C: **Correct:** The skipped index 0 makes search(20) return −1.
D: **Correct:** The integer result −1 is not null.
Question 17 MSQ · 6.0 marks
{x = 10, y = 10, z = 10}
{x = 20, y = 20, z = 30}
{x = 20, y = 10, z = 30}
{x = 30, y = 20, z = 30}
Published solution
**1. Read the path guards:** Taking a→b requires \(x\ge y\); taking b→e requires \(x<z\). Hence the path condition is \(y\le x<z\).
**2. Evaluate inputs:** (20,20,30) and (20,10,30) satisfy both guards. (10,10,10) and (30,20,30) fail the strict x<z guard.
**Answer: B, C — (20,20,30) and (20,10,30).**
A: **Incorrect:** 10<10 is false.
B: **Correct:** 20≥20 and 20<30 are both true.
C: **Correct:** 20≥10 and 20<30 are both true.
D: **Incorrect:** 30<30 is false.
Question 18 MCQ · 6.0 marks
Based on the above data, answer the given subquestions.
How many **du-pairs** are there for the variable x?
2
3
4
5
A published solution is not available for this question yet.
Question 19 MCQ · 5.0 marks
Based on the above data, answer the given subquestions.
How many unique **du-paths** are there for the variable x?
2
3
4
5
**Deep Learning**
**Section Id :** 64065369311
**Section Number :** 2
**Section type :** Online
**Mandatory or Optional :** Mandatory
Published solution
**1. Enumerate definition-clear simple paths:** From node 1’s definition to the two predicate-use edges: [1,2,3] and [1,2,4]. From node 4’s definition to print(x): [4,5].
**2. Count:** There are three distinct DU-path sequences. Paths from node 1 through node 4 to node 5 are not definition-clear for x.
**Answer: B — 3.**
A: **Incorrect:** The derived count is 3, not 2.
B: **Correct:** The derived count is 3, which matches this option.
C: **Incorrect:** The derived count is 3, not 4.
D: **Incorrect:** The derived count is 3, not 5.