- (5 points each, 25 points total)
Define each of the following terms, as used in software
engineering.
- Test case
A function/method to test, an input, and an expected output.
- An error (in testing)
A flaw or defect in the source code.
- Edge coverage criterion
Selecting a test set such that, after each test case
in the test set has been executed, each
edge in the program's control flow graph has been
executed at least once.
- Software design
A system decomposition into modules.
A description of what each module is intended to do and
of the relationship between modules.
is correct.
- Testing oracle
A mechanism for determining whether the outcome of a test
is correct.
- (10 points)
Draw lines between the kind of testing on the left
and the corresponding description on the right.
(Two descriptions don't correspond to testing types.)
big-bang doing all integration testing at once
functional based on what a program is intended to do
regression checking for degradation due to modifications
in the small testing individual software components
structural using the source code to derive test data
(no match) used only when the input is described by a grammar
(no match) based on the complete coverage principle
- (7 points)
Recall the article ``The Cathedral and the Bazaar.''
- Briefly describe the ``cathedral'' style of software
development.
Software is released only at long intervals, after much
effort has been expended finding and fixing bugs.
Good for initial development.
- Briefly describe the ``bazaar'' style of software
development.
Software is releases often; users are partners in software
development; anyone can contribute and find or fix bugs.
Not appropriate for original development of system.
Open-source software style.
- Choose one software quality (from Chapter~2)
or software engineering principle (from Chapter~3),
name it, and describe how the cathedral and bazaar
styles differ in terms of that quality or principle.
- (8 points)
The book says that stepwise refinement ``fails to scale
up to systems of even moderate complexity.''
Identify and briefly explain two of the shortcomings
of stepwise refinement.
(We scored this question quite strictly, not giving
credit for answers that didn't directly address the
particulars of stepwise refinement.)
(See pp. 112-113.)
Subproblems tend to be analyzed in isolation.
No attention is paid to information hiding.
No attention is paid to data.
The top function may not exist.
There is a premature commitment to the control structures
that govern the flow of control among modules.
- (8 points)
Draw and label a diagram of the spiral model.
Two points for each quadrant, plus one point for the
spiral, if that didn't put the total over 8.
- (12 points)
You have been assigned to design test cases for black
box testing of a function called StringToInt.
The function takes a String as its parameter and returns
the int with the corresponding value. For instance,
StringToInt("-35 ") returns -35.
The function throws a NotAnIntException if the parameter
is invalid and the function cannot make the conversion.
- For this function, what is the input domain?
Also, describe the format of valid inputs.
(Of course you should read the answers below as a
sample, not the only correct possibility.)
Strings starting with
0 or more spaces, followed by 0 or 1 dashes (minus
signs), followed by 1 or more characters in the range
'0' through '9', followed by 0 or more spaces.
- For the input domain you defined in (a),
name a specific basis for dividing the domain into
subdomains.
Number of leading spaces. Assume that otherwise the
String is correctly formatted.
- Using the basis from (b), name three or four
subdomains.
1. No leading spaces.
2. One leading space.
3. Between two and 10 leading spaces.
4. More than 10 leading spaces.
- For each subdomain from (c), give a test case
input and the expected output.
1. Input: ``193''. Expected output: 193.
2. Input: `` 193''. Expected output: 193.
3. Input: `` 193'' (three spaces). Expected output: 193.
4. Input: `` 193'' (20 spaces). Expected output: 193.
- (12 points)
Consider the function sort3, which sorts in place
an array of 3 ints. If the array length is not 3 it is
supposed to leave the array unchanged. Assume that the
values of the array are displayed on the screen after
sort3 returns.
public void sort3(int[] n)
{ if (n.length != 3) return;
// move smallest element to position [0] if it's not already there
if (n[1] < n[0] || n[1] < n[2]) // n[1] smallest?
{
int temp = n[0]; n[0] = n[1]; n[0] = temp; // swap n[0], n[1]
}
else if (n[2] < n[0] && n[2] < n[1]) // n[2] smallest?
{
int temp = n[0]; n[0] = n[2]; n[2] = temp; // swap n[0], n[2]
}
// move next smallest to [1], if it's not already there
if (n[2] < n[1])
{
int temp = n[1]; n[1] = n[2]; n[2] = temp; // swap
}
}
- One error in sort3 is the
statement n[0] = temp;.
There is another error -- what is it?
(n[1] < n[0] || n[1] < n[2]) should be
(n[1] < n[0] && n[1] < n[2]).
- The method could generate a fault that
does not lead to a failure. Explain how, specifying
the parameters, the fault, and why no failure occurs.
Calling sort3 on the array [10, 20, 30]
causes the first swap to be executed, which is incorrect;
However, since the value in position [0] is left in place,
sort3 gives the correct output [10, 20, 30].
- Give an example of input parameters that
cause a failure, and say what the failure is.
[30, 20, 10] becomes [30, 10, 20]; it should
become [10, 20, 30].
Since the values are output to the screen, it is a failure.
- (3 points)
Which of the following is a reason why the path
coverage condition is almost impossible to achieve?
(Choose one.)
- The number of execution paths is very large. (see p. 277)
- The number of nodes in the control flow graph is very large.
- Each test case can traverse at most n paths, where
n is the number of nodes in the control flow graph.
- Some loops in the program would have to be skipped.
- Test cases can only test reachable statements.
- (3 points) When a module M is decomposed into other modules,
we say that these are used to (choose one)
- implement M. (see p. 64)
- design M.
- interface M.
- export M.
- abstract M.
- (3 points) Which of the following adjectives does not
describe the waterfall model, according to the textbook?
(Choose one.)
- Cyclic. (see p. 371)
- Rigid.
- Monolithic.
- Linear.
- Ideal.
- (3 points) If the steps of a software process, and its
current status, are well documented, then the software
development process is (choose one)
- visible. (see p. 35)
- general.
- malleable.
- rigid.
- incremental.
- (3 points) Code walk-throughs and code inspections are
used primarily for (choose one)
- verification. (see p. 299)
- determining test cases.
- integration testing.
- validation.
- function point analysis.
- (3 points) Configuration management systems address problems
that arise from (choose the one best answer)
- acceptance testing.
- sharing components.
- handling product families.
- (a) and (b).
- (a) and (c).
- (b) and (c) (2 and 3 in html). p. 406