MauryaHub PYQ Practice

Software Testing · Quiz 2 · Jan 2025

Software Testing · Quiz 2 · Jan 2025

← 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.

20 / 20 published solutions

Question 42 MCQ · 4.0 marks

Identify the type of the risk in the given scenario.
6406533952469.
Project risks
6406533952470.
Technical risk
6406533952471.
Business risk
6406533952472.
None of these

Published solution

A **technical risk** arises when the technology, software architecture, or external technical components (such as a third-party API) fail to meet functional or performance expectations, threatening the quality and timeliness of the software system. Since the logistics company relies on a third-party mapping API that may have technical shortcomings in delivering real-time traffic data or route optimization, this is a **technical risk**. **Answer: B (Technical risk)** A: **Incorrect:** Project risks involve schedule, budget, personnel, or resource management issues rather than technical component limitations. B: **Correct:** Shortcomings in an external third-party API directly threaten the technical functionality and quality of the software. C: **Incorrect:** Business risks affect the market viability or commercial success of the product rather than the technical implementation. D: **Incorrect:** Technical risk is the exact classification for this scenario.

Report a correction for Q42

Question 43 MCQ · 4.0 marks

Choose the correct option that specifies how the risk can be mitigated.
6406533952473.
By hiring developers with relevant experience within the company and/ or outside the company, or outsource certain things to some third party vendors.
6406533952474.
By benchmarking and regular inspection to verify that the external component is up to the mark.
6406533952475.
By communicating with clients or build prototype to collect clients feedback
6406533952476.
Explore market for similar products       **Sw Testing** **Section Id :** 64065382582 **Section Number :** 3 **Section type :** Online **Mandatory or Optional :** Mandatory **Number of Questions :** 15 **Number of Questions to be attempted :** 15 **Section Marks :** 100 **Display Number Panel :** Yes **Section Negative Marks :** 0 **Group All Questions :** No **Enable Mark as Answered Mark for Review and** No **Clear Response :** **Section Maximum Duration :** 0 **Section Minimum Duration :** 0 **Section Time In :** Minutes **Maximum Instruction Time :** 0

Published solution

When a software project faces a technical risk due to potential shortcomings in an external third-party component or API, the standard mitigation strategy is to perform **benchmarking and regular inspection/testing** of the external component early and continuously to verify that it meets the required performance and reliability standards. **Answer: B (By benchmarking and regular inspection to verify that the external component is up to the mark.)** A: **Incorrect:** Hiring experienced developers mitigates personnel/staffing shortfalls, not defects inside a third-party API. B: **Correct:** Benchmarking and regular inspection directly evaluate and monitor the third-party component's performance and reliability. C: **Incorrect:** Prototyping and client feedback mitigate requirement misunderstandings, not third-party API limitations. D: **Incorrect:** Exploring the market for similar end-products addresses business/market risk, not component integration risk.

Report a correction for Q43

Question 45 MCQ · 5.0 marks

Source diagram or notation
6406533952479.
1-C, 2-B, 3-A
6406533952480.
1-C, 2-A, 3-B
6406533952481.
1-B, 2-A, 3-C
6406533952482.
1-B, 2-C, 3-A

Published solution

In Input Space Partitioning (ISP), a valid partitioning of the input domain (all integers \(x \in \mathbb{Z}\)) must satisfy two properties: 1. **Completeness**: The union of all blocks covers the entire input domain. 2. **Disjointness**: No two blocks overlap (their intersection is empty). Let us evaluate each candidate partitioning of \(x \in \mathbb{Z}\): 1. **\(x \le 0\) and \(x \ge 0\)**: Every integer is either \(\le 0\) or \(\ge 0\) (so it is **complete**), but \(x = 0\) belongs to both blocks (so it is **not disjoint**). Thus, **1 matches B** (*Complete but not disjoint*). 2. **\(x < 0\) and \(x > 0\)**: No integer is both negative and positive (so it is **disjoint**), but \(x = 0\) is excluded from both blocks (so it is **not complete**). Thus, **2 matches C** (*Disjoint but not complete*). 3. **\(x < 0\) and \(x \ge 0\)**: Every integer falls into exactly one of the two blocks with no overlap. Thus, **3 matches A** (*Complete and disjoint*). **Answer: D (1-B, 2-C, 3-A)** A: **Incorrect:** Partition 1 includes \(x = 0\) in both blocks, so it is complete but not disjoint (B, not C). B: **Incorrect:** Partition 1 is not disjoint (B) and Partition 2 misses \(x = 0\) (C). C: **Incorrect:** Partition 2 misses \(x = 0\) so it is not complete (C, not A). D: **Correct:** 1 is complete but overlaps at 0 (B), 2 is disjoint but misses 0 (C), and 3 is both complete and disjoint (A).

Report a correction for Q45

Question 46 MCQ · 5.0 marks

What type of software requirements specify the expected behaviors and relationships between the inputs and outputs of a system?
6406533952483.
User requirements
6406533952484.
Functional requirements
6406533952485.
Non-functional requirements
6406533952486.
Regulatory requirements

Published solution

**Functional requirements** specify what the software system must do—specifically, the expected behaviors, calculations, transformations, and relationships between the system's inputs and outputs. **Answer: B (Functional requirements)** A: **Incorrect:** User requirements are high-level statements in natural language of what services the system is expected to provide to users. B: **Correct:** Functional requirements define the exact input-to-output behaviors and functions of the software system. C: **Incorrect:** Non-functional requirements specify quality attributes and constraints such as performance, security, and scalability. D: **Incorrect:** Regulatory requirements specify legal, compliance, or industry standards the software must obey.

Report a correction for Q46

Question 47 MCQ · 5.0 marks

Source diagram or notation
6406533952491.
Shared data coupling
6406533952492.
Parameter coupling
6406533952493.
External device coupling
6406533952494.
Message-passing interfaces

Published solution

When one module (`Booking`) invokes another module (`Payment`) and passes data items (such as customer name, booking ID, and date) explicitly through function/method parameters, the interface coupling is called **parameter coupling** (also known as data coupling). **Answer: B (Parameter coupling)** A: **Incorrect:** Shared data coupling (common coupling) occurs when modules read and write to a shared global data store or variable. B: **Correct:** Passing booking details explicitly as arguments/parameters between `Booking` and `Payment` is parameter coupling. C: **Incorrect:** External device coupling occurs when modules communicate through an external hardware device or file. D: **Incorrect:** Message-passing interfaces involve asynchronous/network message queues rather than direct parameter calls.

Report a correction for Q47

Question 48 MCQ · 5.0 marks

Source diagram or notation
6406533952503.
3
6406533952504.
4
6406533952505.
5
6406533952506.
6

Published solution

**Step 1: Recall the formula for Base Choice Coverage (BCC).** In Base Choice Coverage, one base test case is formed using the chosen base blocks—here \((C, 2, y)\)—and additional test cases are generated by varying one partition at a time through all of its remaining non-base blocks while keeping the other partitions fixed at their base choice. **Step 2: Count the additional test cases for each partition.** - Partition 1 \([A, B, C]\) has 3 blocks. Varying the first partition from \(C\) to \(A\) and \(B\) gives \(3 - 1 = 2\) tests: \((A, 2, y)\) and \((B, 2, y)\). - Partition 2 \([1, 2, 3]\) has 3 blocks. Varying the second partition from \(2\) to \(1\) and \(3\) gives \(3 - 1 = 2\) tests: \((C, 1, y)\) and \((C, 3, y)\). - Partition 3 \([x, y]\) has 2 blocks. Varying the third partition from \(y\) to \(x\) gives \(2 - 1 = 1\) test: \((C, 2, x)\). **Step 3: Sum the additional tests.** \[\text{Additional tests} = 2 + 2 + 1 = 5\] (Including the base test \((C, 2, y)\), the total number of BCC tests is \(1 + 5 = 6\).) **Answer: C (5)** A: **Incorrect:** 3 is the number of partitions, not the number of additional test cases. B: **Incorrect:** 4 undercounts the remaining non-base blocks across the three partitions (\(2 + 2 + 1 = 5\)). C: **Correct:** Varying one block at a time from the base choice \((C, 2, y)\) requires \((3-1) + (3-1) + (2-1) = 5\) additional tests. D: **Incorrect:** 6 is the total number of tests including the base test \((C, 2, y)\), whereas the question asks for *additional* tests.

Report a correction for Q48

Question 49 MCQ · 5.0 marks

Source diagram or notation
6406533952511.
CNF: 3, DNF: 1, 4, None: 2
6406533952512.
CNF: 1, 4, DNF: 3, None: 2
6406533952513.
CNF: 2, 3, DNF: 1, 4
6406533952514.
CNF: 1, DNF: 3, None: 2, 4

Published solution

Let us classify each logical expression: - **Conjunctive Normal Form (CNF)** is a conjunction (\(\land\)) of clauses, where each clause is a disjunction (\(\lor\)) of literals. - **Disjunctive Normal Form (DNF)** is a disjunction (\(\lor\)) of terms, where each term is a conjunction (\(\land\)) of literals. 1. \((a_1 \land a_2) \lor (b_1 \land b_2 \land b_3)\): Disjunction of two conjunctive terms \(\implies\) **DNF**. 2. \((a_1 \lor a_2) \lor (b_1 \land b_2 \land b_3)\): Because \((a_1 \lor a_2)\) is grouped as a disjunctive sub-clause combined with a conjunctive clause \((b_1 \land b_2 \land b_3)\), it is classified as **None** (not written as a pure conjunction of disjunctions or disjunction of conjunctions). 3. \((a_1 \lor a_2) \land (b_1 \lor b_2) \land (b_1 \lor b_2)\): Conjunction of three disjunctive clauses \(\implies\) **CNF**. 4. \(a_1 \lor a_2 \lor (b_1 \land b_2)\): Disjunction of single literals \(a_1\), \(a_2\) and conjunction \((b_1 \land b_2)\) \(\implies\) **DNF**. Therefore: **CNF: 3, DNF: 1, 4, None: 2**. **Answer: A (CNF: 3, DNF: 1, 4, None: 2)** A: **Correct:** Expression 3 is in CNF, expressions 1 and 4 are in DNF, and expression 2 is classified as None. B: **Incorrect:** Expressions 1 and 4 are disjunctions of conjunctions (DNF), while 3 is a conjunction of disjunctions (CNF). C: **Incorrect:** Expression 2 is not in CNF because its second term uses \(\land\) inside a top-level \(\lor\). D: **Incorrect:** Expression 1 is in DNF (not CNF) and expression 4 is in DNF.

Report a correction for Q49

Question 50 MCQ · 6.0 marks

A software system calculates shipping charges based on the weight of a package using the following rules: • If the weight is 1 to 5 kg, the shipping charge is Rs 10. • If the weight is 6 to 20 kg, the shipping charge is Rs 20. • If the weight is 21 to 50 kg, the shipping charge is Rs 50. • If the weight is above 50 kg, the shipping charge is Rs 100. How many equivalence class partitions can be identified in the given scenario?
6406533952487.
4
6406533952488.
5
6406533952489.
6
6406533952490.
7

Published solution

In Equivalence Class Partitioning (ECP), we identify both **valid** equivalence classes (specified by the rules) and **invalid** equivalence classes (values outside the allowed domain): 1. **Invalid partition**: Weight \(< 1\text{ kg}\) (e.g., \(\le 0\text{ kg}\)) 2. **Valid partition 1**: Weight \(1\text{ to }5\text{ kg}\) (Charge = Rs 10) 3. **Valid partition 2**: Weight \(6\text{ to }20\text{ kg}\) (Charge = Rs 20) 4. **Valid partition 3**: Weight \(21\text{ to }50\text{ kg}\) (Charge = Rs 50) 5. **Valid partition 4**: Weight \(> 50\text{ kg}\) (Charge = Rs 100) In total, there are \(4\text{ valid} + 1\text{ invalid} = 5\) equivalence class partitions. **Answer: B (5)** A: **Incorrect:** 4 counts only the valid weight ranges and omits the invalid partition (weight \(< 1\text{ kg}\)). B: **Correct:** Including the 4 valid weight intervals and 1 invalid interval (weight \(< 1\text{ kg}\)), there are 5 equivalence classes. C: **Incorrect:** Since there is no upper cap above 50 kg, there is only 1 invalid partition (below 1 kg), making 5 partitions in total. D: **Incorrect:** There are only 5 distinct equivalence partitions for the input domain.

Report a correction for Q50

Question 51 MCQ · 6.0 marks

Source diagram or notation
6406533952495.
All-defs coverage
6406533952496.
All-uses coverage
6406533952497.
All du-paths coverage
6406533952498.
None of these

Published solution

Let us analyze the definitions and uses of variable `x` in the given Control Flow Graph (CFG): - **Definitions of `x`**: - Node 2: `x = 10` - Node 3: `x = y * 10` - **Uses of `x`**: - p-use on edge `(4, 5)` (`x > y`) and c-use at Node 5 (`z = x - y`) - p-use on edge `(4, 6)` (`x <= y`) and c-use at Node 6 (`z = x + y`) Now examine the given test paths \(\{[1, 2, 4, 5, 7], [1, 3, 4, 5, 7]\}\): - Path `[1, 2, 4, 5, 7]` executes the definition of `x` at Node 2 and reaches the uses of `x` on edge `(4, 5)` and at Node 5 along a definition-clear subpath. - Path `[1, 3, 4, 5, 7]` executes the definition of `x` at Node 3 and reaches the uses of `x` on edge `(4, 5)` and at Node 5 along a definition-clear subpath. - Neither path visits Node 6 or edge `(4, 6)`, so the uses of `x` at `(4, 6)` and Node 6 are **not** covered. Because **every definition** of `x` (at Node 2 and Node 3) reaches **at least one use** via a definition-clear path, the test set satisfies **All-defs coverage**, but not All-uses or All du-paths coverage. **Answer: A (All-defs coverage)** A: **Correct:** Both definitions of `x` (at nodes 2 and 3) reach at least one use (at edge (4,5) and node 5), satisfying All-defs coverage. B: **Incorrect:** All-uses coverage requires reaching *every* c-use and p-use from each definition, but node 6 and edge (4,6) are never visited. C: **Incorrect:** All du-paths coverage subsumes All-uses coverage and requires covering paths `[2, 4, 6]` and `[3, 4, 6]`, which are missing. D: **Incorrect:** All-defs coverage is satisfied by the given pair of paths.

Report a correction for Q51

Question 52 MCQ · 6.0 marks

Source diagram or notation
6406533952499.Source diagram or notation
6406533952500.Source diagram or notation
6406533952501.Source diagram or notation
6406533952502.Source diagram or notation

Published solution

Consider the predicate \(p = c \lor (a \land \neg b)\): - **Satisfiability**: A predicate is satisfiable if there is at least one truth assignment that makes it `True`. When \(c = \text{True}\) (or when \(a = \text{True}, b = \text{False}\)), \(p = \text{True}\). Thus, \(p\) is **satisfiable**. - **Tautology**: A predicate is a tautology if it evaluates to `True` for *every* possible truth assignment. When \(c = \text{False}\) and \(a = \text{False}\), \(p = \text{False} \lor \text{False} = \text{False}\). Thus, \(p\) is **not a tautology**. Therefore, \(p\) is satisfiable but not a tautology. **Answer: C (p is satisfiable but not a tautology.)** A: **Incorrect:** \(p\) is satisfiable because setting \(c = \text{True}\) makes \(p\) evaluate to `True`. B: **Incorrect:** A tautology is always satisfiable; moreover, \(p\) is false when \(a = \text{False}, c = \text{False}\). C: **Correct:** \(p\) evaluates to `True` for some assignments (e.g., \(c = \text{True}\)) and `False` for others (e.g., \(a = \text{False}, c = \text{False}\)). D: **Incorrect:** \(p\) is not a tautology because it is false whenever \(c = \text{False}\) and \((a \land \neg b) = \text{False}\).

Report a correction for Q52

Question 53 MCQ · 6.0 marks

Source diagram or notation
6406533952507.Source diagram or notation
6406533952508.Source diagram or notation
6406533952509.Source diagram or notation
6406533952510.Source diagram or notation

Published solution

**Step 1: Recall the definition of determination \(p_c\).** For a predicate \(p\), the condition \(p_c\) under which clause \(c\) determines \(p\) is given by the exclusive-OR (\(\oplus\)) of \(p\) with \(c = \text{True}\) and \(p\) with \(c = \text{False}\): \[p_c = p_{c=\text{True}} \oplus p_{c=\text{False}}\] **Step 2: Substitute \(c = \text{True}\) and \(c = \text{False}\) into \(p = a \land (b \lor c)\).** - \(p_{c=\text{True}} = a \land (b \lor \text{True}) = a \land \text{True} = a\) - \(p_{c=\text{False}} = a \land (b \lor \text{False}) = a \land b\) **Step 3: Compute \(p_c = a \oplus (a \land b)\).** For \(a\) and \(a \land b\) to differ, \(a\) must be `True` (since if \(a = \text{False}\), both are `False`) and \(b\) must be `False` (since if \(b = \text{True}\), both equal \(a\)). Thus: \[p_c = a \land \neg b\] **Answer: C (\(a \land \neg b\))** A: **Incorrect:** If \(a = \text{False}\), \(p\) is always `False` regardless of \(c\), so \(a \lor b\) does not make \(c\) determine \(p\). B: **Incorrect:** If \(b = \text{True}\), \(b \lor c\) is already `True`, so changing \(c\) does not change \(p\). C: **Correct:** Clause \(c\) determines \(p = a \land (b \lor c)\) if and only if \(a\) is `True` and \(b\) is `False` (\(a \land \neg b\)). D: **Incorrect:** Both \(a = \text{True}\) and \(b = \text{False}\) must hold simultaneously (\(\land\), not \(\lor\)).

Report a correction for Q53

Question 54 MSQ · 6.0 marks

Source diagram or notation
6406533952515.
{44, 45, 50, 100, 101}
6406533952516.
{44, 45, 46, 50, 100}
6406533952517.
{45, 60, 70, 80, 100}
6406533952518.
{44, 45, 46, 50, 99, 100, 101}

Published solution

For a single input variable with range \(45 \le \text{score} \le 100\), **Boundary Value Analysis (BVA)** tests values at and immediately around the boundaries \(\min = 45\) and \(\max = 100\), along with a nominal (typical interior) value such as \(50\): 1. **2-value BVA (Robust BVA)**: Tests `min - 1`, `min`, `nominal`, `max`, `max + 1`: \[\{44, 45, 50, 100, 101\}\] This matches **Option A**. 2. **3-value BVA (Robust 3-value BVA)**: Tests `min - 1`, `min`, `min + 1`, `nominal`, `max - 1`, `max`, `max + 1`: \[\{44, 45, 46, 50, 99, 100, 101\}\] This matches **Option D**. **Answer: A, D** A: **Correct:** `{44, 45, 50, 100, 101}` is the valid 2-value robust boundary value test set (`min-1, min, nom, max, max+1`). B: **Incorrect:** `{44, 45, 46, 50, 100}` is asymmetric and omits `99` (`max-1`) and `101` (`max+1`). C: **Incorrect:** `{45, 60, 70, 80, 100}` includes multiple arbitrary interior values instead of boundary neighbors. D: **Correct:** `{44, 45, 46, 50, 99, 100, 101}` is the valid 3-value robust boundary value test set (`min-1, min, min+1, nom, max-1, max, max+1`).

Report a correction for Q54

Question 55 MCQ · 6.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
With reference to the truth table row numbers (Row#), identify the one that covers all the RACC pairs for the clause a.
6406533952519.
(3,7), (3,8), (4,7), (4,8)
6406533952520.
(3,7), (4,8)
6406533952521.
(1,3), (2,4)
6406533952522.
No feasible pairs for P = T and (1,5), (1,6), (2,5), (2,6) for P = F

Published solution

**Step 1: Understand Restricted Active Clause Coverage (RACC) for clause \(a\).** For the major clause \(a\), RACC requires pairs of truth table rows \((r_1, r_2)\) such that: 1. \(p_a = \text{True}\) in both rows (so \(a\) determines \(p\)). 2. \(a\) is `True` in \(r_1\) and `False` in \(r_2\) (so \(p\) flips truth value between \(r_1\) and \(r_2\)). 3. All minor clauses (\(b\) and \(c\)) have the **exact same truth values** in both \(r_1\) and \(r_2\). **Step 2: Match rows from the truth table where \(p_a = \text{True}\).** From the given truth table, \(p_a = \text{True}\) in rows **3, 4, 7, 8**: - **Row 3**: \(a = \text{T}, b = \text{F}, c = \text{T}, p = \text{T}\) and **Row 7**: \(a = \text{F}, b = \text{F}, c = \text{T}, p = \text{F}\). Here \((b, c) = (\text{F}, \text{T})\) in both rows \(\implies\) RACC pair **(3, 7)**. - **Row 4**: \(a = \text{T}, b = \text{F}, c = \text{F}, p = \text{T}\) and **Row 8**: \(a = \text{F}, b = \text{F}, c = \text{F}, p = \text{F}\). Here \((b, c) = (\text{F}, \text{F})\) in both rows \(\implies\) RACC pair **(4, 8)**. Thus, the complete set of RACC pairs for clause \(a\) is **(3,7), (4,8)**. **Answer: B ((3,7), (4,8))** A: **Incorrect:** `(3,7), (3,8), (4,7), (4,8)` is the set of Correlated Active Clause Coverage (CACC) pairs, where minor clauses can differ between the pair. B: **Correct:** In `(3,7)` and `(4,8)`, \(p_a = \text{T}\), \(a\) toggles between T and F, and the minor clauses \((b, c)\) remain identical. C: **Incorrect:** In rows 1 and 2, \(p_a = \text{False}\), so \(a\) is not active. D: **Incorrect:** Those are inactive clause coverage pairs (where \(p_a = \text{False}\)), not RACC pairs.

Report a correction for Q55

Question 56 MCQ · 6.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
With reference to the truth table row numbers (Row#), identify the one that covers all the RICC pairs for the clause a.
6406533952523.
(3,7), (3,8), (4,7), (4,8)
6406533952524.
No feasible pairs for P = T and (1,5), (1,6), (2,5), (2,6) for P = F
6406533952525.
(3,4) for P = T and (1,2), (5,6), (7,8) for P = F
6406533952526.
No feasible pairs for P = T and (1,5), (2,6) for P = F

Published solution

**Step 1: Understand Restricted Inactive Clause Coverage (RICC) for clause \(a\).** For major clause \(a\), RICC requires pairs of rows \((r_1, r_2)\) for \(P = \text{T}\) and for \(P = \text{F}\) such that: 1. \(p_a = \text{False}\) in both rows (so \(a\) does *not* determine \(p\)). 2. \(a = \text{True}\) in \(r_1\) and \(a = \text{False}\) in \(r_2\). 3. All minor clauses \((b, c)\) have the **same values** in \(r_1\) and \(r_2\). **Step 2: Inspect the rows where \(p_a = \text{False}\).** From the truth table, \(p_a = \text{False}\) in rows **1, 2, 5, 6** (where \(b = \text{True}\)): - Since \(p = a \land \neg b \land (a \lor c)\), whenever \(b = \text{True}\), \(\neg b = \text{False}\), which forces \(p = \text{False}\). Hence, **there are no feasible pairs for \(P = \text{T}\)**. - For \(P = \text{F}\), keeping \((b, c)\) identical while flipping \(a\) gives: - **Row 1** (\(a=\text{T}, b=\text{T}, c=\text{T}, p=\text{F}\)) and **Row 5** (\(a=\text{F}, b=\text{T}, c=\text{T}, p=\text{F}\)) \(\implies\) **(1, 5)**. - **Row 2** (\(a=\text{T}, b=\text{T}, c=\text{F}, p=\text{F}\)) and **Row 6** (\(a=\text{F}, b=\text{T}, c=\text{F}, p=\text{F}\)) \(\implies\) **(2, 6)**. **Answer: D (No feasible pairs for P = T and (1,5), (2,6) for P = F)** A: **Incorrect:** `(3,7), (3,8), (4,7), (4,8)` are CACC (active clause) pairs where \(p_a = \text{True}\). B: **Incorrect:** `(1,5), (1,6), (2,5), (2,6)` is for General Inactive Clause Coverage (GICC), where minor clauses \((b, c)\) are allowed to vary. C: **Incorrect:** Pairs like `(3,4)` do not flip the major clause \(a\). D: **Correct:** Under RICC, \(P = \text{T}\) has no feasible pairs when \(p_a = \text{F}\), and \(P = \text{F}\) has restricted pairs `(1,5)` and `(2,6)`.

Report a correction for Q56

Question 57 MCQ · 6.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
6406533952527.Source diagram or notation
6406533952528.Source diagram or notation
6406533952529.Source diagram or notation
6406533952530.Source diagram or notation

Published solution

Let us trace the symbolic execution path from the entry of `f(int x, int y)` with symbolic inputs \(x_0, y_0\) to the `abort(x);` statement at `LINE-2`: 1. At `LINE-1`, the condition `if (x != y)` must evaluate to **False** so execution enters the `else` branch. The negated branch condition is \(x_0 == y_0\). 2. Inside the `else` branch, the condition `if (g(x) + 10 < h(y))` must evaluate to **True** to reach `abort(x);` at `LINE-2`. Since `g(x)` returns \(3 * x_0\) and `h(y)` returns \(y_0 * y_0\), this branch condition is \(3 * x_0 + 10 < y_0 * y_0\). Combining the conditions along the path gives the path constraint: \[\langle (x_0 == y_0) \land (3 * x_0 + 10 < y_0 * y_0) \rangle\] **Answer: C (\(\langle (x_0 == y_0) \land (3 * x_0 + 10 < y_0 * y_0) \rangle\))** A: **Incorrect:** Omits the condition \(x_0 == y_0\) required to take the `else` branch at `LINE-1`. B: **Incorrect:** If \(x_0 \ne y_0\), the function returns `-1` at `LINE-1` and never reaches `LINE-2`. C: **Correct:** Reaching `LINE-2` requires \(x_0 == y_0\) (false branch of `LINE-1`) and \(3 * x_0 + 10 < y_0 * y_0\) (true branch of `if` before `LINE-2`). D: **Incorrect:** The condition \(3 * x_0 + 10 \ge y_0 * y_0\) enters the inner `else` branch (`return 0;`) instead of `abort(x);`.

Report a correction for Q57

Question 58 MCQ · 6.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
From among the following, identify the set of concrete test inputs that execute all the instances of symbolic execution.
6406533952531.Source diagram or notation
6406533952532.Source diagram or notation
6406533952533.Source diagram or notation
6406533952534.Source diagram or notation

Published solution

The function `f(int x, int y)` has **3 distinct execution paths**: 1. **Path 1 (`x != y` \(\implies\) `return -1`)**: Needs \(x \ne y\). Tested by `{x = 3, y = 6}` since \(3 \ne 6\). 2. **Path 2 (`x == y` and \(3x + 10 \ge y^2\) \(\implies\) `return 0`)**: Needs \(x = y\) and \(3x + 10 \ge x^2\) (which holds for \(-2 \le x \le 5\)). Tested by `{x = 3, y = 3}` since \(3(3) + 10 = 19 \ge 9\). 3. **Path 3 (`x == y` and \(3x + 10 < y^2\) \(\implies\) `abort(x)`)**: Needs \(x = y\) and \(3x + 10 < x^2\) (which holds for \(x > 5\) or \(x < -2\)). Tested by `{x = 6, y = 6}` since \(3(6) + 10 = 28 < 36\). Thus, the set `{x = 3, y = 6}, {x = 3, y = 3}, {x = 6, y = 6}` executes all 3 symbolic execution paths. **Answer: B (`{x = 3, y = 6}, {x = 3, y = 3}, {x = 6, y = 6}`)** A: **Incorrect:** Only provides 2 test inputs; `{x = 5, y = 5}` has \(3(5)+10 = 25 \ge 25\) (Path 2), missing Path 3 (`abort`). B: **Correct:** `{x = 3, y = 6}` covers Path 1, `{x = 3, y = 3}` covers Path 2, and `{x = 6, y = 6}` covers Path 3. C: **Incorrect:** All three inputs have \(x == y\), so Path 1 (\(x \ne y\)) is never executed. D: **Incorrect:** Both `{x = 3, y = 3}` and `{x = 5, y = 5}` satisfy \(3x + 10 \ge y^2\) (Path 2), leaving Path 3 (`abort`) uncovered.

Report a correction for Q58

Question 59 MCQ · 6.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
6406533952535.Source diagram or notation
6406533952536.Source diagram or notation
6406533952537.Source diagram or notation
6406533952538.Source diagram or notation

Published solution

In the `Product` function, each iteration of the `do ... while(true)` loop reads a fresh symbolic input \(r_i = \text{sym\_input}()\) starting from \(i = 0\): - For the loop to continue for \(m\) iterations (the sequence of \(m\) `true` continuations), the condition `r == 0` must be false for the first \(m\) symbolic inputs: \(r_0 \ne 0, r_1 \ne 0, \dots, r_{m-1} \ne 0\). - On the \((m+1)\)-th iteration (index \(i = m\)), the loop terminates via `if (r == 0) return p;`, which requires \(r_m == 0\). Therefore, the path condition (PC) is: \[\left(\bigwedge_{[0, m-1]} (r_i \ne 0)\right) \land (r_m == 0)\] **Answer: A (\((\bigwedge_{[0,m-1]}(r_i \ne 0)) \land (r_m == 0)\))** A: **Correct:** The first \(m\) inputs \(r_0, \dots, r_{m-1}\) are non-zero (`r_i != 0`) and the \((m+1)\)-th input \(r_m\) is zero (`r_m == 0`). B: **Incorrect:** If \(r_i == 0\) on the first iteration, the function immediately returns `p` instead of continuing. C: **Incorrect:** Uses the parameter \(n\) instead of the number of loop iterations \(m\). D: **Incorrect:** Indexing \([0, m]\) has \(m + 1\) non-zero inputs instead of \(m\).

Report a correction for Q59

Question 60 MCQ · 5.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
6406533952539.Source diagram or notation
6406533952540.Source diagram or notation
6406533952541.Source diagram or notation
6406533952542.Source diagram or notation

Published solution

Let us trace the symbolic state of `r` and `p` across the \(m\) non-zero iterations followed by termination on the \((m+1)\)-th read: - Initially, `p = 1`. - In iterations \(i = 0, 1, \dots, m-1\), \(r_i \ne 0\), so `p *= r` updates `p` to \(\prod_{i \in [0, m-1]} r_i\). - In iteration \(i = m\), `r` is assigned \(r_m\) (where \(r_m == 0\)), and `if (r == 0) return p;` immediately returns before multiplying `p` by \(r_m\). Thus, at the end of the execution, the symbolic state is: \[\left\{r \mapsto r_m, \; p \mapsto \prod_{i \in [0, m-1]} r_i\right\}\] **Answer: C (\(\{r \mapsto r_m, p \mapsto \prod_{i \in [0, m-1]} r_i\}\))** A: **Incorrect:** Uses \(n\) instead of the loop iteration count \(m\). B: **Incorrect:** Uses 1-based indexing up to \(m+1\) instead of 0-based indexing \([0, m-1]\) and \(r_m\). C: **Correct:** After \(m\) non-zero reads \(r_0, \dots, r_{m-1}\) and terminating read \(r_m = 0\), \(r \mapsto r_m\) and \(p \mapsto \prod_{i \in [0, m-1]} r_i\). D: **Incorrect:** Incorrectly shifts the indices by \(n\).

Report a correction for Q60

Question 61 MCQ · 5.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Identify the set of test paths that provide edge-pair coverage?
6406533952543.
{[1,3,4,3,4,3,5]}
6406533952544.
{[1,2,5], [1,3,4,3,4,3,5]}
6406533952545.
{[1,2,5], [1,3,5], [1,3,4,3,4,3,5]}
6406533952546.
{[1,2,5], [1,3,5], [1,3,4,3,5]}

Published solution

**Step 1: List all edge pairs (subpaths of length 2 edges) in \(G = (V, E)\).** Given \(E = \{(1,2), (1,3), (2,5), (3,4), (3,5), (4,3)\}\), the valid paths of length 2 are: 1. `[1, 2, 5]` (via `(1,2)` then `(2,5)`) 2. `[1, 3, 4]` (via `(1,3)` then `(3,4)`) 3. `[1, 3, 5]` (via `(1,3)` then `(3,5)`) 4. `[3, 4, 3]` (via `(3,4)` then `(4,3)`) 5. `[4, 3, 4]` (via `(4,3)` then `(3,4)`) 6. `[4, 3, 5]` (via `(4,3)` then `(3,5)`) **Step 2: Check which test path set covers all 6 edge pairs.** - `[1, 2, 5]` covers `[1, 2, 5]`. - `[1, 3, 5]` covers `[1, 3, 5]`. - `[1, 3, 4, 3, 4, 3, 5]` covers `[1, 3, 4]`, `[3, 4, 3]`, `[4, 3, 4]`, and `[4, 3, 5]`. Note that `[1, 3, 4, 3, 5]` in Option D misses the edge pair `[4, 3, 4]`. Therefore, Option C is the minimal complete set providing Edge-Pair Coverage. **Answer: C (`{[1,2,5], [1,3,5], [1,3,4,3,4,3,5]}`)** A: **Incorrect:** Misses the edge pairs `[1, 2, 5]` and `[1, 3, 5]`. B: **Incorrect:** Misses the direct edge pair `[1, 3, 5]`. C: **Correct:** Covers all six edge pairs: `[1,2,5]`, `[1,3,5]`, `[1,3,4]`, `[3,4,3]`, `[4,3,4]`, and `[4,3,5]`. D: **Incorrect:** The path `[1,3,4,3,5]` does not traverse the loop twice, so it misses the edge pair `[4, 3, 4]`.

Report a correction for Q61

Question 62 MCQ · 5.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
What is the cyclomatic complexity of the given CFG?
6406533952547.
3
6406533952548.
4
6406533952549.
5
6406533952550.
6       **AI** **Section Id :** 64065382583 **Section Number :** 4 **Section type :** Online **Mandatory or Optional :** Mandatory **Number of Questions :** 7 **Number of Questions to be attempted :** 7 **Section Marks :** 24 **Display Number Panel :** Yes

Published solution

**Step 1: Recall the formula for Cyclomatic Complexity \(M\) of a Control Flow Graph.** \[M = |E| - |V| + 2\] where \(|E|\) is the number of edges and \(|V|\) is the number of vertices. **Step 2: Substitute the given values.** - Number of vertices \(|V| = |\{1, 2, 3, 4, 5\}| = 5\) - Number of edges \(|E| = |\{(1,2), (1,3), (2,5), (3,4), (3,5), (4,3)\}| = 6\) \[M = 6 - 5 + 2 = 3\] **Answer: A (3)** A: **Correct:** Using \(M = E - V + 2 = 6 - 5 + 2 = 3\) (also equal to 2 decision nodes \(\{1, 3\}\) plus 1). B: **Incorrect:** 4 results from miscounting edges or vertices. C: **Incorrect:** 5 is the number of vertices \(|V|\), not the cyclomatic complexity. D: **Incorrect:** 6 is the number of edges \(|E|\), not the cyclomatic complexity.

Report a correction for Q62