0% found this document useful (0 votes)
19 views4 pages

Advanced Java Programming Exam Paper

This document is an examination paper for the Advanced Java Programming course at Noida Institute of Engineering and Technology. It includes multiple choice and subjective questions across three sections, covering topics such as servlets, JSP, JDBC, and Spring Boot. The exam is designed to assess students' understanding of advanced Java concepts and their practical application.

Uploaded by

shuklaankit45470
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)
19 views4 pages

Advanced Java Programming Exam Paper

This document is an examination paper for the Advanced Java Programming course at Noida Institute of Engineering and Technology. It includes multiple choice and subjective questions across three sections, covering topics such as servlets, JSP, JDBC, and Spring Boot. The exam is designed to assess students' understanding of advanced Java concepts and their practical application.

Uploaded by

shuklaankit45470
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

.

Printed Page:- 04 Subject Code:- ACSE0601


Roll. No:

NOIDA INSTITUTE OF ENGINEERING AND TECHNOLOGY, GREATER NOIDA


(An Autonomous Institute Affiliated to AKTU, Lucknow)
[Link]
SEM: VI - THEORY EXAMINATION- (2023 - 2024)
Subject: Advanced Java Programming
Time: 3 Hours Max. Marks: 100
General Instructions:
IMP: Verify that you have received the question paper with the correct course, code, branch etc.
1. This Question paper comprises of three Sections -A, B, & C. It consists of Multiple Choice
Questions (MCQ’s) & Subjective type questions.
2. Maximum marks for each question are indicated on right -hand side of each question.
3. Illustrate your answers with neat sketches wherever necessary.
4. Assume suitable data if necessary.
5. Preferably, write the answers in sequential order.
6. No sheet should be left blank. Any written material after a blank sheet will not be
evaluated/checked.
.
SECTION-A 20
1. Attempt all parts:-
1-a.
2 4
Select the correct code to add an attribute in a HTTP Session object in 1

(a)
servlets.(CO1)
[Link](name,value) 2 0
(b)
(c)
[Link](name,value)
[Link](name,value) L Y
(d) None of the above.
J U
1-b.
.
__________purpose of the ServletResponse object in a servlet. (CO1)
P
1
(a)
(b)
(c)
O
To handle client requests

C
To obtain initialization parameters
To store session data
(d) To send data back to the client
1-c. Choose one Implicit Object which is used to get information about the servlet 1
configuration? (CO2)
(a) page
(b) config
(c) application
(d) out
1-d. Total implicit Objects are available in JSP page (CO2) 1
(a) 6
.
Page 1 of 4
.

(b) 9
(c) 7
(d) 8
1-e. The correct syntax for annotation wiring is______________.(CO3) 1
(a) Inject
(b) Bean
(c) Autowired
(d) Resources
1-f. Discuss the steps to handle shut down of IoC container? (CO3) 1
(a) Using shutdownHook()
(b) Using shutdownHandler()
(c) Using registerHook()
(d) Using registerShutdownHook()
1-g. MVC is an abbreviation that stands for____ (CO4) 1
(a) Monthly Variable Component
(b) Model View Controller
(c) Myocardial Vascular Capacity
(d) All of the above
1-h.
(a) 9090
2 4
The port is used by Spring Boot by default, to start the Tomcat (CO4) 1

(b)
(c)
8080
0 2 0
1-i.
(d) 4200
L Y
Several instances of one entity are connected with many instances of another 1

J U
entity in a ____ relationship.(CO5)
(a)
(b)
@ManyToOne Relation
P
@OneToMany Relation
.
(c)
(d) C O
@OneToOne Relation
@ManyToMany Relation
1-j. The JPA Entities will become detached when _____________(CO5) 1
(a) When the transaction (in transaction-scoped persistence context) commits, entities
managed by the persistence context become detached.
(b) If an application-managed persistence context is closed, all managed entities
become detached.
(c) Using a clear method
(d) All of these
2. Attempt all parts:-
2.a. Explain the working of DriverManager in JDBC.(CO1) 2
.
Page 2 of 4
.

2.b. Demonstrate the concepts of session Implicit Object in JSP.(CO2) 2


2.c. Define Bean Wiring.(CO3) 2
2.d. Explain role of dependency Injection.(CO4) 2
2.e. Describe the role of Entity Manager in JPA.(CO5) 2
SECTION-B 30
3. Answer any five of the following:-
3-a. List advantages and disadvantages of Servlets.(CO1) 6
3-b. Describe all the life-cycle methods for a servlet.(CO1) 6
3-c. Builda JSP program to retrieve data from HTML into JSP page and display on 6
browser.(CO2)
3-d. Demonstrate the purpose and syntax of JSP expression tags, and provide an 6
example of how they can be used.(CO2)
3.e. Differentiate between constructor injection and setter injection.(CO3) 6
3.f. Discuss about component scans, Configuration in spring boot with example.(CO4) 6
3.g. List out some features of JPQL.(CO5) 6
SECTION-C 50
4. Answer any one of the following:-
4-a. Distinguish between the following Servlet, Generic Servlet and HTTP 10

4-b.
Servlet.(CO1)

2 4
Describe the Transaction Management in JDBC and why do we need it?(CO1) 10
5. Answer any one of the following:-
2 0
5-a.

L Y
Develop a JSP application that uses the JSP custom tag library to implement a
simple login functionality. Your application should use the JSP custom tags to
validate user input and redirect the user to a welcome page if the login is
10

. JU
successful. Write a brief report on the steps you followed to create the application,
including details on the JSP custom tag library and the JSP tag life cycle.(CO2)
5-b.
O P
Build a JSP program to show and display at least 3 active control.(CO2)
6. Answer any one of the following:-
10

6-a. C
Discuss the role of JDBCTemplate also demonstrate update and delete operation
on Student(sid, sname, saddress) Table using JDBCTemplate.(CO3)
10

6-b. Implement a program to inject a Java Collection in Spring.(CO3) 10


7. Answer any one of the following:-
7-a. Define Spring Boot Auto Configuration Classes and its [Link] code for 10
configuration transaction manager.(CO4)
7-b. Explain about Spring Boot CRUD Operations and show with example the create 10
operation.(CO4)
8. Answer any one of the following:-
8-a. Discuss the various query methods in JPA to retrieve data from the database. List 10
.
Page 3 of 4
.

some of the most used methods.(CO5)


8-b. Difference between JPA Repository and CRUD Repository. Explain with the help 10
of an example.(CO5)

2 4
2 0
L Y
. JU
O P
C

.
Page 4 of 4

Common questions

Powered by AI

A servlet undergoes the following life-cycle methods: init(), service(), and destroy(). The init() method is called once when the servlet is first loaded, and it initializes resources needed for the servlet. The service() method is called for each request the servlet handles, processing client requests and generating responses. Finally, the destroy() method is invoked when the server decides to remove a servlet from service, allowing the servlet to release resources before being destroyed.

Spring Boot Auto Configuration Classes automatically configure beans based on the jars present in the classpath and the beans that have already been defined. This reduces the need for explicit configuration, speeding up development. For example, when including spring-boot-starter-web, Spring Boot will auto-configure Tomcat as the default embedded server if no other server is defined explicitly. These classes are guided by conditions specified by annotations like @ConditionalOnClass, enabling dynamic and appropriate configurations.

Built-in IoC container shutdown procedures contribute to application stability by properly releasing resources and gracefully terminating components. Using methods like registerShutdownHook(), the application ensures that beans release any resources, like database connections or external connections, and perform any cleanup tasks. This prevents resource leakage, locks, and other potential issues that could affect application performance or lead to errors upon re-deployment.

The @Autowired annotation in Spring is used for automatic dependency injection. It allows Spring to automatically resolve and inject the dependent beans. When placed on a constructor, method, or field, Spring attempts to resolve and inject the collaborating beans automatically. Its primary advantage is the reduction of explicit bean-wiring code, promoting simpler and cleaner application development. It operates with the help of Spring's reflection and knowledge of bean metadata.

The Entity Manager in JPA is responsible for managing the lifecycle of entity instances, providing APIs for CRUD operations, and handling transactional operations. It tracks the state changes of entities and synchronizes them with the database, allowing entities to be retrieved, removed, merged, or persisted. The Entity Manager works within a persistence context, where it ensures that database operations adhere to the object-relational mapping defined by JPA.

Constructor injection involves the passing of dependency through a constructor when the object is instantiated, which ensures that the object is in a fully initialized state right after its creation. It is best used when a dependency is mandatory for an object's correct functioning. In contrast, setter injection uses setter methods to inject dependencies after the object is created, allowing for optional dependencies and later initialization. Constructor injection also makes it clear that certain dependencies are required. Setter injection can lead to partially initialized objects if dependencies are not set.

Spring Boot simplifies CRUD operations through Spring Data JPA, which provides repository interfaces out-of-the-box. To create data entities, developers define an interface extending JpaRepository, specifying the entity type and primary key. Spring Boot automatically provides methods for CRUD operations like save(), findAll(), and deleteById(). This abstraction minimizes boilerplate code and allows developers to focus on business logic rather than infrastructure code, enhancing developer productivity and reducing errors.

DriverManager in JDBC serves as a factory for creating database connections. It manages the list of available database drivers and matches them with the JDBC URL to establish a connection. When a connection request is made, the DriverManager goes through the list of registered drivers to find the suitable driver that can handle the connection request for a specific URL, and then it facilitates opening a connection using that driver.

The JPA Repository is a full-featured repository interface in Spring Data JPA that extends the basic CRUD Repository, adding functionality related to pagination, sorting, and query creation. It allows more than just basic CRUD operations by providing rich APIs for handling queries and transactions. CRUD Repository focuses on basic CRUD operations without advanced features like pagination or sorting. JPA Repository is suitable for applications needing complex data retrieval functionalities beyond the basic CRUD operations.

Servlets provide several advantages in web development: they are robust and can handle complex requests, support concurrent processing, and integrate well with Java's extensive library ecosystem. They are portable across different platforms due to Java's platform independence. However, their disadvantages include complex setup and handling for simple applications, lack of native support for HTML rendering, and complexity in managing session data compared to newer frameworks like Spring MVC.

You might also like