1/23
Flashcards generated from the multiple-choice questions and answers in Homework Assignment 1.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is identified as a popular approach to mitigating bugs in software engineering in Question 1.1.1?
Static analysis.
According to Question 1.1.2, what statements are true regarding the definition of a bug?
A bug is a static defect in the code (e.g., a typo in writing a variable name), refers to the erroneous state due to a typo in the code, and faults, errors, and failures are collectively known as bugs.
Which criterion is NOT used to identify a leader statement when constructing basic blocks for a Control-Flow Graph (CFG)?
The last statement executed inside a loop body before the loop repeats.
What is the correct relationship between the project phase and the cost of finding and fixing a software fault?
Finding and fixing a fault is cheapest early in the project, and the relative cost rises rapidly the later the fault is discovered.
In the Java class C, why is there a fault in the loop for (int i = 1; i < args.length; i++) when attempting to print command-line arguments?
Arrays in Java are 0-based, so the loop should start from index 0 rather than index 1 to process all command-line arguments.
Why is manual code review considered problematic in software engineering?
Manual code review is subject to bias, programmers can miss faults, and it is hard to measure progress.
Why do software faults, unlike hardware faults, NOT "reappear" due to aging?
Software does not physically degrade over time, so its faults originate from programmer mistakes rather than the aging of parts.
In the numZero function where the loop incorrectly starts at index 1 instead of 0, what are the resulting error and failure on input [0, 2, 7] (expected output 1, actual output 0)?
The error is that i starts at 1 instead of 0, so index 0 is never checked. The failure is that count is 0 instead of 1 at the return statement.
How do validation and verification differ as goals of software testing?
Validation evaluates software at the end of development to ensure compliance with intended usage, while verification determines whether the products of a given phase fulfill the requirements established during the previous phase.
Which category of static analysis is capable of being sound, meaning it produces no false negatives?
Abstract interpretation-based static analysis.
According to the assignment notes, why does software often come with bugs?
Useful software systems are complex, and in order to remain useful, software systems must evolve to the changing requirements of the users. Building and changing a complex system is inherently error prone.
What are the distinct trade-offs/limitations associated with verification and static analysis?
Verification has a high learning curve and poor scalability, whereas static analysis has limited applicability and produces false positives/negatives.
What is the accurate historical facts regarding the origin of the term "bug"?
Thomas Edison used the term "bug" to describe design difficulties decades before Grace Hopper's team documented an actual moth causing a relay malfunction in 1947.
What real-world consequences were caused by the NASA Mars lander fault and the THERAC-25 incident?
NASA's Mars lander crashed due to a unit's integration fault, and the THERAC-25 radiation machine's poorly tested safety-critical software resulted in patient deaths.
What primary limitation is shared by automated testing techniques such as property-based testing, fuzzing, and feedback-directed random testing?
In most cases they cannot cover all possible executions and need a test oracle.
What is the definition of a basic block in a control-flow graph (CFG)?
A maximal sequence of statements that can be entered only at the first statement and exited only from the last statement.
How many basic blocks are in the control-flow graph of the fib(int m) routine provided in Question 1.1.17?
6 basic blocks.
Given a CFG G=⟨N,E⟩, what condition does NOT justify the existence of an edge from basic block i to basic block j?
Blocks i and j declaring variables of the same data type is NOT a valid condition for an edge.
What branch coverage is achieved on testMe by a test suite consisting of testMe(0, true, false) and testMe(0, false, true)?
100% branch coverage.
If a test suite achieves 100% path coverage on a program, what statement coverage and branch coverage does it guarantee?
It guarantees both 100% branch coverage and 100% statement coverage due to subsumption.
Why is 100% path coverage generally considered impractical for a routine containing a single unbounded while loop?
The number of distinct paths through the loop can be infinite, making 100% path coverage infeasible to achieve or even enumerate.
What type of mutation operator transforms if (a && b) into if (true), and how does it compare to replacing a && b with a || b?
Both are Conditional Operator Replacement (COR) mutations; the first replaces the whole condition with a constant while the second swaps one logical operator for another.
What is weak mutation testing, and what is its main drawback?
Weak mutation testing kills a mutant as soon as its execution causes a change in internal program state without checking whether that change actually propagates to the observable output. Its drawback is imprecision because some mutants marked as killed may not actually be killed under the stricter (strong) definition.
How does software testing compare overall to code review, static analysis, and verification?
Testing is more reliable than code review, has fewer false positives and is more broadly applicable than static analysis, and has virtually no learning curve compared to verification.