






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Padua-Perez; Class: OBJECT-ORIENTED PROG II; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Exams
1 / 10
This page cannot be seen from the preview
Don't miss anything!







a. (1 pt) Regression testing ensures functionality is not lost when software is bought & sold. F b. (1 pt) Pair-Programming is one of the characteristics associated with extreme programming. T c. (1 pt) Formal methods are mathematically-based techniques used for high-integrity systems. T d. (1 pt) We prefer inheritance over composition when designing a system. F e. (1 pt) Test coverage measures whether code is executed by some test case. T f. (1 pt) Omega testing can start once we have completed Alpha and Beta testing. F g. (1 pt) Good unit tests eliminate the need for integration tests. F h. (2 pts) The software life cycle is a sequence of essential operations necessary for producing quality software. Name two of those operations. Answer: Any two of Specification, Design, Selection of Algorithms, Coding and Debugging, Testing and Verification, Documentation and Support, Maintenance. i. (2 pt) In code that contains two if statements, what is the maximum number of flow paths through the code? Answer: 4 j. (2 pts): The Unified process model, the waterfall model, and extreme programming are three different software development methodologies. Order these, from most suitable to least suitable, for developing a totally new kind of application where the functionality required by the application isn’t well understood. Answer: Extreme, Unified, Waterfall k. (2 pts): Compare when/how testing is done in extreme programming, compared to the waterfall model. l. Answer: XP – testing done throughout the whole development process; waterfall at the end
1. (1 pt) JFrame and JPanel are considered containers. T 2. (1 pt) Inner classes can only access private components of the outer class. F 3. (3 pts) Briefly describe the three components associated with Model-View-Controller model? Answer: Model handles data (performs actual work), View lets user see what program is doing Controller controls what work the program is doing (1 pt) What is the Event Dispatching Thread? Answer: Thread where we schedule GUI processing 4. (4 pts) Rewrite the main method using an inner class named Handler rather than using an anonymous inner class. public class GUIExample { public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { new GUIExample(); } }); } }
public class GUIExample { public static class Handler implements Runnable { public void run() { new GUIExample(); } } public static void main(String[] args) { javax.swing.SwingUtilities. invokeLater (new Handler()); } }
1. (1 pt) A thread (child) created by another thread (parent) will die immediately after the parent dies. F 2. (1 pt) If multiple threads are reading a shared field they should use synchronization, even if no other thread is updating the field. F 3. (1 pt) Any lock object used to protect a critical section must always be stored in a static field. F 4. (1 pt) A thread can only hold a maximum of two locks at a time. F 5. (1 pt) If a thread holds a lock on an object x , that prevents other threads from changing any fields of x. F 6. (1 pt) We can use a join method call to make a thread wait for another thread to complete execution. T 7. (1 pt) Each thread has its own stack but it shares the heap with other threads. T 8. (2 pts) Assume t1 and t2 are two thread objects. Circle the ones in which a data race could be possible between threads t1 and t2 (circle one or both, as appropriate; if neither, write NEITHER). Sequence1 t1.start(); t2.start(); t1.join(); t2.join(); Sequence2 t1.start(); t1.join(); t2.start(); t2.join(); 9. (6 pts) Implement the delayedShutdown method in the following class. public class Shutdown { /** Print msg and shut down JVM / public static void shutdownNow(String msg) { System.out.println(msg); System.exit(1); // cause entire JVM to shut down } /* * Method should create and start a thread so that after sleeping * for the number of seconds provided, the method shutdownNow * is invoked with the supplied msg. * This method invocation should return immediately, not waiting the * for the shutdown to occur. */ public static void delayedShutdown(int seconds, String msg) { Answer 1 (implements Runnable) public class Shutdown implements Runnable { private int secs; private String msg; public static void shutdownNow(String msg) { System. out .println(msg); System. exit (1); // cause entire JVM to shut down } public static void delayedShutdown(int seconds, String msg) { Thread t = new Thread(new Shutdown(seconds, msg)); t.start(); } public Shutdown(int secs, String msg) { this.secs = secs; this.msg = msg; }
(8 pts) BFS/DFS a. Given two different possible orders in which the nodes of this graph could be visited in performing a Breadth First Search (BFS) starting at vertex A. Answer(s): Any two of: ABQCYRW, ABQCRYW, AQBCYRW, AQBCRYW b. Given two different possible orders in which the nodes of this graph could be visited in performing a Depth First Search (DFS) search starting at vertex A. Answer(s): Any two of : ABCRWQY, ABCYWQR, AQCRWBY, AQCYWBR
Implement the method below based on the following Java class definitions. You may not add any instance variables or static variables either class, and you may not add any methods to the Node class. You will need to add a helper recursive function to the BinaryTree class (that takes a Node as a parameter). Non-recursive solutions will receive zero credit. public class BinaryTree
public boolean isFull() { return isFullAux(root); } private boolean isFullAux(Node