0% found this document useful (0 votes)
99 views2 pages

Advanced Java Programming Exam Solutions

This document is an exam for an Advanced Java Programming course. It contains 5 questions assessing knowledge of Java programming concepts like JDBC, JSP, Servlets, Hibernate and Spring. Question 1 has subparts on InetAddress, PreparedStatement, and JSP directives. Question 2 differentiates HTTP methods and covers JSP implicit objects. It also has an option to write a client-server program using sockets. Questions 3 and 4 cover Servlet and JSF concepts, with options related to database connectivity, filters, and facelets. Question 5 addresses dependency injection, HQL vs SQL, Hibernate architecture, and Spring MVC features.

Uploaded by

Akshit Varmora
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)
99 views2 pages

Advanced Java Programming Exam Solutions

This document is an exam for an Advanced Java Programming course. It contains 5 questions assessing knowledge of Java programming concepts like JDBC, JSP, Servlets, Hibernate and Spring. Question 1 has subparts on InetAddress, PreparedStatement, and JSP directives. Question 2 differentiates HTTP methods and covers JSP implicit objects. It also has an option to write a client-server program using sockets. Questions 3 and 4 cover Servlet and JSF concepts, with options related to database connectivity, filters, and facelets. Question 5 addresses dependency injection, HQL vs SQL, Hibernate architecture, and Spring MVC features.

Uploaded by

Akshit Varmora
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

Seat No.: ________ Enrolment No.

___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– VI (NEW) EXAMINATION – WINTER 2021
Subject Code:3160707 Date:04/12/2021
Subject Name:Advanced Java Programming
Time:10:30 AM TO 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
MARKS
Q.1 (a) Explain the usage of InetAddress class. 03
(b) Explain the use of PreparedStatement and CallableStatement with example. 04

(c) Explain JSP page directives with example. 07

Q.2 (a) Differentiate HTTP Get and Post methods. 03


(b) Explain any four implicit objects of JSP. 04
(c) Write a program in which client sends string from its standard input to the 07
server. The server reads the string, converts the string into upper case and
sends back to client. Use connection-oriented communication.
OR
(c) Write a JDBC program for banking application in which consider bank table with 07
attributes AccountNo, CustomerName, Phone and Address, and perform
followings:
1. Insert two records using prepared statement.
2. Display all the records.

Q.3 (a) Discuss the use of execute(), executeUpdate() and executeQuery() methods. 03
(b) Differentiate ServletConfig and ServletContext objects. 04
(c) Write a servlet code which reads the student details from web page and stores 07
it in database.
OR
Q.3 (a) What is Filter? List the applications of filter. 03
(b) Discuss Servlet life cycle methods. Explain role of web container. 04
(c) What is Request Dispatcher? What is the difference between 07
RequestDispatcher’s forward() and include() method? Explain it in detail
with program.

Q.4 (a) What is difference between include directive and jsp:include action tag? 03
(b) Explain any four JSTL core tags. 04
(c) Explain the JSF request processing life cycle. 07
OR
Q.4 (a) What is the JSF facelets? Explain any two facelets tags. 03
(b) List the JSF standard converter tags and explain any three in detail. 04
(c) Write a JSP application for login module with reset password feature using 07
database connectivity.

Q.5 (a) What is dependency injection? Explain in detail. 03


(b) What is HQL? Write difference between HQL and SQL. 04
(c) Explain Hibernate Architecture. 07

1/2
OR

Q.5 (a) Explain the features of Spring web MVC. 03


(b) What is ORM? Explain object/relational mappings in hibernate. 04
(c) Explain architecture of Spring MVC Framework. 07

*************

2/2

Common questions

Powered by AI

PreparedStatement is used for executing precompiled SQL queries, allowing parameterized queries to avoid SQL injection attacks. CallableStatement is used to call stored procedures in a database, supporting OUT parameters. For instance, PreparedStatement can execute 'SELECT * FROM users WHERE id=?', whereas CallableStatement can execute a stored procedure 'CALL getUser(?)' .

Spring MVC architecture is based on the Model-View-Controller pattern. It handles web requests through a DispatcherServlet, which coordinates with controllers to process requests, delegates views to render results, and utilizes models for data manipulation. This framework offers flexibility and modularity by decoupling components, simplifying the development and testing of web applications .

The InetAddress class in Java represents an IP address. It facilitates the handling of IP addresses by providing methods like 'getByName()' to obtain an InetAddress object corresponding to a host name, and 'getLocalHost()' to retrieve the loopback address of the local machine .

The Servlet life cycle consists of initialization (init()), request handling (service()), and removal (destroy()). The web container manages these methods by loading the servlet class, invoking init() for initialization, calling service() to handle requests, and invoking destroy() before unloading. It ensures servlets operate efficiently by managing threading and resource cleanup .

Filters are used in Servlets for preprocessing requests and postprocessing responses, often applied for tasks such as logging, authentication, input validation, or data compression. They intercept requests before they reach the servlet and responses before they leave the servlet, enhancing functionality without modifying code directly .

Dependency injection is a design pattern in which an object's dependencies are provided externally, promoting loose coupling and easier testing. In Java, frameworks like Spring automatically inject instances into classes using annotations like '@Autowired', reducing boilerplate code and increasing flexibility .

JSP implicit objects are predefined variables provided by the JSP container to handle different functionalities. Significant ones include 'request' for HTTP request data, 'response' for HTTP response, 'session' for user session tracking, and 'application' for servlets context interaction. They simplify coding by providing direct access to key objects without additional setup .

The 'include' directive includes a specified page at compile time, meaning the content is inserted into the servlet during translation, while 'jsp:include' action tag includes content at request processing time or runtime, allowing dynamic updates. An example of 'include' is '<%@ include file="header.jsp" %>', while 'jsp:include' is '<jsp:include page="footer.jsp" />' .

HQL (Hibernate Query Language) is an object-oriented query language using class-based queries and supports seamless integration with Hibernate ORM, whereas SQL is a relational database query language focusing on tables and fields. HQL is advantageous in Hibernate for database portability, while SQL is commonly used for direct database manipulation .

HTTP GET requests data from a specified resource and appends parameters to the URL, visible and limited in size, making it less secure. POST sends data in the request body, supporting larger amounts and not visible in the URL, making it more suitable for secure data transmission .

You might also like