CS636 Midterm Exam, for practice, F17   NAME:_________________________                               

Open print books, handouts, solutions, etc. Closed electronic devices.  If you do not have a print copy of Murach, sit in the first chair of a row.

Note there is no SQL problem on this practice exam, but there will be SQL queries on the real exam.

Show all work on these pages, using backs of pages if needed.  Points are marked in parentheses.  Total points = 100.

1.       (24) Suppose you are automating operations for a store selling PCs.   All PCs of a certain model number are equivalent as far as buyers are concerned, but the store wants to sell them in FIFO (first-in, first-out) order so that no box gets too worn-looking.  Each PC has a model number (int), serial number (10-char string), vendor id (int), and delivery date (int day number.) 

  1. Using our client-server database applications technology, how should we hold the data on all the PCs to support this application?  Write the SQL that the program needs to use to create an empty version of the data holder. 







  1. Given a model number, say 1234, for the next PC to sell, write the SQL query that determines the serial number of the PC that should be selected for the customer.



  3. Design a domain class and DAO API (method signatures only) for this app that supports insert as well as the retrieval as described above.






2.       (14) In the same scenario as problem 1, once a PC is sold, we need to keep track of the customer for each individual PC.  Each PC has a unique customer but a single customer can purchase multiple PCs. Each customer has a string name and a social security number (ssn, an integer).

  1. How should we hold the data on customers?  As in 1a, show the creation of the data holder using SQL.






  1. What foreign key constraint can be added to this system to improve its integrity?






3.  (24) Web Background

  1. Write two simple web pages a.html and b.html that reside in the same directory with local path /testmsg on a certain web server.  Page a links to page b, and page b has a form with a single text input with name “msg”, no ACTION specified, but with a submit button. 







  1. Suppose a user browses to page a.html as served by the web server, follows the link to b.html, and then fills in “hello” in the text box and clicks the submit button.  Give the sequence of HTTP request and responses to this web server that would happen, stopping after the request that carries the “hello” data back to the server (using b.html’s local path, the default ACTION URI.) Assume that a.html and b.html have no images or CSS files.





4.  (14) Ant and command line tools.

  1. Consider pa1b. If "ant build" and "ant oraSysTest" work, but "ant hsqlSysTest" fails to execute (never even does one SystemTest command), give two possible reasons for this behavior (missing files, wrong file content, something you forgot to do, for example.)






  1. Consider JdbcCheckup.java. Suppose your current directory is your own jdbc directory on topcat containing JdbcCheckup.java and the driver jar files, previously copied from /data/htdocs/cs636/jdbc. Give the command to compile JdbcCheckup.java, and then the command to run it to connect to Oracle on dbs3. You don't need to show how to enter information into the running program.



5.    (24) System implementation.  In pizza1 consider the service method listed here:

     // return all orders for this room, for today, in order by id
    public List<PizzaOrderData> getOrderStatus(int roomNumber) throws ServiceException {
        List<PizzaOrder> pizzaOrders = null;
        List<PizzaOrderData> pizzaOrders1 = new ArrayList<PizzaOrderData>();
        try {
            pizzaOrders = pizzaOrderDAO.findOrdersByRoom(roomNumber, adminDAO.findCurrentDay());    
            for (PizzaOrder order: pizzaOrders) {
                pizzaOrders1.add(new PizzaOrderData(order));
        } catch (SQLException e) {
            throw new ServiceException("Error in getting status" + e, e);
        return pizzaOrders1;

  1. What calls into the DAO layer occur during the execution of this method?  List their method names in execution order.


  3. Explain why this method does not qualify as a “getter”, even though its name starts with “get”.


  5. How do we know that there is no UI (user interface action) during the execution of this call?

  7. In this code, what code takes a PizzaOrder object and returns the corresponding PizzaOrderData object?   

  9. What is the advantage of the PizzaOrderData object over the PizzaOrder object (holding the same information on the order) for transporting information to the presentation code?