程序代写代做代考 JDBC ER concurrency Java case study Graduate Diploma in Systems Analysis Page 1 of 6

Graduate Diploma in Systems Analysis Page 1 of 6
SAMPLE PAPER
Institute of Systems Science National University of Singapore
GRADUATE DIPLOMA IN SYSTEMS ANALYSIS
SA Term 2 Examination
Sample Paper 4 (Module Code – 4105): Web Application Development
Instructions for Paper
Date: Time: Duration: Place:
N.A
9.00am
3 hours (9.30 a.m. to 12.30 p.m.) excluding reading time NUS MPSH4
Matriculation Number :
(fill in your matriculation number here)
This is an open book examination.
You are given 30 minutes to read the questions before the examination starts. You are NOT allowed to use any writing instrument during the reading time.
1. Read all instructions before answering any of the examination questions.
2. Write your matriculation number on the top of this front page in the box provided.
SA Term 2 Examination Sample (Web Application Development)

Graduate Diploma in Systems Analysis Page 2 of 6
3. Complete the front cover of each answer book you use. The blank lines on the front cover to be filled in as follows:
Matriculation / Registration No: Module Code/Title: Development
Semester:
5. This examination paper consists of two (2) questions. You are to answer ALL questions. There is one (1) appendix to this paper.
6. The total marks for this examination paper is seventy five (75) marks. Twenty five (25) marks will be taken from the continuous assessment.
7. Use a separate answer book for each section.
8. Start the answer to each question on a new page.
9. After completing the paper, tie your answer books together according to sections. List the questions that you have answered for each section on the front page of the first answer book for that section.
10. The question paper is to be submitted together with the answer books. You are not allowed to take the question paper with you.
11. Scrap paper may be used as required, but only answers written in the answer book will be considered for credits.
12. Use a pen for writing your answers. Pencil may be used only for drawing diagrams.
13. Calculators may be used if required.
14. State clearly any assumptions you make in answering any question where you feel the requirement is not sufficiently clear.
Number of books handed in:
4. Write your matriculation number on ALL answer books you use.
= (Your matriculation number)
= Sample Paper (Module Code – 4105): Web Application
= SA Term 2
= (Indicate the number of booklet you have used for
each section.)
SA Term 2 Examination Sample (Web Application Development)

Graduate Diploma in Systems Analysis Page 3 of 6
Refer to the class diagram, screenshots, code listings and API documentation (Figures 1 to 14) in Appendix A – OABS Case Study.
JAVA STANDARD EDITION
Question 1 [35 marks]
Answer the following question using Java SE solutions.
a) Wai yan, implemented a static method. He writes a main method to test. Read the code in figure 3. What will be the output, assuming there is no compilation errors? Briefly explain your answer.
b)
c)
(3 Marks)
Your colleague Ruby is crafting group of classes. Codes are shown in figure 4. She could not compile one of them; she is seeking your guidance.
i. What will you change in figure 4 – in order to compile the classes?
ii. What will be the output, assuming you have fixed the compilation errors correctly?
Briefly explain your answer.
(4 Marks)
Your team member Samuel has a reuse situation. He needs to convert ArrayList into Array and LinkedList into Array, also vise versa. Help him by writing two methods
(1) public T[] convertCollectionToArray(List list)
(2) public List convertArrayToCollection(T[] array)
(4 Marks)
d) Narendra is introducing ‘mileage’ data for each passenger. The mileage is a user defined class and a member variable in Passenger class. The mileage data has the following characteristics:
– The data grows and shrinks dynamically
– Is Ordered and provides indexed access
Suggest a suitable collection type class for mileage. Will your answer change if the requirement is for an unordered collection? Explain your answers.
(5 Marks)
SA Term 2 Examination Sample (Web Application Development)

Graduate Diploma in Systems Analysis Page 4 of 6
e) Erin created a class called ListUtility is shown in Figure 5. The purpose of the class is to provide methods that sorts and searches passengers from a given list. It has the following methods:
o arrangePassengerById()This method sorts a list provided as argument and returns the sorted list.
o findFirstPassenger() This method returns the first passenger details from a list provided as argument.
o findLastPassenger() This method returns the last passenger from a list provided as argument.
o main() This method is used to test the above methods.
 Inspect the main() method for the usage of the three methods namely
arrangePassengerById(),findFirstPassenger()&findLastPassenger()
and provide the code for them.
 Class Passenger implements the Comparable Interface. Identify and add the
missing code to this class
(5 Marks)
f) Michael created a stack utility with generic template called MichaelStack.java. The code is shown in Figure 6. Vicky attempts to test Michael’s class using TestStack.java (String[] strlist = {‘…’, ‘…’, ‘…’} and Integer[] intlist = {…}). Vicky wants to push all data in sequence and pop them out to print and test the “Last In First Out” nature of the stack. Help Vicky by completing the main method in TestStack.
(4 Marks)
g) Sun Zheng is coding the data layer in OABS application. Assist her by answering the following question (using JDBC and Data Access Object Pattern as appropriate). PaymentDAO(in figure 7) and OABS ER diagram (figure 2). Carefully look at the PAYMENT TABLE details (figure 2). Complete the findSalesAmountByDate(…) method. Clearly state any assumptions made.
(10 Marks)
SA Term 2 Examination Sample (Web Application Development)

Graduate Diploma in Systems Analysis Page 5 of 6
JAVA ENTERPRISE EDITION – WEB APPLICATION Question 2 [40 marks]
Answer the following question using Java EE Web Components as appropriate. Clearly state any assumptions you make and take care of exceptions as necessary.
a. Study the code snippets created by Rajna – namely SillyJellyBean.java and MyJBTrial.jsp
(Figures 8 & 9). Assume the context root is “demo”. When executing the JSP file through browser as below, what is the expected output on the browser screen? Explain your answer briefly.
http://localhost:8080/demo/MyJBTrial.jsp?a=X&b=Y&c=Z
(3 Marks)
b. Study the code snippet for TestEL.jsp (Figure 10). What is the expected output on the browser screen? Hint: Just write the results. No explanation needed.
c.
d.
(5 Marks)
The view flights page (coded as FlightView.jsp) is a search page based on flight number, city
code and departure date (figure 11). The ‘Search Flights’ button the calls /flightcontroller URI mapped Servlet and set object flist of type ArrayList (Figure 12). It lists all flights that satisfy the search criteria (full page shown in Figure 13). Write key codes for FlightView.jsp .
(15 Marks)
Complete the end potion of SearchServlet (Figure 14) to accommodate the following:
 Check if the list is empty, in such situation the error page (“Error.jsp”) is
displayed.
 If the list size is more than 100 records, display tags will be used. Hence a pagination variable is to be set in the session scope before forwarding control to the “Search.jsp” page.
(5 Marks)
Your team member (newbie) created a lousy java server page(jsp) with instance variables and a great deal of scriptlet code. Unfortunately, after extensive load testing, there are several race conditions in the JSP. Given the tight schedule, list one way to resolve the concurrency problem, without rewriting the code?
(3 Marks)
e.
SA Term 2 Examination Sample (Web Application Development)

Graduate Diploma in Systems Analysis Page 6 of 6
f. In OABS application, which of the models suggested below is best suitable for the following aspects?
i. Web Framework Architecture Model Choices: 1. Request
2. Component
Mention you choice and explain briefly
ii. Web Framework Communication Model Choices: 1. Pull
2. Push
Mention you choice and explain briefly
iii. List any two useful design patterns that are applicable to the OABS web layers. Explain how your suggested design patterns improve the design or performance.
(9 Marks)
~~~~~~~~ End of Sample Paper 4 ~~~~~~~~
SA Term 2 Examination Sample (Web Application Development)