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

Advanced Java Dseb4 Answers

The document contains answer keys for Advanced Java exams from 2021 to 2023, covering topics such as Servlets, JSP, JavaScript, jQuery, Spring, and JDBC. It provides concise definitions, code examples, and comparisons of various concepts in Java programming. Each question is structured to address specific aspects of the topics, with a total of 80 marks distributed across multiple questions.

Uploaded by

debumyself69
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)
2 views6 pages

Advanced Java Dseb4 Answers

The document contains answer keys for Advanced Java exams from 2021 to 2023, covering topics such as Servlets, JSP, JavaScript, jQuery, Spring, and JDBC. It provides concise definitions, code examples, and comparisons of various concepts in Java programming. Each question is structured to address specific aspects of the topics, with a total of 80 marks distributed across multiple questions.

Uploaded by

debumyself69
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

2021 – Advanced Java (DSE-B-4) – ANSWER KEY

Q1. Answer any five (2×5 = 10 marks)

(a) Servlets vs Applets: - Servlets run on server; Applets run on client browser.

(b) Include in JSP: - Yes. Use <jsp:include page="..." /> or RequestDispatcher.include().

(c) Custom Tags in JSP: - Use tag handler class and TLD file.

<tag>
<name>hello</name>
<tag-class>mypack.HelloTag</tag-class>
</tag>

(d) JavaScript Data Types: - String, Number, Boolean, Object, Undefined, Null, Symbol, BigInt.

(e) NaN Property: - Means "Not a Number". Occurs in invalid arithmetic like 0/0.

(f) css() in jQuery:

$("#id").css("color", "red");

(g) Spring IOC: - Manages beans and dependencies.

(h) JVM: - Executes bytecode, manages memory, security.

Q2. (4+2+2+2 = 10 marks)

(a) Servlet Lifecycle: - init(), service(), destroy()

(b) getCharacterEncoding/setCharacterEncoding: - Used for request encoding handling.

(c) HttpServlet vs GenericServlet: - HttpServlet: protocol-specific. - GenericServlet: protocol-independent.

Q3. (4+2+4 = 10 marks)

(a) JSP Lifecycle: - Translation, Compilation, Initialization, Execution, Destroy

(b) JSP Advantages: - Easy coding, faster development.

1
(c) Scripting Elements: - Declaration <%! %> , Scriptlet <% %> , Expression <%= %>

Q4. (2+6+2 = 10 marks)

(a) JavaScript Definition: - Client-side scripting language.

(b) Event Handling: - onclick, onmouseover, onload via JS functions.

(c) Validation: - Use JS conditions and event listeners.

Q5. (2+3+3+2 = 10 marks)

(a) jQuery Definition: - JavaScript library simplifying HTML DOM and AJAX.

(b) Form Validation:

$("#form").submit(function(){
if($("#name").val()==="") alert("Name required");
});

(c) App Server Services: - AJAX, DOM manipulation, UI effects.

(d) jQuery.length:

alert($("p").length);

Q6. (2+2+4+2 = 10 marks)

(a) Session: - Stores user data across pages.

(b) Create Session:

HttpSession s = request.getSession();

(c) Info Passing: - Cookies, URL rewriting, hidden fields.

(d) Destroy Session:

2
session.invalidate();

Q7. (2+4+4 = 10 marks)

(a) Spring Advantages: - IOC, AOP, modularity.

(b) Spring MVC: - DispatcherServlet, Controllers, ViewResolver.

(c) JDBC in Spring: - JdbcTemplate simplifies DB operations.

Q8. (Any Two – 5×2 = 10 marks)

(a) Servlet Collaboration: - Forward or include another servlet.

(b) JSP Exception Handling: - <%@ page errorPage="..." %> and exception object.

(c) Spring AOP: - Aspect-based programming.

(d) Spring ORM: - Integrates Hibernate with Spring.

2022 – Advanced Java (DSE-B-4) – ANSWER KEY

Q1. Answer any five (2×5 = 10 marks)

(a) JS Disadvantages: - Browser-dependent, insecure, disabled by user.

(b) empty vs remove vs detach: - empty(): removes content. - remove(): removes element. - detach():
removes but preserves data/events.

(c) errorPage: - Handles errors using another page.

(d) setAttribute():

session.setAttribute("name", "Deb");

(e) Factory Pattern Advantages: - Loose coupling, central control of object creation.

(f) jQuery length: - Counts selected elements.

(g) Disable Session in JSP:

3
<%@ page session="false" %>

(h) JS Array Syntax:

var arr = [1,2,3];

Q2. (4+4+2 = 10 marks)

(a) Cookies:

Cookie ck = new Cookie("user", "Deb");


response.addCookie(ck);
ck.setMaxAge(0); // delete

(b) GET vs POST: - GET: appended to URL. - POST: hidden in body.

(c) forward vs sendRedirect: - forward: internal, fast. - redirect: client-side, slower.

Q3. (2+4+4 = 10 marks)

(a) JSP > Servlet: - Less code, easier HTML integration.

(b) JSP Lifecycle: - Translation, compilation, init, service, destroy.

(c) JSP Declaration Example:

<%! int add(int x, int y){ return x + y; } %>

Q4. (5+5 = 10 marks)

(a) jQuery Selectors: - ID: $("#id") - Class: $(".class") - Tag: $("div")

(b) blur() and hover():

4
$("#input").blur(()=> alert("Blur"));
$("#div").hover(()=> alert("Hovered"));

Q5. (5+3+2 = 10 marks)

(a) Array Program:

let arr=[];
arr.push(3); arr.push(1);
console.log(arr.reverse());
console.log(arr.sort());

(b) Spring Features: - Lightweight, modular, IOC

(c) Spring Beans: - Objects managed by container.

Q6. (3+5+2 = 10 marks)

(a) Types: - Creational, Structural, Behavioral

(b) DAO: - Data Access Object for DB separation.

(c) MVC Advantages: - Modular, testable.

Q7. (6+4 = 10 marks)

(a) JS Events: - onclick, onsubmit, onmouseout

(b) JDBC Template: - Less code, exception translation.

Q8. (Any Two – 5×2 = 10 marks)

(a) Front Controller: - Centralized entry point.

(b) Session Tracking: - Cookies, URL rewriting, hidden fields.

(c) jsp:include vs jsp:forward: - include: includes content - forward: redirects control

(d) jQuery Validation:

5
$("#form").validate({
rules: { name: "required" },
messages: { name: "Enter name" }
});

2023 – Advanced Java (DSE-B-4) – ANSWER KEY


[Existing 2023 content retained here]

You might also like