QMCS280, Spring, 1999
Exam 4
Name: _____________________________________ Date: ______________________
1. There are two major factors that cause existing programs to be changed (program maintenance). Briefly describe each of these.
2. Circle the correct answers. Which of the following is true of the software life cycle?
a. Goal is to minimize the total effort, development plus maintenance
b. Projects are almost always completed on time and within budget
c. Care in the development stage never pays off in the maintenance stage
d. Program design is not as important as the programming language
e. Maintenance is usually done by the original programmer
3. List all four of the "waterfall model" steps and then comment on the impact of having to fully complete one step before going on to another.
4. Circle the correct answer. Which of the following implies that we are able to go back to a previous step in the development process when we deem it necessary.
a. Evaluation
b. Iteration
c. Prototyping
d. Coding
5. Briefly explain what is involved in "prototyping".
6. Circle the correct answer. Which type of program testing requires you to know how to interface with a method without knowing the internal workings of it?
a. Black box testing
b. White box testing
7. Briefly describe the disadvantages of determining system requirements by interviewing users of the system.
8. Fill in the blank. A Java ________________________________________ is "thrown" by a program or runtime environment and should be "caught" and handled.
9. Fill in the blank. A Java ________________________________________ represents an unrecoverable situation that should not be handled.
10. Circle the correct answer. An exception can be:
a. Not handled
b. Handled where it occurs
c. Handled at another point in the program
d. All of the above
11. Circle the correct answer. Which Java block is executed only when an exception is thrown?
a. finally
b. catch
c. throw
d. pitch
13. Briefly define and describe multiprogramming.
14. Circle the correct answer. In which way can "threads" be used in Java?
a. By inheriting from the "Thread" class
b. By implementing the "Runnable" interface
c. Either a or b
d. Neither a nor b
15. Fill in the blank. No matter how you choose to use threads in Java, one method will need to be defined for the object to be "threaded". That method is called: ___________________________.
16. Circle the correct answer. Which method will cause the Java thread to stop for a defined period of time?
a. suspend()
b. resume()
c. sleep(long milliseconds)
d. pause(indefinitely)
17. Circle the correct answer. What is the probable output of the following Java code?
public class Question_17{
public static void main (String[] args){
Thing one = new Thing("Ben");
Thing two = new Thing("Joe");
one.start();
two.start();
}//method main
}//class Question_17
class Thing extends Thread{
private String name;
Thing(String st){
name = st;
}//constructor
public void run(){
for(int i = 0; i < 3; i++){
System.out.print(name + ',');
}
}//method run
}//class Thing
a. Ben,Ben,Ben,Joe,Joe,Joe,
b. Ben,Joe,Ben,Joe,Ben,Joe,
c. Ben,Ben,Ben,Ben,Ben,Ben,
d. None of the above
18. Briefly explain what is meant by a "synchronization" issue when it comes to Java threads.
19. Briefly describe what is involved in the "refinement cycle" as described in your text:
Exam 4
Java Coding
1. Write the Java code for an application that will divide one integer value by another. The program should declare the variables and give then each an initial value (don't need to do keyboard input). The program should also check for and handle the exception "ArithmeticException" which is generated by dividing by zero.