Homework 1
CS 562
Software Engineering II
10 Points
Due Friday, Feb. 7, 2014 at the beginning of class

1. (5 points) Showing all work, complete problems 1-10 of the Computer Science GRE Sample Exam available on the class eCompanion site.

2. (1 point) What problems (i.e. errors or defects) exist with the following code?  How would you fix them?
a) double a, b; . . . if(a * 3.5 == b + 2.7) { // do something . . .
b) float PI = 3.14159265f;
c) double x = 3.02e-18 + 2.34e134;  //Assume high precision is needed for x.

3. (1 point) Read about stable sorting algorithms by performing a Google search.  Be sure to look past the first search result that Google returns.  Java contains a Collections.sort method.  Try this out on at least two test cases that will allow you to determine if Java is using a stable sorting method.  Provide and explain your results.

4. (1 point) Read about race conditions.  Write or find a short program in a language such as C or Java that produces a race condition.  Introduce a sleep or pause method call into each of the running threads.  How long does it take for you to see the error caused by the race condition with the sleep/pause enabled? Without it?  Why?

5. (2 points) What kinds of stress tests should you subject the following applications to?  Why?
a) A mobile content management system
b) A highly used retail site such as amazon.com, walmart.com, or newegg.com
c) A massively multiplayer online role playing game
d) A flight management system