MCA Home
IGNOU Solved AssignmentMCS-220 • Hand-Solved

Authentic Student Handwriting Mode (Blue Gel Ink + Notebook Margin)

Cover Page & Submission Header Details (Auto-fills on sheets) Verified for LMS Upload
Student Name:
Enrollment Number:
Study Centre Code:
Program:
Course Code:
Session:
IGNOU Logo
इग्नू
जन-जन का विश्वविद्यालय

INDIRA GANDHI NATIONAL OPEN UNIVERSITY

Regional Centre Delhi-1

Format for Assignment Submission
For Term End Exam June / December- 2026-2027
ignou
THE PEOPLE'S
UNIVERSITY

(Please read the instructions given below carefully before submitting assignments)

1. Name of the Student:Manoj Kumar
2. Enrollment Number:2601234567
3. Programme Code:MCAOL
4. Course Code(Use this format course-wise separately)
:MCS-220 (Web Technologies)
5. Study Centre Code:07107
6. Name of the Study CentreWith complete address
:Acharya Narendra Dev College, Govindpuri, Kalkaji, New Delhi - 110019
7. Mobile Number:98XXXXXXXX
8. E-mail ID:manoj.ignou@gmail.com
9. Details if this same assignment hasbeen submitted anywhere else also
:No (First Submission)
10. Above information is cross checked and it is correct:Yes ✓
Date of Submission: 15 / 10 / 2026
Manoj Kumar
(Signature of the student)
A. Important Instructions:-
  1. Please do not send any assignment at any email of the Regional Centre, it will not be considered.
  2. Please avoid duplicacy. Do not re-submit the same assignment anywhere else or by any other means.
  3. About the mode of submission of assignments, pl wait for instructions from IGNOU Hqtrs. As soon as we shall come to know, we will share it with all.
  4. Please do not use plastic covers. Use plain A4 size pages for assignments for uniformity and better management with this cover page format on each assignment.
  5. Please write your name and enrollment no. at the bottom of each page of your assignment.
  6. Please retain a photocopy set of assignment submitted with you for record (may be asked to submit at later stage) and also keep the assignment submission receipt in safe custody.
  7. If assignment awards are not updated in your Grade Card within next 09 months, please write to us at rcdelhi1@ignou.ac.in giving your complete details and attaching the proof of assignment submission.
  8. Assignment Question Paper can be downloaded from: https://webservices.ignou.ac.in/assignments/
B. Compulsory sequence of the Assignment Set:
  1. 1. Duly Filled in Assignment Submission Cover Page (This Format Page).
  2. 2. Copy of IGNOU Identity Card.
  3. 3. Printout of valid/applicable assignment question paper.
  4. 4. Handwritten Assignment, written on both the sides of page (preferably plain A4 size).
Date:
Page:
Q1 (a)[5 Marks]

Define the following terms with suitable examples: (i) Design Pattern, (ii) Web Application, (iii) Servlet Container, (iv) JSP, (v) Dependency Injection.

1. Design Pattern :-

- A design pattern is a reusable, well-tested code solution^ to a commonly occurring design problem in software engineering. It is not finished code, but a general repeatable template describing how to solve a problem.

ex:- Singleton Pattern ensures that only a single instance of a database connection or config exists in whole JVM.

2. Web Application :-

- Dynamic software running on remote web server & accessed by users over HTTP/HTTPS via web browser. It executes server-side business logic and handles sessions.

ex:- Online Banking portal, IGNOU Samarth student portal where users login & download check grade cards.

3. Servlet Container :-

- The runtime component of web server that manages the complete lifecycle of Servlets: loading class, instantiation, init(), handling request via service(), and destroy().

ex:- Apache Tomcat, Eclipse Jetty server.

4. JSP (Java Server Pages) :-

- Server-side technology used to create dynamic web pages by writing Java code inside standard HTML using tags like <% ... %>. Container automatically compiles JSP into Servlet on 1st request.

ex:- Generating student marksheet table using <%= student.getName() %>.

5. Dependency Injection (DI) :-

- A design pattern implementing Inversion of Control (IoC). Instead of creating object dependencies manually using new Service(), the framework container provides ("injects") them at runtime via constructor or @Autowired.

ex:- Spring injecting StudentRepository into StudentService.

Date:
Page:
Q1 (b)[5 Marks]

Explain the layered architecture of a modern Java web application. Discuss the role of Presentation Layer, Business Layer, Persistence Layer and Database Layer.

Layered Architecture of Java Web App

- Modern Java web application is divided into 4 logical layers for loose coupling & clean separation of concerns:

Presentation Layer (JSP / Controllers)
↓ [DTOs / Form Models]
Business Logic Layer (Services)
↓ [Domain Entities]
Persistence Layer (Spring Data / DAO)
↓ [SQL Queries / JDBC]
Database Layer (MySQL / PostgreSQL)
Fig: 4-Tier Web Application Architecture

1 Presentation Layer: Handles HTTP requests coming from browser, validates user form input, and returns views (HTML/JSP) or JSON response.

2 Business Layer: Heart of application containing business logic, rules, calculations, security checks, and transaction management (@Transactional).

3 Persistence Layer (DAO): Communicates with database using ORM like Hibernate or JPA. Converts Java Entity objects into database table rows.

4 Database Layer: Actual RDBMS storage holding tables, foreign keys, and indexes where persistent data is saved safely.

Date:
Page:
Q2 (a)[5 Marks]

Explain the Servlet life cycle with the help of a neat diagram. Discuss the purpose of each life-cycle method.

Servlet Life Cycle

- Managed entirely by Servlet Container. Follows 4 main life-cycle stages:

Loading & Instantiation → init() (one time) → service() (every request) → destroy() (server stop)
Fig: Servlet State Transition Cycle

i) init(ServletConfig config): Invoked only once when servlet is created. Used for initialization tasks like opening DB connection pools or reading config params from server.xml web.xml.

ii) service(ServletRequest, ServletResponse): Called by container for each incoming client request. Runs in separate multithreaded worker and delegates to doGet() or doPost().

iii) destroy(): Executed only once before servlet is removed from memory or web server stops. Releases active system resources.

Date:
Page:
Q2 (b)[5 Marks]

Explain the HTTP request-response cycle. Describe how request parameters, headers and cookies are exchanged between a client and a web server.

HTTP Request - Response Cycle

- Browser opens TCP/TLS connection on port 80/443, sends request, server processes it, and returns response:

• Request Parameters: Passed in URL query string for GET (e.g. ?id=101&user=manoj) or in body payload for POST forms.

• HTTP Headers: Metadata key-values sent in both request & response (e.g. Content-Type: application/json, User-Agent).

• Cookies: Server sends Set-Cookie: JSESSIONID=xyz123 in response header. Browser saves it locally and echoes back in every subsequent request header to maintain login session state.

Date:
Page:
Q3 (a)[5 Marks]

Write a JSP program that accepts two numbers from a user and displays their Greatest Common Divisor (GCD). Explain the execution of your program.

Program: gcdCalculator.jsp

- Program using Euclidean algorithm to find GCD of two numbers:

<%@ page language="java" contentType="text/html; charset=UTF-8" %> <html> <body> <h3>GCD Calculator (MCS-220)</h3> <form method="POST"> Num 1: <input type="number" name="n1" required /><br/> Num 2: <input type="number" name="n2" required /><br/> <input type="submit" value="Find GCD" /> </form> <%! // Euclidean method declaration int findGCD(int a, int b) { while(b != 0) { int temp = b; b = a % b; a = temp; } return Math.abs(a); } %> <% String s1 = request.getParameter("n1"); String s2 = request.getParameter("n2"); if(s1 != null && s2 != null) { int a = Integer.parseInt(s1); int b = Integer.parseInt(s2); int ans = findGCD(a, b); %> <h4 style="color:#002b80;">Result: GCD = <%= ans %></h4> <% } %> </body> </html>

Working Explanation: Inside <%! %> declaration, Euclidean method computes remainder repeatedly until b == 0. On submit, request.getParameter() reads inputs, calls findGCD() and prints output.

Date:
Page:
Q3 (b)[5 Marks]

Write a Servlet program that accepts employee details from an HTML form and displays the submitted information on another web page.

Program: EmployeeServlet.java
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.annotation.WebServlet; @WebServlet("/EmployeeServlet") public class EmployeeServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); String id = req.getParameter("empId"); String name = req.getParameter("empName"); String dept = req.getParameter("dept"); String sal = req.getParameter("salary"); out.println("<html><body style='font-family:sans-serif;'>"); out.println("<h2>Submitted Employee Details</h2>"); out.println("<table border='1' cellpadding='6'>"); out.println("<tr><td>ID</td><td>" + id + "</td></tr>"); out.println("<tr><td>Name</td><td>" + name + "</td></tr>"); out.println("<tr><td>Department</td><td>" + dept + "</td></tr>"); out.println("<tr><td>Salary</td><td>Rs. " + sal + "</td></tr>"); out.println("</table></body></html>"); } }
Date:
Page:
Q4[5 Marks]

A university wishes to develop an online student registration system. Explain how JDBC can be used to connect the application with a relational database. Illustrate the steps involved in establishing the connection, executing SQL statements and handling exceptions.

JDBC Student Registration Connection

- 5 essential steps in JDBC implementation:

1 Load Driver: Class.forName("com.mysql.cj.jdbc.Driver");

2 Get Connection: Connection con = DriverManager.getConnection(url, user, pass);

3 PreparedStatement: Prevents SQL injection when accepting user inputs.

4 Execute: ps.executeUpdate(); for insert/update operations.

5 Exception Handling: Wrap in try-with-resources block to automatically close Connection, Statement and handle SQLException.

String sql = "INSERT INTO students (enrollment, name, course) VALUES (?, ?, ?)"; try (Connection con = DriverManager.getConnection(DB_URL, USER, PASS); PreparedStatement ps = con.prepareStatement(sql)) { ps.setString(1, "2601234567"); ps.setString(2, "Manoj Kumar"); ps.setString(3, "MCAOL"); ps.executeUpdate(); System.out.println("Student Registered Successfully!"); } catch(SQLException e) { e.printStackTrace(); }
Date:
Page:
Q5[5 Marks]

Analyze the differences between Spring MVC and Spring Boot with respect to architecture, configuration, deployment, scalability and development effort. Discuss situations where each framework is most appropriate.

Diff b/w Spring MVC & Spring Boot
Criteria Spring MVC Spring Boot
Configuration Manual XML (web.xml) or verbose Java Config. Auto-configuration with starter dependencies.
Deployment Builds .war file, requires external Tomcat server. Built-in embedded Tomcat; builds standalone .jar.
Setup Time High boilerplate code & manual dependency management. Ready in 2 minutes via Spring Initializr.
Best For Traditional monolithic systems sharing corporate server. Modern Cloud-native Microservices & REST APIs.
Date:
Page:
Q6 (a)[5 Marks]

Compare Hibernate and JDBC for database application development. Analyze their advantages, limitations and suitable application scenarios.

Hibernate vs. Raw JDBC

- Key comparisons:

  • Object-Relational Mapping: JDBC requires manual mapping of ResultSet columns to POJO. Hibernate automates this via @Entity.
  • Database Independence: Hibernate uses HQL and Dialects (easily switch from MySQL to Oracle without rewriting SQL).
  • Caching: Hibernate provides 1st Level (Session) and 2nd Level cache reducing DB hits.
  • When to use: JDBC is ideal for ultra-fast batch insertions; Hibernate is best for domain-driven enterprise web applications.
Date:
Page:
Q6 (b)[5 Marks]

Explain how Spring Data JPA simplifies database programming compared to traditional DAO implementation. Support your answer with suitable examples.

Spring Data JPA DAO Simplification

- Traditional DAO requires writing repetitive boilerplate with EntityManager. Spring Data JPA requires only writing an interface extending JpaRepository:

public interface StudentRepository extends JpaRepository<Student, Long> { // Derived query generated automatically from method name! List<Student> findByCourse(String course); Optional<Student> findByEnrollmentNo(String roll); }

- Spring automatically implements CRUD methods (save(), findAll(), deleteById()) at runtime without any manual SQL code.

Date:
Page:
Q7[10 Marks]

A banking application requires strong authentication and authorization. Evaluate different security mechanisms provided by Spring Security, including authentication, authorization, password encoding and session management. Recommend an appropriate security strategy with justification.

Spring Security in Banking App

1 Authentication & 2FA: Verify username/password + secondary OTP/MFA via SMS/authenticator app before granting access.

2 Role-Based Authorization (RBAC): Enforce method security with @PreAuthorize("hasRole('MANAGER')") so tellers cannot approve large fund transfers.

3 Password Hashing: Passwords must never be stored plain. Use BCryptPasswordEncoder with adaptive salting and work factor ≥ 12.

4 Session & CSRF: For web banking, enable strict CsrfTokenRepository and HTTP-only Secure cookies. For mobile APIs, use stateless JWTs with 15-min expiration.

Recommended Strategy: Stateless JWT with rotating refresh tokens stored in HTTP-only cookies, combined with IP & device fingerprinting, strict CORS, and rate limiting to prevent brute-force attacks.

Date:
Page:
Q8 (a & b)[10 Marks]

Explain importance of software testing (Unit, Integration, Security) and exception handling/logging in enterprise web apps.

Part (a): Software Testing Hierarchy :-
  • Unit Testing (JUnit 5 + Mockito): Tests isolated functions without starting DB or server. Gives immediate feedback.
  • Integration Testing (@SpringBootTest): Verifies flow between Controller ➔ Service ➔ Database. Catches SQL mapping bugs.
  • Security Testing (OWASP ZAP): Tests for SQL Injection, XSS, CSRF, and authorization bypass vulnerabilities.
Part (b): Exception Handling & Logging :-
  • Global Exception Handler: Use @ControllerAdvice to catch unexpected errors, hiding raw stack traces from end-users.
  • Logging (SLF4J + Logback): Log meaningful messages (INFO, WARN, ERROR). Unique correlation IDs (MDC) allow tracing a failed transaction in production logs easily.
Date:
Page:
Q9[10 Marks]

Develop the design of a Library Management Web Application using Spring Boot. Include MVC architecture, database entities, Repository/Service/Controller components, CRUD operations, Spring Security login, and workflow explanation.

Library Management System Design
Browser → BookController → BookService → BookRepository → MySQL DB
Fig: Spring Boot MVC Architecture Flow
Entity: Book.java
@Entity
@Table(name="books")
public class Book {
  @Id @GeneratedValue
  private Long id;
  private String title;
  private String author;
  private boolean isAvailable = true;
  // getters & setters
}
Controller: BookController.java
@RestController
@RequestMapping("/api/books")
public class BookController {
  @Autowired BookService service;

  @GetMapping
  public List<Book> list() {
    return service.getAll();
  }
}
Workflow & Security: Spring Security authenticates students & librarians. When a student borrows a book, isAvailable is toggled to false and saved in DB.