0% found this document useful (0 votes)
76 views6 pages

Sample Paper 4

This document contains instructions for a sample examination paper for the Graduate Diploma in Systems Analysis program at the National University of Singapore. The paper covers two sections: Section 1 focuses on Java Standard Edition solutions and Section 2 focuses on Java Enterprise Edition web application solutions. The paper contains two questions with subparts testing knowledge of collections, data access objects, servlets, JSP, and more. Students are instructed to write their answers in separate booklets for each section and question.

Uploaded by

Snapi Lifestyle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views6 pages

Sample Paper 4

This document contains instructions for a sample examination paper for the Graduate Diploma in Systems Analysis program at the National University of Singapore. The paper covers two sections: Section 1 focuses on Java Standard Edition solutions and Section 2 focuses on Java Enterprise Edition web application solutions. The paper contains two questions with subparts testing knowledge of collections, data access objects, servlets, JSP, and more. Students are instructed to write their answers in separate booklets for each section and question.

Uploaded by

Snapi Lifestyle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

Matriculation Number :
(fill in your matriculation number here)

Instructions for Paper


Date: N.A
Time: 9.00am
Duration: 3 hours (9.30 a.m. to 12.30 p.m.) excluding reading time
Place: NUS MPSH4

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: = (Your matriculation number)


Module Code/Title: = Sample Paper (Module Code – 4105): Web Application
Development
Semester: = SA Term 2
Number of books handed in: = (Indicate the number of booklet you have used for
each section.)

4. Write your matriculation number on ALL answer books you use.

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.

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.
(3 Marks)

b) 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)

c) 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> T[] convertCollectionToArray(List<T> list)
(2) public <T> List<T> 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<T>.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.
(5 Marks)

c. 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<FlightDTO> (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)

d. 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)

e. 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)

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)

You might also like