Web Tech Notes
Web Tech Notes
Q1. Explain the Internet in detail. Discuss its history and characteristics. (PYQ)
1. 1969 (ARPANET): The Advanced Research Projects Agency (ARPA) of the US Defense
Department commissioned ARPANET. The first connection was established between
UCLA and Stanford. It introduced Packet Switching technology.
2. 1970s (TCP/IP): Vint Cerf and Bob Kahn developed the TCP/IP protocols, creating a
standard way for different networks to talk to each other.
3. 1983: ARPANET officially adopted TCP/IP, marking the birth of the modern "Internet."
5. 1991 (WWW): Tim Berners-Lee released the World Wide Web, making the Internet
user-friendly with browsers and pages.
Characteristics:
2. Packet Switching: Data is broken into small "packets," sent independently over the
most efficient routes, and reassembled at the destination.
Answer: Definition: The World Wide Web (WWW), or "The Web," is a system of interlinked
hypertext documents and multimedia resources accessed via the Internet. While the
Internet is the hardware (roads), the Web is the service (traffic) that runs on top of it.
Core Components:
1. URL (Uniform Resource Locator): The unique address of a specific resource (e.g.,
[Link]
2. HTTP (HyperText Transfer Protocol): The language clients and servers use to talk. It
defines methods like GET (fetch data) and POST (send data).
4. Web Server: Software that stores website files and handles incoming requests.
5. Web Browser: Software that interprets HTML/CSS and renders the visible page.
Working Steps:
2. DNS Resolution: The browser converts the domain name ([Link]) into an IP
address ([Link]) using a DNS Server.
5. Response: Server sends back the HTML file (HTTP 200 OK).
6. Rendering: Browser parses HTML, fetches linked CSS/Images, and displays the page.
Q3. Explain Web Browsers. Describe their evolution and functions. (PYQ)
Answer: Definition: A Web Browser is a software application used to locate, retrieve, and
display content on the World Wide Web. It acts as the interface between the user and the
Web Server.
Internal Architecture: A browser consists of a User Interface (Address bar, buttons), a
Rendering Engine (to parse HTML/CSS), a JavaScript Engine (to execute code), and
Networking components.
Functions:
1. Rendering: Converts raw HTML and CSS code into a visual representation (The DOM
Tree).
3. Storage: Manages local data like Cookies, Cache, and Local Storage for faster loading
and session management.
Evolution:
Generation 3 (2004-2008): Mozilla Firefox launched with tabbed browsing and pop-
up blocking, challenging IE's monopoly.
Q4. Explain URL in detail. Describe its structure and types. (PYQ)
Answer: Definition: A Uniform Resource Locator (URL) is a standardized text string used to
identify and locate a resource (web page, image, video) on the Internet. It serves as the
"address" for the browser.
o [Link] Email.
5. Query String: Data passed to the server, starting with ? (e.g., ?product_id=55).
6. Fragment: Points to a specific section within the page, starting with # (e.g.,
#reviews).
Types of URLs:
1. Absolute URL: Contains the full address, including protocol and domain. Used for
linking to external sites.
o Ex: [Link]
2. Relative URL: Describes the location relative to the current page. Used for internal
links.
Role in Web Communication: When a web server sends a file to a browser, it includes a
Content-Type header (MIME type). This is crucial because file extensions (like .jpg) might be
missing or wrong.
The browser reads the MIME type to decide which plugin or helper application to
use.
Example: If a server sends a file with content-type: application/pdf, the browser knows to
launch its PDF viewer, not display it as text.
Q6. Explain HTTP protocol in detail. Mention its features and limitations. (VERY HIGH PYQ)
Key Features:
1. Connectionless: The client disconnects after the request is fulfilled. It does not hold
the line open (in HTTP/1.0).
2. Media Independent: Can transfer any data type (text, video, zip) as long as the MIME
type is specified.
3. Stateless: The server does not remember the client. If you request page 1 and then
page 2, the server doesn't know you are the same person (unless Cookies are used).
Limitations:
1. No Security: HTTP sends data in Plain Text. Hackers can sniff passwords. (Solution:
Use HTTPS with SSL/TLS encryption).
2. Statelessness: Makes building interactive apps (like Shopping Carts) difficult without
using Cookies/Sessions.
3. Performance: Loading a page with 100 images requires 100 separate requests
(Solution: HTTP/2 Multiplexing).
Answer: A "Web Programmer's Toolbox" consists of the core technologies, languages, and
software needed to build modern web applications. It is categorized into three layers:
Shutterstock
Explore
CSS: Defines the look and feel (Layout, Colors, Responsive design).
4. Helper Tools:
Q8. Explain HTML in detail. What are its features and limitations? (VERY HIGH PYQ)
Answer: Definition: HTML (HyperText Markup Language) is the standard skeleton of the
web. It is a Markup Language, not a programming language, meaning it uses "Tags" to
annotate text to tell the browser how to structure it.
HTML
<!DOCTYPE html>
<html>
<head><title>My Page</title></head>
<body><h1>Hello World</h1></body>
</html>
Features:
3. Semantic Elements: HTML5 introduced tags like <nav>, <article>, <section> which
describe what the content is, not just how it looks.
4. Multimedia: Native support for <audio> and <video> without plugins (Flash is dead).
Limitations:
1. Static: Cannot display dynamic data (like current time or stock prices) without
JavaScript.
2. No Logic: Cannot perform calculations (2+2) or logic (If-Else).
3. Security: HTML code is visible to anyone ("View Source"), so it cannot store secrets.
Q9. Explain HTML Common Tags with examples. (VERY HIGH PYQ)
Answer: HTML tags are keywords enclosed in < > brackets. They usually come in pairs: a
Start Tag and an End Tag (e.g., <b>...</b>).
1. Document Structure:
2. Text Formatting:
3. Lists:
5. Tables:
Answer: Definition: HTML Forms are the primary mechanism for collecting user input
(Registration, Search, Login) and sending it to a server for processing.
7. Buttons: <input type="submit"> sends the form; <input type="reset"> clears it.
Example:
HTML
</form>
Q11. Explain Cascading Style Sheets (CSS). Why is it required? (VERY HIGH PYQ)
Answer: Definition: CSS (Cascading Style Sheets) is a stylesheet language used to describe
the presentation (look and formatting) of a document written in HTML.
The "Cascading" Nature: Styles can "cascade" or flow from one source to another. If
multiple styles conflict, the browser uses a priority scheme (Inline > Internal > External >
Browser Default).
1. Separation of Content and Design: HTML handles "What it is" (Structure), CSS
handles "How it looks" (Style). This makes code cleaner.
2. Global Changes: You can change the font of an entire 100-page website by modifying
one line in a single external CSS file.
3. Responsive Design: CSS Media Queries (@media) allow pages to adapt their layout
for Phones, Tablets, and Desktops.
4. Bandwidth Efficiency: CSS files are cached by the browser, speeding up load times
for subsequent pages.
1. Inline CSS:
Written directly inside the HTML tag using the style attribute.
Written inside a <style> tag within the <head> section of the HTML file.
Example:
HTML
<style>
3. External CSS:
Written in a separate .css file and linked using the <link> tag.
Pros: Best practice. Allows reuse across thousands of pages. Cleanest HTML.
Q13. Explain JavaScript and its role in web development. (VERY HIGH PYQ)
1. Client-Side Scripting: JS runs on the user's computer, not the server. This reduces
server load and makes apps feel instant.
2. DOM Manipulation: JS can Change, Add, or Delete HTML elements and CSS styles on
the fly.
3. Form Validation: Validates inputs (e.g., checking if passwords match) before sending
data to the server.
4. Asynchronous Requests (AJAX): JS can fetch data (like new tweets or emails) in the
background without refreshing the whole page.
5. Web APIs: Accesses device hardware like Geolocation, Camera, and Microphone.
Evolution: Originally just for simple animations, modern JS ([Link]) allows full-stack
development (running JS on the server too).
let: The modern way. Block-scoped. Can be updated but not redeclared.
2. Data Types: JavaScript is dynamically typed (variables can hold any type).
Primitive Types:
Complex Types:
o [Link]("click", functionName);
Common Events:
Mouse: click, dblclick, mouseover, mouseout.
Answer: Definition: Form Validation is the process of checking input data against a set of
rules before letting the user submit the form.
User Experience: Gives instant feedback (e.g., "Password too short") without waiting
for a server reload.
Validation Techniques:
2. Format Check (RegEx): Using Regular Expressions to validate patterns (e.g., Email
address structure).
Example Code:
JavaScript
function validate() {
alert("Must be 18+");
}
Unit-II: XML & PHP
Q1. What is XML? Write its features and applications. (PYQ – VERY FREQUENT)
Answer:
Definition:
XML (eXtensible Markup Language) is a text-based markup language derived from SGML. It
is designed to store, transport, and describe data, rather than to display it. Unlike HTML,
XML tags are not predefined; users must define their own tags to create a self-descriptive
structure.
Features of XML:
1. Extensible: Users can define their own tags (e.g., <student>, <salary>), allowing for
customized data structures.
2. Self-Descriptive: The tags describe the data they contain. For example,
<price>200</price> clearly indicates the value represents a price.
Applications of XML:
Data Exchange: Standard format for transferring data between incompatible systems
(e.g., Java to Python).
Web Services: Used in SOAP and REST APIs to carry message payloads.
Database Storage: Native XML databases (NXD) store data directly in XML format.
Answer:
Although both are markup languages, they serve fundamentally different purposes.
Feature HTML (HyperText Markup Language) XML (eXtensible Markup Language)
To display data and define document To store and transport data (Content &
Purpose
structure (Look & Feel). Context).
Lenient; browsers try to display even Strict; parser stops immediately if there
Syntax Check
with errors. is an error.
Answer:
An XML document must form a Tree Structure starting with a root element and branching
out to child elements.
Components:
1. Prolog (XML Declaration): The first line defining the XML version and encoding.
2. Root Element: The single parent tag that wraps the entire document. Every XML file
must have exactly one root.
Rules:
Answer:
1. Well-Formed XML:
Conditions:
2. Valid XML:
Conditions:
o It must follow the rules of the DTD/Schema (e.g., order of elements, data
types).
Relationship:
Not all Well-Formed XML documents are Valid (they might violate the DTD).
Answer:
Definition:
DTD (Document Type Definition) is a set of rules that defines the legal building blocks of an
XML document. It acts as a "contract" that defines the document structure with a list of legal
elements and attributes.
Types of DTD:
1. Internal DTD:
o The DTD rules are defined inside the XML file itself within the <!DOCTYPE>
wrapper.
o Example:
XML
<!DOCTYPE note [
]>
2. External DTD:
o The rules are saved in a separate .dtd file and linked to the XML document.
Answer:
1. Elements:
Defines what tags are allowed and what content they can contain.
2. Attributes:
3. Entities:
Answer:
Definition:
XML Schema (XSD - XML Schema Definition) is a more powerful and flexible alternative to
DTD. It describes the structure of an XML document using XML syntax itself (unlike DTD
which uses a special non-XML syntax).
1. Data Types: XSD supports strong data typing (Integer, Date, Boolean, String). DTD
treats everything as text.
2. XML Syntax: XSD is written in XML, so you don't need to learn a new language to
write a schema. You can use standard XML parsers to parse the schema itself.
3. Namespaces: XSD supports XML Namespaces, allowing you to mix elements from
different schemas without name conflicts.
Answer:
Definition:
XSL (eXtensible Stylesheet Language) is a family of languages used to transform and render
XML documents. Since XML tags are user-defined, browsers don't know how to style them
(unlike HTML tags). XSL provides the styling and transformation rules.
Components of XSL:
2. XPath (XML Path Language): A language for navigating through elements and
attributes in an XML document. It acts like a query language (finding specific nodes).
Answer:
Definition:
XSLT (XSL Transformations) is a W3C standard used to convert XML into HTML so it can be
displayed in a browser. It works by matching XML elements against templates.
Working Principle:
Example:
XSLT Code:
XML
<xsl:template match="/">
<html>
<body>
<h1><xsl:value-of select="title"/></h1>
</body>
</html>
</xsl:template>
Output HTML: <h1>Harry Potter</h1>
Conclusion: XSLT maintains the separation of data (XML) and presentation (HTML).
Answer:
Definition:
XPath is a query language for selecting nodes from an XML document. It is a major element
in the XSLT standard. Without XPath, XSLT cannot find data to transform.
Features:
4. Functions: Includes standard functions for string, numeric, and boolean operations.
Answer:
Definition:
Features:
1. Server-Side Execution: The code runs on the server; the client (browser) receives
only plain HTML. The source code is secure and hidden from the user.
2. Database Integration: It has built-in support for almost all databases (MySQL,
PostgreSQL, Oracle), making it ideal for data-driven apps.
3. Platform Independent: PHP runs on Windows, Linux, Unix, and Mac servers.
Answer:
Working Flow:
1. Request: The browser sends an HTTP request for a .php file (e.g., [Link]).
2. Interception: The Web Server (like Apache) recognizes the extension and forwards it
to the PHP Preprocessor (Engine).
3. Execution: The PHP Engine executes the script line-by-line. If database data is
needed, it queries the database.
4. Output Generation: The PHP script generates pure HTML output (stripping away all
PHP code).
5. Response: The Web Server sends the generated HTML back to the browser.
Shutterstock
Explore
Answer:
1. Variables:
Loosely Typed: You do not need to declare the data type; PHP determines it
automatically based on the value.
2. Data Types:
3. Constants:
Answer:
1. Operators:
Arithmetic: +, -, *, /, %
Assignment: =, +=
2. Control Structures:
Conditional Statements:
Loops:
Answer:
1. Arrays:
A special variable that can hold more than one value at a time.
o Access: $cars[0]
o Access: $age['Peter']
2. Functions:
Answer:
Definition:
PHP is the standard backend language for processing HTML forms. It uses Superglobals to
collect data sent by the client.
Methods:
1. $_GET:
o Security: Low.
2. $_POST:
Example:
Conclusion: PHP form handling bridges the gap between static user input and dynamic
server processing.
Unit-III: Servlets & JSP
Q1. What is a Servlet? Explain its role in web applications. (AKASH PYQ – VERY HIGH)
Answer:
Definition:
A Servlet is a Java programming language class used to extend the capabilities of servers
that host applications accessed by means of a request-response programming model.
Although servlets can respond to any type of request, they are commonly used to extend
the applications hosted by web servers (handling HTTP requests).
Key Characteristics:
1. Dynamic Content Generation: Unlike static HTML files, servlets can generate unique
content based on user input (e.g., displaying a user's profile name).
2. Request Handling: It reads the explicit data sent by the clients (HTML form data) and
implicit HTTP request data (cookies, media types).
Conclusion: Servlets are the foundational building block of Java EE web development; even
JSP and JSF are built on top of the Servlet API.
Q2. Explain the advantages of Servlets over CGI. (AKASH PYQ – DIRECT)
Answer:
Common Gateway Interface (CGI) was the older technology where every client request
spawned a new process on the OS. Servlets improved upon this significantly.
Feature CGI (Common Gateway Interface) Servlets
Conclusion: Servlets replaced CGI because they are significantly more efficient, scalable, and
secure.
Q3. Explain Servlet Architecture and Components. (AKASH PYQ – VERY HIGH)
Answer:
The Servlet Architecture relies on a Web Container (also called a Servlet Container or Servlet
Engine) to manage the execution of servlets.
Key Components:
2. Web Server: Handles static content (HTML, Images) and passes dynamic requests to
the Servlet Container.
Working Flow:
Q4. Explain the Servlet Life Cycle with diagram description. (AKASH PYQ – VERY HIGH)
Answer:
The Servlet Life Cycle is controlled entirely by the Servlet Container. It consists of four main
phases.
Phases:
2. Initialization (init()):
4. Destruction (destroy()):
o Called before the servlet is removed from memory (e.g., server shutdown).
o Used for cleanup (closing DB connections, saving state).
Conclusion: The lifecycle ensures resource efficiency by initializing heavy resources only
once.
Answer:
Definition:
HttpServlet is an abstract class that extends GenericServlet. It provides specific support for
the HTTP protocol. Web developers typically extend this class to build web applications.
Hierarchy:
Important Methods:
3. doPost(): Override this to handle HTTP POST requests (submitting form data).
Q6. Explain GET and POST methods in Servlets. (AKASH PYQ – VERY HIGH)
Answer:
GET and POST are the two most common HTTP methods used to send data from a browser
to a server.
Used to retrieve data from the Used to submit/send data to the server
Purpose
server. for processing.
Data Visibility Data is appended to the URL (Query Data is sent in the Request Body.
Feature GET Method POST Method
Answer:
When a client sends a request, the Container creates two objects and passes them to the
service() method.
Key Functions:
Key Functions:
Answer:
Definition:
HTTP is a Stateless Protocol (it forgets the user after every request). Session Management is
the technique used to track a user's state across multiple requests (e.g., keeping a user
logged in or maintaining a shopping cart).
Techniques:
1. Cookies: Small text files stored on the client's browser. Sent back to the server with
every request.
o The server uses this ID to map requests to the correct session object.
3. URL Rewriting: Appending the session ID to the URL (e.g., url?jsessionid=123). Used
when cookies are disabled.
4. Hidden Form Fields: Storing state in <input type="hidden"> tags within forms.
Conclusion: HttpSession is the most robust and secure method for server-side state
management.
Answer:
Cookies:
HttpSession:
Server-side state management.
Comparison:
Q10. What is JSP? Explain its need and advantages. (AKASH PYQ – VERY HIGH)
Answer:
Definition:
JSP (JavaServer Pages) is a server-side technology that allows developers to create dynamic
web pages. It enables mixing HTML (for layout) with Java code (for logic) using special tags.
JSP reverses this: You write HTML normally and inject Java only where needed.
Advantages:
2. Ease of Development: Web designers can edit the HTML without knowing advanced
Java.
5. Implicit Objects: Provides built-in objects like request and session without
instantiation.
Conclusion: JSP is essentially a high-level abstraction of Servlets, designed for the "View"
layer.
Q11. Explain JSP Architecture and Life Cycle. (AKASH PYQ – VERY HIGH)
Answer:
JSP Architecture:
A JSP page is translated into a Servlet by the JSP engine (Container) before it is executed. It
does not run as a text file.
1. Translation: The Container checks the JSP syntax and generates a Java Servlet file
(.java).
Conclusion: The Translation and Compilation happen only once (first request), making
subsequent requests very fast.
Answer:
Scripting elements allow you to insert Java code into the JSP.
o Code here goes outside _jspService(), making variables global to the class.
Conclusion: While powerful, modern JSP development avoids scripting elements in favor of
JSTL/EL.
Answer:
Definition:
Directives give instructions to the JSP container on how to translate the page into a servlet.
They do not produce output directly.
Types:
2. Include Directive: Statically includes the content of another file at translation time.
o Example: <%@ include file="[Link]" %> (The code is copied and pasted).
Answer:
Definition:
Implicit objects are Java objects that the JSP Container creates automatically. Developers can
use them directly without creating them (no new keyword needed).
Conclusion: These objects simplify coding by handling the complexity of object creation.
Answer:
Definition:
Action tags are XML-syntax tags used to perform specific operations at request time
(runtime).
1. <jsp:include>:
2. <jsp:forward>:
o Forwards the request to another page. The user does not see the URL change.
3. <jsp:useBean>:
Q16. Explain MVC Architecture using Servlets and JSP. (AKASH PYQ – VERY HIGH)
Answer:
Components:
1. Model (JavaBeans/POJO):
o Represents the data and business logic (e.g., User class, Database logic).
2. View (JSP):
3. Controller (Servlet):
Workflow:
Answer:
Ease of Hard to write and maintain HTML Easy to write and maintain layout.
Feature Servlets JSP (JavaServer Pages)
Answer:
Definition:
JDBC (Java Database Connectivity) is an API that enables Java applications (Servlets/JSP) to
interact with relational databases.
Best Practice: In Servlets, always use a Connection Pool (DataSource) instead of raw
DriverManager for better performance.
Answer:
1. Filters:
Objects that intercept requests before they reach the servlet or responses before
they reach the client.
Use Cases: Authentication checks, Logging, Data compression, Encryption.
Method: doFilter().
2. Listeners:
Types:
Answer:
Mechanisms:
5. Input Validation: Sanitizing inputs to prevent SQL Injection and XSS (Cross-Site
Scripting).
Unit-IV: AJAX, Web Services & SOA
Q1. What is AJAX? Explain its need and advantages. (AKASH PYQ – VERY HIGH)
Answer:
Definition:
AJAX (Asynchronous JavaScript and XML) is not a single technology, but a suite of web
development techniques used to create asynchronous web applications. It allows web pages
to be updated asynchronously by exchanging small amounts of data with the server behind
the scenes. This means that it is possible to update parts of a web page, without reloading
the whole page.
1. Every user action (like clicking a button) sent an HTTP request to the server.
3. The browser had to reload and re-render everything (header, footer, sidebar) even if
only one text field changed.
Advantages of AJAX:
1. Partial Page Updates: Only the specific part of the DOM that needs new data is
updated.
2. Asynchronous Processing: The user can continue interacting with the page while the
data is being fetched in the background (Non-blocking).
3. Reduced Server Traffic: Instead of sending full HTML pages, the server sends only
small data chunks (JSON/XML).
4. Improved User Experience: The application feels faster and more responsive, similar
to a desktop application.
5. Separation of Data and Format: The server provides data (JSON), and the client
(browser) handles the formatting/HTML generation.
Q2. Explain the working of AJAX with architecture. (AKASH PYQ – VERY HIGH)
Answer:
Working Flow:
1. Event Occurrence: An event occurs in a web page (e.g., the user clicks a "Load More"
button).
3. Request Sending: The XHR object sends a request to the web server asynchronously.
4. Server Processing: The server processes the request, interacts with the database if
needed, and prepares a response (usually JSON or XML).
5. Response Return: The server sends the data back to the web browser.
7. DOM Update: JavaScript parses the response and updates the HTML DOM to display
the new data without a reload.
Answer:
Definition:
The XMLHttpRequest (XHR) object is the keystone of AJAX. It provides the API for client-side
scripting languages (like JavaScript) to transfer data between a client and a server via HTTP.
Key Methods:
Key Properties:
o 0: UNSENT
o 1: OPENED
o 2: HEADERS_RECEIVED
o 3: LOADING
2. status: Returns the status-number of a request (e.g., 200 for "OK", 404 for "Not
Found").
Answer:
The async parameter in the open() method determines the mode of operation.
Mechanism: The JavaScript code pauses (blocks) at the send() statement and waits
until the server sends back the complete response.
Impact: The browser freezes (UI becomes unresponsive). The user cannot click or
scroll until the data arrives.
Usage: Rarely used today; deprecated in modern web development because it ruins
the User Experience.
Mechanism: The JavaScript sends the request and immediately continues executing
the next lines of code without waiting.
Handling: When the server eventually responds, an event (onreadystatechange)
fires, triggering a callback function to handle the data.
Answer:
Once the XMLHttpRequest object receives a response (readyState=4, status=200), the data
can be handled in three main formats:
The response is treated as an XML DOM object. You must use DOM methods like
getElementsByTagName() to extract data.
JavaScript parses this string into a native JavaScript Object using [Link]().
Example:
JavaScript
[Link]("demo").innerHTML = [Link];
Q6. What is JSON? Explain its features and advantages. (AKASH PYQ – VERY HIGH)
Answer:
Definition:
JSON (JavaScript Object Notation) is a lightweight text-based format for storing and
transporting data. It is often used when data is sent from a server to a web page. It is
derived from JavaScript object syntax but is language-independent.
Syntax Rules:
Features:
1. Lightweight: Smaller file size compared to XML because it lacks closing tags.
2. Data Structure: JSON maps directly to data structures (Objects/Arrays), whereas XML
is a tree structure that requires traversal.
Q7. Explain Web Services and their characteristics. (AKASH PYQ – VERY HIGH)
Answer:
Definition:
A Web Service is a standardized way for two different applications to talk to each other over
a network, regardless of the operating system or programming language they are running
on. It is "Machine-to-Machine" communication using standard web protocols (HTTP).
Characteristics:
2. Standardized Protocols: Uses open standards like XML, JSON, HTTP, SOAP, and WSDL.
3. Loose Coupling: The client and server are independent. A change in the server's
internal logic doesn't necessarily break the client.
Answer:
Definition:
SOAP (Simple Object Access Protocol) is a strict, XML-based protocol for exchanging
information in the implementation of web services. It defines exactly how the message
should look.
1. Envelope: The root element that defines the XML document as a SOAP message.
Features:
Protocol Independent: Can technically work over SMTP or TCP, not just HTTP.
Answer:
Definition:
REST (Representational State Transfer) is not a protocol but an Architectural Style. Web
services that follow REST guidelines are called RESTful. It treats data as Resources accessed
via URIs.
3. Stateless: The server does not store any client context between requests.
Advantages:
Cacheable responses.
Answer:
Feature SOAP (Simple Object Access Protocol) REST (Representational State Transfer)
Data Format Uses XML only. Supports JSON, XML, HTML, Text, etc.
Answer:
Definition:
Core Concept:
Instead of building a giant "Monolithic" application, you break the software into smaller,
distinct functional units called Services (e.g., Payment Service, User Service, Shipping
Service). These services communicate via an Enterprise Service Bus (ESB).
Key Principles:
1. Reusability: A service (like "Check Credit Score") can be reused by the Loan
Department app and the Credit Card app.
2. Loose Coupling: Services are independent. Changes in one do not break others.
Q12. Explain WSDL and its role in Web Services. (AKASH PYQ)
Answer:
Definition:
WSDL (Web Services Description Language) is an XML-based language used to describe the
functionality offered by a SOAP web service.
It acts as a Contract between the Service Provider and the Service Consumer. It tells the
client exactly how to talk to the service.
4. <binding>: Defines the protocol and data format (e.g., SOAP over HTTP).
5. <service>: Defines the network address (URL) where the service is located.
Q13. Explain UDDI. (AKASH PYQ)
Answer:
Definition:
Components:
1. White Pages: Contact information (Name, Address, Phone) of the company providing
the service.
2. Yellow Pages: Categorization of the service (e.g., "Credit Card Processing", "Weather
Service") based on standard taxonomies.
3. Green Pages: Technical details (WSDL location) on how to invoke the service.
Process:
Answer:
AJAX increases the attack surface of a web application because logic is moved to the client
side.
Common Issues:
1. Cross-Site Scripting (XSS): Attackers inject malicious scripts into web pages. Since
AJAX manipulates the DOM, XSS can steal session cookies or redirect users.
2. Cross-Site Request Forgery (CSRF): An attacker tricks a user into executing unwanted
actions on a web application where they are authenticated.
3. SQL Injection: If AJAX parameters are sent directly to a database query without
validation, attackers can manipulate the database.
4. Data Exposure: Since AJAX source code (JavaScript) is visible to the user ("View
Source"), hardcoded API keys or sensitive logic can be stolen.
Solutions:
Answer:
Data Transfer Sends complete HTML page (Heavy). Sends only data (JSON/XML) (Light).
Answer:
Advantages:
Limitations:
1. SEO Issues: Search engine crawlers have difficulty indexing dynamic content loaded
via JavaScript (though modern crawlers are getting better).
2. Browser History: In pure AJAX, the "Back" button might not work as expected
because the URL doesn't change (Requires HTML5 History API to fix).
Answer:
Integration Flow:
2. Communication: The request is sent to a RESTful Web Service endpoint (e.g., GET
/api/weather).
3. Processing: The Web Service (Backend) processes the logic and queries the database.
5. Rendering: The AJAX callback receives the JSON and uses JavaScript to update the UI.
Benefit: The backend becomes a pure "Data Provider" (API), allowing the same web service
to support a Web App, a Mobile App, and 3rd party integrations.
Answer:
1. Google Autocomplete: As you type in the search bar, AJAX fetches suggestions
without reloading the page.
2. Google Maps: You can drag the map to see new areas. AJAX fetches the new image
tiles in the background seamlessly.
3. Social Media Feeds (Facebook/Instagram): "Infinite Scroll" uses AJAX to load more
posts as you scroll down.
4. Shopping Carts: Adding an item to the cart updates the cart counter instantly
without refreshing the page.
5. Form Validation: Checking if a "Username is taken" while the user is still typing.
Answer:
API (Application Programming Interface):
A set of rules and definitions that allows one software program to talk to another.
Web API:
It exposes endpoints (URLs) that developers can use to interact with a service.
Example: The Twitter API allows developers to fetch tweets using HTTP GET requests.
All Web Services are APIs, but not all APIs are Web Services.
Answer:
1. Progressive Web Apps (PWA): Web apps that behave like mobile apps (offline
support, push notifications) using Service Workers.
3. GraphQL: A query language for APIs that allows clients to ask for exactly the data
they need, solving the over-fetching problem of REST.