ICS 52 - Introduction to Software Engineering
Fall, 1998

Final Exam

  1. (5 points each, 30 points total) Define each of the following terms, as used in software engineering.
    1. Function point system
      A system for measuring the complexity of source code in a language-independent manner.

    2. Internal (to describe a software quality)
      Qualities of concern to the developers of the system; qualities dealing with the structure of the software, and not visible to users

    3. Fault (in testing)
      An incorrect intermediate state entered during program execution; a variable being assigned a wrong value, or a wrong statement being executed.

    4. Structural testing
      White-box testing (4 pts for just this); testing what the program does; using the internal structure or code to derive test data.

    5. Testing oracle
      A mechanism for determining whether the outcome of a test is correct.

    6. 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 be executed at least once.

  2. (4 points) Describe two issues addressed by software configuration management.

    From Section 7.3.2:

    Multiple accesses, by more than one programmer, to a common repository of components.

    Handling product families, in which a component may exists in multiple versions.

  3. (6 points) Below is a USES diagram with fictional module names. For each node, write in the level number, as described in the textbook.

  4. (7 points) Below are two alternate versions of part of a Library module's design. In each case, the getTitlesSortedByAuthor method is supposed to return information about the Titles in the Library, in a specified range of call numbers, and in order by the name of the author.
    	// version 1
    	class Library {
    	   Enumeration getTitlesSortedByAuthor(CallNo start, CallNo end);
    	}
    
    	// version 2
    	class Library {
    	    Title[] getTitlesSortedByAuthor(CallNo start, CallNo end);
    	}
    
    Discuss the relative benefits and shortcomings of each approach (if any), referring to software qualities and principles.

    The weakness of version 2 is that it either exposes an internal data structure (the sorted array), or it is inefficient, because an array will have to be constructed. Version 1 shows greater qualities of information hiding and abstraction.

  5. (10 points) According to the Scientific American article ``Command and Control,'' ATAMS was successful because it ``combined several techinques that were shown years ago to produce better software faster.'' Name and briefly describe two techniques mentioned in the article, and explain which software engineering qualities or principles each technique illustrates.
    1. First technique:

    2. Second technique:

    [You had to give techniques alluded to in the article.]

    Displays and user interfaces were built first, rather than last. -- separation of concerns, user-friendliness

    The system was split into small segments and the riskiest ones were done first. -- anticipation of change, modularity

    Off-the-shelf software and large sections from other systems were used. -- reusability, modularity

    Programmers peer-reviewed one another's designs and code, catching more that 200 major design errors while they were still easy to fix. -- understandability, incrementality

    The engineers had to perfect each segment before moving on. -- correctness, verifiability, incrementality

    Frequent contact with users. -- user-friendliness, validity of requirements, possible visibility

    Will be updated once a year, rather than replaced once a decade. -- incrementality, maintainability, anticipation of change

    First in a product line of related systems. -- reusability, anticipation of change, planning for a software family

  6. (10 points) Dijkstra has written ``Program testing can be used to show the presence of bugs, but never to show their absence.''
    1. Does this statement hold for structural testing? Explain your answer.
      Still holds, for same reasons: too many possible inputs to test them all, lack of continuity property in software.

    2. If the statement is true, then why do we perform testing?
      To locate errors; to increase confidence in the software.

  7. (15 points) The method sumMaxAndMin is supposed to take three integer parameters and return the sum of the largest and smallest of its parameters. If two of the parameters are equal, one of them is considered to be the middle value that is not summed.

    Assume that the sumMaxAndMin method is invoked elsewhere in the program with this statement: System.out.println(sumMaxAndMin(i, j, k));, where i, j, and k are integers.

    	int sumMaxAndMin(int x1, int x2, int x3)
    	{
    	  boolean med1 = false, med2 = false, med3 = false;
    
    	  if ( (x2 >= x1 && x1 >= x3) || (x2 <= x1 && x1 <= x3) )
    	     med1 = true;
    	  if ( (x1 >= x2 && x2 >= x3) || (x1 <= x2 && x2 <= x3) )
    	     med1 = true;
    	  if ( (x2 >= x3 && x3 >= x1) || (x2 <= x3 && x3 <= x1) )
    	     med3 = true;
    
    	  if (med1)
    	     return x2+x3;
    	  if (med2)
    	     return x1+x3;
    	  if (med3)
    	     return x1+x2;
    	}
    
    1. (4 points) There is an error in sumMaxAndMin. What is it?
      The second "med1 = true" should be "med2 = true".

    2. (7 points) 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.
      I meant the answer to this question to concern the case where all three inputs are equal, but I blew it. It seems that every fault leads to a failure. Everyone received full credit on the question.

    3. (4 points) Give an example of input parameters that cause a failure, and say what the failure is.
      With parameters (1, 2, 3), the result should be 4, will be 5.

  8. (3 points) The difference between an ``abstract object'' and a software ``library'' is (choose one)
    1. an abstract object has a state. (see p. 53)
    2. an abstract object is an ADT.
    3. a library has an interface.
    4. an abstract object hides implementation details.
    5. a library is reusable.

  9. (3 points) Testing individual modules is called (choose one)
    1. testing in the small. (see p. 269)
    2. white-box testing.
    3. black-box testing.
    4. testing in the large.
    5. integration testing.

  10. (3 points) In which quadrant of the spiral model is validation and verification done? (Choose one)
    1. south-east (see p. 381)
    2. north-east
    3. north-west
    4. south-west
    5. in all quadrants

  11. (3 points) For a correct program, (choose one)
    1. any test set is ideal. (see p. 265)
    2. no test set is ideal.
    3. these is no test selection criteria.
    4. the test set must be a partition.
    5. the complete coverage condition cannot be achieved.

  12. (3 points) The textbook states that in order to achieve modular composability, decomposability, and understanding, modules must have (choose one)
    1. high cohesion and low coupling. (see p. 51)
    2. high cohesion and high coupling.
    3. low cohesion and low coupling.
    4. low cohesion and high coupling.
    5. either (a) or (d).

  13. (3 points) Which of the following is a reason why the path coverage condition is almost impossible to achieve? (Choose one.)
    1. The number of execution paths is very large. (see p. 277)
    2. The number of nodes in the control flow graph is very large.
    3. Each test case can traverse at most n paths, where n is the number of nodes in the control flow graph.
    4. Some loops in the program would have to be skipped.
    5. Test cases can only test reachable statements.