Q1) Attempt any EIGHT (Detailed Answers)
a) What is use of CallableStatement? ANS CallableStatement is an interface in JDBC used to
execute stored procedures in a database. It supports input, output, and INOUT parameters. It
improves performance because stored procedures are precompiled in the database. It is created
using prepareCall() method of Connection interface. b) What is Thread? ANS A thread is a
lightweight sub-process that allows a program to perform multiple tasks simultaneously.
Threads share the same memory space but execute independently. In Java, a thread can be
created by extending the Thread class or implementing the Runnable interface. c) How Servlet
differs from CGI? ANS CGI (Common Gateway Interface) creates a new process for each client
request, which consumes more memory and time. Servlets run inside a web server and handle
multiple requests using threads. Servlets are faster, efficient, platform-independent, and
persistent compared to CGI. d) Define Set. ANS Set is an interface in Java Collection Framework
that stores unique elements and does not allow duplicates. It may not maintain insertion order
(except LinkedHashSet) and can store null values (except TreeSet).e) List any two parameters
using Scriptlet. ANS In JSP scriptlet, implicit objects are available such as: [Link] – to get
client request data [Link] – to send response [Link] – to store session data [Link] – to
print output f) Define Spring. ANS Spring is a powerful and lightweight Java framework used to
develop enterprise applications. It provides features like Dependency Injection (DI), Inversion of
Control (IoC), transaction management, security, and MVC architecture support. g) Which
interface is implemented by TreeSet class? ANS TreeSet implements the NavigableSet interface
and extends SortedSet. It stores elements in sorted order and does not allow duplicate values. h)
List any two methods of Statement interface. ANS [Link]() – Executes SELECT queries.
[Link]() – Executes INSERT, UPDATE, DELETE queries. [Link]() – Executes any
SQL statement. i) Write the purpose of yield(). ANS The yield() method temporarily pauses the
currently executing thread and allows other threads of equal priority to execute. It helps in thread
scheduling. j) What is Cookie? ANS A cookie is a small text file stored on the client browser to
maintain user information such as login details, preferences, and session tracking between
multiple HTTP requests. Q2) Attempt any FOUR (Detailed Answers) a) What is Map Interface and
how to implement it? ANS Map is an interface in Java that stores elements in key-value pairs. It
does not allow duplicate keys but allows duplicate values. [Link] implementation classes:
[Link] – Unordered [Link] – Maintains insertion order [Link] – Sorted
order Example: Map<Integer, String> map = new HashMap<>(); [Link](1, "Java"); [Link](2,
"Spring"); b) What is DatabaseMetaData? ANS DatabaseMetaData is an interface in JDBC that
provides information about the database such as database name, version, supported SQL
features, tables, columns, and driver information. Example:DatabaseMetaData dbmd =
[Link](); [Link]([Link]()); c) Name the
directives in JSP ANS There are three JSP directives: [Link] Directive – <%@ page %> [Link]
Directive – <%@ include %> [Link] Directive – <%@ taglib %> These directives provide global
information to JSP container. d) State the types of Servlet ANS [Link] – Protocol-
independent servlet [Link] – HTTP-specific servlet [Link] is commonly used for
web applications. e) What are the Thread Priorities? ANS Thread priority determines the
execution preference of a thread. Java provides: MIN_PRIORITY = 1 NORM_PRIORITY = 5
(default) MAX_PRIORITY = 10 Higher priority threads are executed before lower priority ones. Q3)
Attempt any ONE (Detailed 4 Marks) a) Explain Life Cycle of Thread ANS Thread life cycle
consists of the following states: [Link] State – Thread object is [Link] State – After
calling start(), thread is ready to [Link] State – Thread scheduler selects the thread for
[Link]/Waiting State – Thread waits for resource or [Link] State –
Thread completes execution or stops. Important methods: [Link]() [Link]() [Link]() [Link]()
[Link]() b) What is Session Tracking? How to implement it? ANS Session tracking is used to
maintain user information across multiple HTTP requests because HTTP protocol is stateless.
Methods of session tracking: [Link] [Link] Rewriting [Link] Form Fields 4. HttpSession
Example using HttpSession: HttpSession session = [Link]();
[Link]("username", "Admin"); Session tracking is mainly used for login systems,
shopping carts, and user authentication.