Back to schedule page Prev Next
Quiz Number 7

SWE 637, Fall 2017
23 October

Print your name on the line, top right, then answer the questions as concisely as you can. Please write neatly; if I can’t read your answer I have to mark it wrong.

 ``` 1. insertProcedure (int a[], int p [], int N) 2. { 3. int i, j, k; 4. for (i=0; i<=N; i++) 5. p[i] = i; 6. for (i=2; i<=N; i++) 7. { 8. k = p[i]; 9. j = 1; 10. while (a[p[j-1]] > a[k]) 11. { 12. p[j] = p[j-1]; 13. j--; 14. } // end while 15. p[j] = k; 16. } // end for 17. } // end insertProcedure ```
1. (10 pts.) Use the method above to answer the following questions.
1. (2 pts.) Draw the control flow graph. To simplify grading, use the line numbers for node numbers. For example, the node that represents the “while” statement should be node 10. (You will not need all the numbers.)
2. (2 pts.) Give Reach (6), the set of reachable nodes from node 6.
3. (1 pt.) Give one path that is not a test path.
4. (1 pt.) Give one test path that is not a prime path.
5. (4 pts.) List the edge-pair coverage test requirements for the graph. You do not need to list TRs that are less than length 2, unless they are not part of a longer TR.