DOC PREVIEW
UMD CMSC 433 - Final Exam

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

433 Final Exam, Fall 2006December 20th, 2006GuidelinesPut your name on each page before starting the exam, and write your answer directly on the examsheet.Punting a QuestionYou may punt on any question. To punt, write punt for your answer, and you will receive 1/5 ofthe points for that question. If you already have written some material for the question when youdecide to punt, be sure to make sure write down your decision to punt in such a way that it is veryclear you have decided to punt the question. The point of the punt rule is to avoid wasting both yourtime and my time when you realize that you don’t think you can answer the question well.Blank extra pagesThere are blank e xtra pages at the end of the exam. Feel free to use those if you need more space.GradeQuestion Points Grade1 152 153 204 155 206 151Questions1. In the paper “A Note on Distributed Computing”, the authors claim that some frameworks fordistributed computing such as Remote Procedure Call (RPC) and CORBA offer an attractivevision that is not a good foundation on which to build reliable distributed systems.What is the vision that they warn against, and name and describe at least two of the differences(they mention 4) between local and distributed computing (you will lose points for listingdifferences not in their list of 4).22. Write a class with two methods, t1() and t2(), that if called by two different threads, mightdeadlock. Add whatever fields or other methods you need. Your methods shouldn’t (and don’tneed to) call wait() or await(). This question isn’t asking to write some useful abstraction,but rather to provide a very concrete des cription of what deadlock is. Also provide a short(English) guideline for how to avoid deadlock (it doesn’t matter if the guideline isn’t universallyapplicable; just desc ribe what steps suffice in the majority of cases to avoid deadlock).33. This question concerns the difference between Set<? extends Foo>, Set<Foo> and Set<? super Foo>.(a) Describe some operations that will compile against some of them, but not against other,that distinguish them (e.g., you can do Blah to a X or a Y, but doing it to a Z won’tcompile. Give enough examples to distinguish all three.(b) Consider the two methods below:class Bar {HashSet<Foo> foos;Set<? extends Foo> getFoosVersionOne() { return foos; }Set<? super Foo> getFoosVersionTwo() { return foos; }... other methods}Assume your project is trying to decide which which return typ e the getFoos() methodshould have, based on what behaviors they want to encourage/discourage/permit/forbidin the caller of the getFoo() method. Summarize, briefly, how they should decide basedon the be haviors they want to e/d/p/f.(c) Does the choice above actually forbid certain behaviors, or merely discourage them?Explain.44. Short Answer:(a) What design pattern is used to construct instances of the InetAddress class, and why?(b) What design pattern is principally used in the Java input/output stream classes (e.g.,java.io.DataInputStream)?(c) In distributed method invocation, such as our project 3, is a thread typically associatedwith a stub, a skeleton, or both?55. Consider TwoPlaceQueue a blocking queue implementation that can store up to two elements.Write a multithreaded test case, using the metronome timer and testing framework discussedin class and used in project 2, that tests the scenario where an attempt to put a third iteminto the queue blocks because the queue is full. Your test case should only put a total ofthree items into the queue, remove all three items from the queue, and make sure the rightitems come out in the right order and that the queue is empty after all three items have beenremoved, and that the methods block when they should and don’t block when they shouldn’t.As a reminder of how the m etronome timer and testing framework works, here is the publictest from project 2 that checks that two locks provide mutual exclusion.static class TwoLocksProvideMutualExclusion extends MultithreadedTestCase {final Lock lock0, lock1;public TwoLocksProvideMutualExclusion(Lock lock0, Lock lock1) {this.lock0 = lock0;this.lock1 = lock1;}public void thread0() {lock0.lock();assertEquals(0, getTick());waitForTick(2);lock0.unlock();assertEquals(2, getTick());}public void thread1() {waitForTick(1);lock1.lock(); // should block hereassertEquals(2, getTick());waitForTick(3);lock1.unlock();assertEquals(3, getTick());}}For your case, you should only worry about testing the methods shown below (take and putare the blocking methods). Note: unlike the BlockingQueue interface, in this class the put()and take() methods don’t throw InterruptedException, and you don’t have to worry aboutinterrupts.public class TwoPlaceBlockingQueue<E> implements BlockingQueue<E> {public E take() { ... }public void put(E e) { ... }public boolean isEmpty() { ... }... other methods you shouldn’t be testing}6Your MultithreadedTestCase for the scenario described:76. Garbage collection: Assume you had to select just one garbage collection algorithm for aJava virtual machine: mark-and-sweep or a copying collector. What characteristic of yourapplication would be most relevant to choosing the garbage collector? How would you choose(e.g., if my application required Blarg, I’d choose a Snaff garbage


View Full Document

UMD CMSC 433 - Final Exam

Documents in this Course
Trace 1

Trace 1

62 pages

Reflection

Reflection

137 pages

Testing

Testing

25 pages

Paradigms

Paradigms

10 pages

Testing

Testing

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Trace 1

Trace 1

46 pages

Jini

Jini

4 pages

Final

Final

15 pages

Java RMI

Java RMI

13 pages

Testing

Testing

16 pages

Load more
Download Final Exam
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Final Exam and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Final Exam 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?