In your Git workspace, make a directory final
in which you place the answers. Unzip this file into that directory, so that you have directories final/problem1
etc.
Make a push after you answer each question.
You need not compile your code, but you can if you like.
You can consult the internet, files on your laptop, books, and notes. But of course you may not make contact with anyone during the exam. No email, chat, etc.
Question 1. The server in problem1
has a database of events. Implement a REST method events
with a parameter for the event type, so that for example http://localhost:8080/problem1/rest/schedule/events/forums
returns an XML file of all events of that type, listing each event's description and start time. Complete the EventService.event
method and add any necessary annotations to Event
and Schedule
.
Question 2. The program in problem2
reads in the XML from the first program (actually, I just give it a hardcoded file so you can do this problem even if you didn't do the first). In MainActivity
, make it display the event titles in a list after the data has been read. When an entry is tapped, show a toast with the event's startTime.
Question 3. In the preceding program, show the event's start date in the user's locale. (If you didn't do the program, you can still do this assignment, but you need to be explicit about where all the inputs come from.)
Question 4. Show the events in an HTML 5 list, with the titles in a large font and the date/time in a smaller font below. Use the provided JSON feed for the data.
Here is one way of formatting the entries: Put the description into a span, add a <br/>
, and then add another <span style="font-size: 0.6em;">
.
Nothing needs to happen when you click on a row.
Question 5. The program in problem5
shows events in an iOS table. Write an OCUnit test case to check whether they are in sorted order (by start date). Complete the files NavTest.h
and NavTest.m
.
Just compare the startDate
fields lexicographically, using -compare
, as described here in this way:
// using NSComparisonResult NSComparisonResult comparisonResult = [s1 compare:s2]; if (comparisonResult == NSOrderedAscending) { NSLog(@"s1 comes before s2"); } else if (comparisonResult == NSOrderedAscending) { NSLog(@"s1 comes after s2"); }
Read the values from the PList in the setUp
method, just like the app does.
Then loop over its elements. If the startTime fields of all elements are ascending, pass the test. Otherwise, fail it.
Question 6. In the presentation on detecting memory leaks, the presenter said that it's not a good idea to use a hash table mapping an image URL to the bytes of the image. a) What is the problem with such a cache, particularly on a mobile device? b) The Cinequest client seemingly does just that—check out the code for edu.sjsu.cinequest.comm.ImageManager.getImage
. What does it do differently to avoid the potential memory leak, or to at least minimize its impact?