UNIVERSITY EXAMINATIONS: 2023/2024
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
SOFTWARE DEVELOPMENT
BSD 2304 ADVANCED JAVA PROGRAMMING
FULLTIME/ PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATION
DATE: AUGUST, 2024 TIME: 2 HOURS
INSTRUCTIONS: Question One is Compulsory, Choose Two Other Questions
QUESTION ONE (20 MARKS) Compulsory
a) Write a program to translate a circle from one side to another [6 marks]
b) Explain the five major differences between a static website and a dynamic website
[5 marks]
c) Explain the following methods used in creating servlets [4 marks]
i) public String getInitParameter(String name)
ii) public Enumeration getInitParameterNames()
iii) public String getServletName()
iv) public ServletContext getServletContext()
d) Write a program to demonstrate how you can set the attribute in the application scope
and get its value from another servlet. [5 marks]
QUESTION TWO (15 MARKS
a) Write a servlet that will store the name of the user in the cookie object and access it in
another servlet. Session will correspond to the particular user. So, if you access it from
too many browsers with different values, you will get the different value.
[8 marks]
1
b) In JSP, pageContext is an implicit object of type PageContext class. The pageContext
object can be used to set, get or remove attribute from page scope. Write a JSP program
to demonstrate how the pageContext implicit object can be used. [7 marks]
QUESTION THREE (15 MARKS)
a) Describe how animations are facilitated in JavaFX? [6 marks]
b) Describe how Client-Side and Server-Side Validation is facilitated [5 marks]
c) Explain the advantages and disadvantages of using JavaBean [4 marks]
QUESTION FOUR (15 MARKS)
a) Based on the figure below, write a program that will enable you to type a letter in the text
field, making the 3D box to start rotating along the x axis. If you click on the box again
the rotation stops. [7 marks]
b) What are the steps involved in reading data from a form using JSP? [4 marks]
c) Explain the difference between forward and sendRedirect? [4 marks]