Final Written Spring2017
Final Written Spring2017
Final Written Spring2017
1. Servlets – Explain the difference between a GET and POST form submission. Give
one reason why a programmer would choose to use a GET and one reason why a
programmer would choose to use a POST. (0.5% + 0.5% + 0.5%)
Difference
Reason #1
Reason #2
Define AJAX
4. Concurrent Programming - What is the primary goal of each of the three types of
concurrent programming? (0.5% + 0.5% + 0.5%)
Multi-threading
Parallel
Distributed
IP – 120.192.168.50
IP – 0111 1000 1100 0000 1010 1000 0011 0010
Subnet Mask – 255.255.248.0
Subnet Mask – 1111 1111 1111 1111 1111 1000 0000 0000
1 import java.util.concurrent.locks.Lock;
2 import java.util.concurrent.locks.ReentrantLock;
3 public class Question7 {
4 private Lock lock = new ReentrantLock();
5 public void foo() {
6 try {
7 lock.lock();
8 System.out.println("foo 1");
9 bar();
10 System.out.println("foo 2");
11 } finally {
12 lock.unlock();
13 }
14 }
15
16 public void bar() {
17 try {
18 lock.lock();
19 System.out.println("bar");
20 } finally {
21 lock.unlock();
22 }
23 }
24
25 public static void main(String [] args) {
26 Question7 q7 = new Question7();
27 q7.foo();
28 }
29 }
1 import java.util.concurrent.locks.Lock;
2 import java.util.concurrent.locks.ReentrantLock;
3
4 public class Question8 {
5 private Lock lock = new ReentrantLock();
6 public synchronized void foo() {
7 try {
8 lock.lock();
9 System.out.println("foo");
10 } finally {
11 lock.unlock();
12 }
13 }
14 public void bar() {
15 try {
16 lock.lock();
17 synchronized(this) {
18 System.out.println("bar");
19 }
20 } finally {
21 lock.unlock();
22 }
23 }
24 }
b. If yes, explain how? If no, what are all the possible outputs?
9. Conditions – There are two ways to wake up a thread that is waiting on a condition –
signal() and signalAll(). Since we don’t have control over the order threads
are switched into the CPU from the Ready state, why would we ever call signal()
instead of signalAll()? (0.5%)
a. Write the SQL code to represent jenny checking out the book Happy
Birthday, Bad Kitty. (0.5%)
b. Draw the table that is returned from the following query after the SQL
statement from part a has executed. (0.5%)
SELECT b.title, co.numCheckedOut
FROM Book b, CheckedOut co
WHERE b.bookID=co.bookID;
Extra Credit – For the final project, we required weekly meetings with your assigned
CP. (0.25%)
Please explain.
Extra Credit – This is the first semester we have included web development in the
course. (0.25%)