Web Technology
106609Module I: Introduction to Web Technologies and Architectures
Q1(a). What does DTD stand for in XML? (i) Document Type Declaration (ii) Data Type Declaration (iii) Document Template Descriptor (iv) Direct Type Definition20242m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What does DTD stand for in XML? (i) Document Type Declaration (ii) Data Type Declaration (iii) Document Template Descriptor (iv) Direct Type Definition
Worked SolutionAnswer: (i) Document Type Declaration (as listed in the options).
DTD is a set of rules that defines the structure and legal elements/attributes of an XML document, so a parser can validate it. Its formal expansion is Document Type Definition, and among the given options (i) is the closest match. It is referenced in an XML file with
<!DOCTYPE ...>.Q1(a). A system moves most application processing from client machines to a central server while clients mainly provide the user interface. This architecture is closest to (i) Fat-client architecture (ii) Fat-server architecture (iii) Peer-to-peer architecture (iv) N-tier architecture with no server processing20262m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →A system moves most application processing from client machines to a central server while clients mainly provide the user interface. This architecture is closest to
(i) Fat-client architecture
(ii) Fat-server architecture
(iii) Peer-to-peer architecture
(iv) N-tier architecture with no server processingWorked SolutionCorrect answer: (ii) Fat-server architecture. Most application processing occurs on the central server, while clients mainly provide the user interface.
Q1(b). Which of the following correctly describes a Far Server architecture? (i) Processing is evenly distributed between client and server (ii) The client handles most of the processing (iii) The server handles most of the processing (iv) None of the above20242m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which of the following correctly describes a Far Server architecture? (i) Processing is evenly distributed between client and server (ii) The client handles most of the processing (iii) The server handles most of the processing (iv) None of the above
Worked SolutionAnswer: (iii) The server handles most of the processing.
The question means a Fat Server (thin client) architecture: the client only presents the UI while business logic and data processing run on the server. In a Fat Client, the client does most of the processing instead.
Q1(b). A middleware layer is introduced between clients and servers primarily to (i) Replace the operating system (ii) Convert HTML into machine code (iii) Eliminate all server processing (iv) Hide communication and implementation details between distributed components20262m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →A middleware layer is introduced between clients and servers primarily to
(i) Replace the operating system
(ii) Convert HTML into machine code
(iii) Eliminate all server processing
(iv) Hide communication and implementation details between distributed componentsWorked SolutionCorrect answer: (iv) Hide communication and implementation details between distributed components. Middleware offers common services such as messaging, remote calls, authentication and transactions.
Q1(j). Differentiate between block tags and inline tags with suitable example.20232m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Differentiate between block tags and inline tags with suitable example.
Worked SolutionBasis Block tags Inline tags Layout Start on a new line and take the full available width Stay in the line and take only as much width as their content Width/height Can be set Ignored (width/height have no effect) Contains Block and inline elements Only text and other inline elements Examples <div>,<p>,<h1>,<ul>,<table><span>,<a>,<b>,<img>,<em><div>Block one</div> <div>Block two</div> <!-- two separate lines --> <p>Text with <span>inline</span> and <a href="#">link</a> in one line.</p>Q1a. Who is making the Web standards? (i) Mozilla (ii) Microsoft (iii) The World Wide Web Consortium (iv) NVDIA20202m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Who is making the Web standards?
(i) Mozilla
(ii) Microsoft
(iii) The World Wide Web Consortium
(iv) NVDIAWorked SolutionCorrect Answer: (iii) The World Wide Web Consortium (W3C)
Explanation:
- The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web, founded in 1994 by Tim Berners-Lee.
- W3C develops open standards (recommendations) such as HTML, CSS, XML, SVG, and WAI-ARIA to ensure the long-term growth and interoperability of the Web.
- Mozilla and Microsoft are commercial/non-profit software vendors that build web browsers and participate as members in standards bodies (like W3C and WHATWG).
- NVIDIA is a semiconductor and GPU hardware company.
Q1a. Which markup language is the foundation for defining other markup languages like HTML and XML (i) SGML (ii) CSS (iii) XSL (iv) None of this20252m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which markup language is the foundation for defining other markup languages like HTML and XML
(i) SGML
(ii) CSS
(iii) XSL
(iv) None of thisWorked SolutionCorrect Answer: (i) SGML
Explanation:
- SGML (Standard Generalized Markup Language) is a standard generalized metalanguage (ISO 8879:1986) used to define descriptive markup languages.
- Both HTML and XML were developed based on SGML. XML is a simplified subset of SGML designed specifically for the World Wide Web.
- CSS is a style sheet language, and XSL is an XML-based stylesheet and transformation language.
Key Points:
- Foundation: SGML defines the rules and syntax for document markup.
- Derivatives: HTML (application of SGML) and XML (restricted subset of SGML).
Q1b. Which of the following is used to define the structure of an XML document? (i) XSL (ii) DTD (iii) CSS (iv) HTML20252m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which of the following is used to define the structure of an XML document?
(i) XSL
(ii) DTD
(iii) CSS
(iv) HTMLWorked SolutionCorrect Answer: (ii) DTD
Explanation:
- DTD (Document Type Definition) defines the legal structure, elements, attributes, and data types of an XML document.
- It validates the syntax and layout of an XML document to ensure it conforms to the intended schema.
- XSL (Extensible Stylesheet Language) is used for transforming and formatting XML documents.
- CSS (Cascading Style Sheets) is used for presentation and styling.
- HTML is a markup language for web page structure, not XML schema definition.
Example of DTD Declaration:
<!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]>Q1b. If you want to align text to the right side of a block element in a cascading style sheet (CSS), then which of...20202m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →If you want to align text to the right side of a block element in a cascading style sheet (CSS), then which of...
Worked SolutionCorrect Answer:
text-align: right;Explanation:
- In Cascading Style Sheets (CSS), the
text-alignproperty specifies the horizontal alignment of inline content (like text, images, or inline blocks) within a block element or table-cell box. - Setting
text-align: right;aligns the text flush with the right edge of the containing block element.
Syntax & Example:
p { text-align: right; }Common
text-alignValues:left: Aligns text to the left margin (default in LTR languages).right: Aligns text to the right margin.center: Centers the text horizontally.justify: Stretches lines so that every line has equal width.
- In Cascading Style Sheets (CSS), the
Q1c. Which of the following is not used with text-decoration property? (i) Overline (ii) Underline (iii) Line-through (iv) Inline20192m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which of the following is not used with text-decoration property?
(i) Overline
(ii) Underline
(iii) Line-through
(iv) InlineWorked SolutionCorrect Answer: (iv) Inline
Explanation:
- In CSS, the
text-decoration(ortext-decoration-line) property accepts values that specify decorative lines added to text:underline: Line under the text.overline: Line above the text.line-through: Strikethrough line across the text.none: Removes any decoration.
inlineis a value of the CSSdisplayproperty (display: inline;), not thetext-decorationproperty.
- In CSS, the
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q1c. Markup tags tell the Web browser (i) how to organize the page (ii) how to display the page (iii) how to display message box on page (iv) None of the above20202m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Markup tags tell the Web browser
(i) how to organize the page
(ii) how to display the page
(iii) how to display message box on page
(iv) None of the aboveWorked SolutionCorrect Answer: (ii) how to display the page
Explanation:
- Markup tags (HTML tags such as
<h1>,<p>,<table>,<img>) are keywords enclosed in angle brackets that instruct the web browser on how to format, structure, and display text, multimedia, and layout elements on the screen. - The browser reads markup tags to construct the Document Object Model (DOM) and render the visual page according to the specified semantics and styling.
- Markup tags (HTML tags such as
Q1d. Which of the following HTML tags is used to define an internal style sheet? (i) \<script\> (ii) \<css\> (iii) \<style\> (iv) None of the above20192m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which of the following HTML tags is used to define an internal style sheet?
(i) <script>
(ii) <css>
(iii) <style>
(iv) None of the aboveWorked SolutionCorrect Answer: (iii) <style>
Explanation:
- In HTML, internal (embedded) Cascading Style Sheets are defined inside the
<style>tag, placed within the<head>section of the HTML document. <script>is used to embed or reference executable JavaScript code.<css>is not a valid HTML element.
Example:
<head> <style> body { background-color: #f5f6f2; color: #1b2430; } </style> </head>- In HTML, internal (embedded) Cascading Style Sheets are defined inside the
Q1e. Which of the following is an advantage of putting presentation information in a separate CSS file rather than in HTML itself? (i) The content becomes easy to manage (ii) Becomes easy to make site for different devices like mobile by making separate CSS files (iii) CSS files are generally cached and therefore decrease server load and network traffic (iv) All of the above20202m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Which of the following is an advantage of putting presentation information in a separate CSS file rather than in HTML itself?
(i) The content becomes easy to manage
(ii) Becomes easy to make site for different devices like mobile by making separate CSS files
(iii) CSS files are generally cached and therefore decrease server load and network traffic
(iv) All of the aboveWorked SolutionCorrect Answer: (iv) All of the above
Explanation:
Separating presentation rules into an external
.cssfile provides several key advantages:- Maintainability & Separation of Concerns (i): HTML structure is decoupled from visual styling, allowing sitewide design changes by editing a single CSS file.
- Device Independence & Responsiveness (ii): Enables targeting distinct devices (mobiles, tablets, print) through separate stylesheets or CSS media queries (
@media). - Browser Caching & Performance (iii): External CSS files are cached by the browser after the first download, drastically reducing bandwidth consumption, network traffic, and server load on subsequent page requests.
Therefore, (iv) All of the above is the correct option.
Q1g. Choose the correct HTML tag to make a text bold. (i) \<b\> (ii) \<bold\> (iii) \<bb\> (iv) \<bld\>20192m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Choose the correct HTML tag to make a text bold.
(i) <b>
(ii) <bold>
(iii) <bb>
(iv) <bld>Worked SolutionCorrect Answer: (i) <b>
Explanation:
- In HTML, the
<b>tag (physical formatting tag) and the<strong>tag (semantic logical tag) are used to format text in bold. - Tags like
<bold>,<bb>, and<bld>are not valid HTML elements.
Example:
<p>This is <b>bold text</b> using the b tag.</p>- In HTML, the
Q2(a). Differentiate between Fat Client and Fat Server architectures with respect to processing, data management and application deployment.20267m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Differentiate between Fat Client and Fat Server architectures with respect to processing, data management and application deployment.
Worked SolutionFat Client vs Fat Server Architecture
A fat client performs substantial application processing on the client machine. A fat server performs most application processing centrally; the client mainly handles the user interface.
Basis Fat client Fat server Processing Mostly client-side Mostly server-side Client hardware Usually needs more resources Can be relatively lightweight Data management May process/cache data locally; synchronization may be needed Centralized data and business logic are easier to manage Deployment Client applications must be installed/updated on multiple devices Server-side updates can apply centrally Network Some tasks may work offline or need fewer requests Often relies more on network availability Control More logic resides on user devices Easier to enforce central policies Example Rich desktop application Browser-based banking application MermaidDiagramRendering diagram…Conclusion: Fat clients can be responsive and support offline work; fat-server systems simplify centralized deployment and control. Most real applications distribute work between both.
Q2(a). Discuss the concepts of client-server computing and middleware. How do they enhance the functionality of web applications?20247m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Discuss the concepts of client-server computing and middleware. How do they enhance the functionality of web applications?
Worked SolutionClient-server computing
In client-server computing, work is split between two roles:
- Client: the requester, usually a browser or mobile app that handles the user interface and sends requests.
- Server: the provider, which processes requests, runs business logic, accesses the database, and returns responses.
They communicate over a network using protocols such as HTTP.
Client (browser) --HTTP request--> Web/App Server --> Database <--HTTP response--Types: thin client / fat server (most logic on the server) and fat client / thin server (most logic on the client). Modern web apps mix both, e.g. a React front end with a Node.js API.
Middleware
Middleware is software that sits between the client and the back-end systems (servers, databases, other services) and lets them communicate and work together.
Examples: application servers, web servers/reverse proxies, message queues (RabbitMQ, Kafka), API gateways, ORM and database drivers, authentication layers, Express.js middleware.
Functions: communication and protocol translation, authentication and authorization, logging, caching, load balancing, transaction management, data format conversion (JSON/XML).
How they enhance web applications
- Separation of concerns: UI, logic, and data are handled independently and can be changed separately.
- Centralised control: business rules, security, and data live on the server, so updates are made once for all users.
- Scalability: more servers can be added behind a load balancer; middleware distributes the load.
- Interoperability: middleware connects different platforms, languages, and databases.
- Security: sensitive data and logic stay on the server; middleware enforces authentication and validation.
- Reduced client requirements: thin clients work on any device with a browser.
- Reusability and faster development: common services (auth, logging) are written once and reused.
- Reliability: caching, queues, and failover keep the application responsive.
Example (Express middleware in JavaScript):
app.use(express.json()); // parse JSON bodies app.use((req, res, next) => { // logging middleware console.log(req.method, req.url); next(); }); app.get('/api/users', authMiddleware, (req, res) => res.json(users));Q2(b). What is the difference between block-level and inline elements in HTML? Provide examples of each and discuss how they affect layout and rendering in a webpage.20247m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What is the difference between block-level and inline elements in HTML? Provide examples of each and discuss how they affect layout and rendering in a webpage.
Worked SolutionBlock-level vs inline elements
Basis Block-level Inline Line behaviour Starts on a new line; the next element also goes below Flows within the line beside other content Width Takes the full available width by default Takes only the width of its content Width/height/vertical margin Can be set width,height, and vertical margin/padding do not affect layoutCan contain Block and inline elements Text and other inline elements only Default displayblockinlineExamples <div>,<p>,<h1>–<h6>,<ul>,<ol>,<li>,<table>,<form>,<section><span>,<a>,<strong>,<em>,<img>,<label>,<code>Example
<div style="background:#cde">Block A</div> <div style="background:#fdc">Block B</div> <p>This paragraph has <span style="color:red">inline red text</span> and a <a href="#">link</a> in the same line.</p>Block A and Block B appear on separate lines, each spanning the full width. The
<span>and<a>stay inside the paragraph's line.Effect on layout and rendering
- Block elements build the page structure: stacking sections, headings, paragraphs, and lists vertically.
- Inline elements style or link parts of text without breaking the flow.
- The box model (margin, border, padding, width, height) applies fully to blocks; for inline elements only horizontal spacing works.
- Line-height and baseline alignment govern how inline items are laid out; whitespace between inline elements shows as a small gap.
- CSS
displaycan change behaviour:display:blockmakes an inline element behave like a block.display:inlinedoes the reverse.display:inline-blockflows in a line but accepts width and height (useful for buttons and nav items).display:flex/gridcreate modern layouts.
a.button { display: inline-block; width: 120px; padding: 8px; }Choosing correctly avoids layout bugs such as unexpected line breaks or ignored width/height.
Q2(b). Explain middleware in Client/Server computing and discuss its role in communication between clients and servers.20267m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Explain middleware in Client/Server computing and discuss its role in communication between clients and servers.
Worked SolutionMiddleware in Client/Server Computing
Middleware is a software layer between applications and the underlying operating system/network. It enables distributed components to communicate through reusable services.
Main roles
- Communication: supports request-response calls, messaging and remote procedure/object calls.
- Abstraction: hides differences in network protocols, operating systems and internal implementation.
- Service discovery: helps locate remote services.
- Security integration: supports authentication and authorization.
- Transactions: coordinates reliable operations involving multiple components or databases.
- Asynchronous messaging: queues messages when a receiver is temporarily unavailable.
- Monitoring and scalability: may provide logging, connection pooling and load balancing.
MermaidDiagramRendering diagram…For example, an online store can call an order service without managing low-level network communication or directly opening database connections.
Advantages: reduces duplicated infrastructure code, improves interoperability and maintainability. Limitations: adds latency, configuration complexity and another component that must be secured and monitored.
Conclusion: Middleware simplifies client/server communication by providing common services between distributed applications.
Q2(b). How can CSS be used to display a XML document? Illustrate with an example.20237m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →How can CSS be used to display a XML document? Illustrate with an example.
Worked SolutionDisplaying XML with CSS
XML has no predefined tags, so a browser does not know how to show them. CSS supplies the presentation: link a stylesheet to the XML file with a processing instruction, then style each element by its tag name.
Step 1: link the stylesheet in the XML file
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="books.css"?> <library> <book> <title>Web Technology</title> <author>A. Kumar</author> <price>450</price> </book> <book> <title>Data Mining</title> <author>S. Rao</author> <price>520</price> </book> </library>Step 2: write books.css
library { display: block; font-family: Arial, sans-serif; } book { display: block; margin: 10px; padding: 8px; border: 1px solid #999; } title { display: block; font-size: 20px; font-weight: bold; color: #1a4fa0; } author { display: block; font-style: italic; } price { display: block; color: green; }The
displayproperty is essential because XML elements have no default display type. Without it, the content appears as one unformatted line.Limitations: CSS cannot reorder, filter, or compute content or add text; for that, XSLT is used.
Q2a. Compare Client/Server computing with N-tiered architecture using suitable diagrams.20257m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Compare Client/Server computing with N-tiered architecture using suitable diagrams.
Worked SolutionAnswer: Client/Server Computing vs N-Tiered Architecture
1. Client/Server Computing
Client/Server (C/S) computing is a distributed architecture in which the application is divided mainly into a client and a server. The client requests a service and the server processes the request and returns the result.
+---------+ Request +---------+ | Client | ------------------> | Server | | (UI) | <------------------ | | +---------+ Response +---------+Client
- Provides the user interface.
- Accepts input from the user.
- Sends requests to the server.
- Displays the result returned by the server.
Server
- Receives client requests.
- Processes application/business operations.
- Accesses databases or other resources.
- Sends the result back to the client.
2. N-Tiered Architecture
N-tier architecture divides an application into multiple logical tiers, with each tier having a specific responsibility. A common example is three-tier architecture.
+-----------------------+ | Presentation Tier | | HTML / CSS / Browser | +-----------+-----------+ | v +-----------------------+ | Business Tier | | Application Logic | +-----------+-----------+ | v +-----------------------+ | Data Tier | | Database / Data Access| +-----------------------+Presentation Tier
Handles interaction with the user. Examples include HTML, CSS, JavaScript and the web browser.
Business Logic Tier
Contains application rules and processing such as validation, authentication and calculations.
Data Tier
Handles storing, retrieving and managing data using databases and data-access components.
3. Comparison
Client/Server N-Tier Architecture Usually has two major parts: client and server. Divides the application into multiple logical tiers. Business logic may be placed in the client or server. Business logic normally has a dedicated tier. Simpler architecture. More structured architecture. Less suitable for very large applications. Better suited for large and complex web applications. Maintenance can become difficult when responsibilities are mixed. Easier maintenance because responsibilities are separated. Scaling can be more difficult. Individual tiers can be scaled independently. 4. Advantages of N-Tier Architecture
- Separation of concerns: Each tier performs a specific responsibility.
- Maintainability: Changes in one tier have less impact on other tiers.
- Scalability: Individual tiers can be scaled according to demand.
- Security: Sensitive data and database access can be isolated in lower tiers.
- Reusability: Business and data-access components can be reused by different clients.
Conclusion
Client/Server computing provides a simple distributed model in which clients communicate directly with servers. N-tier architecture extends this idea by separating presentation, business logic and data management into independent tiers. Therefore, N-tier architecture provides better scalability, maintainability, security and flexibility for modern web applications.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q2a. Explain about domain name, IP address and WWW.20207m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Explain about domain name, IP address and WWW.
Worked SolutionAnswer: Domain Name, IP Address, and the World Wide Web (WWW)
1. Introduction
The internet relies on standardized addressing systems and information retrieval architectures to enable global communication between millions of interconnected computers. IP Addresses, Domain Names, and the World Wide Web (WWW) form the core foundation of this ecosystem.
+-------------------+ DNS Resolution +-------------------+ | Domain Name | ------------------------> | IP Address | | (www.example.com) | <------------------------ | (93.184.216.34) | +-------------------+ +---------+---------+ | | | HTTP/HTTPS Request | Connects over +-----------------------------------------------> TCP/IP Network | +---------v---------+ | WWW Resource | | (Web Page / HTML) | +-------------------+
2. IP Address (Internet Protocol Address)
An IP address is a unique numerical identifier assigned to every device connected to a computer network that uses the Internet Protocol for communication.
Key Characteristics:
- Addressing & Routing: Acts as a network identifier and location address to deliver packets to their destination.
- Versions of IP:
- IPv4 (32-bit): Formatted as 4 octets separated by dots (e.g.,
192.168.1.1). Provides addresses. - IPv6 (128-bit): Formatted as 8 groups of hexadecimal digits separated by colons (e.g.,
2001:0db8:85a3::8a2e:0370:7334) to overcome IPv4 exhaustion.
- IPv4 (32-bit): Formatted as 4 octets separated by dots (e.g.,
- Static vs. Dynamic IP:
- Static IP: Permanent address configured for servers.
- Dynamic IP: Temporarily leased address assigned by DHCP.
3. Domain Name
A Domain Name is a human-readable alias used to access websites without needing to remember numeric IP addresses (e.g.,
google.cominstead of142.250.190.46).Structure of a Domain Name:
https:// subdomain . second-level-domain . top-level-domain (TLD) ( www . example . com )- Top-Level Domain (TLD): Generic (
.com,.org,.edu) or country-code (.in,.uk,.us). - Second-Level Domain (SLD): The organization or brand name (
google,wikipedia). - Subdomain: Specific section or server (
mail.google.com,api.example.com).
DNS (Domain Name System):
The global hierarchical database that translates human-friendly domain names into machine-routable IP addresses.
4. WWW (World Wide Web)
Invented in 1989 by Tim Berners-Lee at CERN, the World Wide Web (WWW) is an interconnected system of public hypertext documents and multimedia resources accessible over the Internet via the HTTP/HTTPS protocol.
Core Architectural Pillars of the WWW:
- URI/URL (Uniform Resource Locator): Standardized global address to locate any document (e.g.,
https://www.example.com/index.html). - HTTP/HTTPS: The application-layer communication protocol for exchanging web documents.
- HTML (HyperText Markup Language): The standard formatting language used to structure web content and hyperlinks.
- Web Browsers & Web Servers: The client software that renders pages and the server software that delivers them.
5. Summary Comparison
Concept Nature Function Example IP Address Numerical identifier Identifies physical machine on network 142.250.190.46Domain Name Human-friendly text name Mapped to IP for user convenience www.google.comWWW Global information system Application running on the Internet Web pages, hypermedia, web apps Q2a. What, if there is no text between the tags or if a text was omitted by mistake, will it affect the display of the HTML file? Explain with the help of example.20197m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What, if there is no text between the tags or if a text was omitted by mistake, will it affect the display of the HTML file? Explain with the help of example.
Worked SolutionAnswer: Effect of Empty Tags and Omitted Text in HTML Display
1. Core Principle of HTML Parsing
HTML parsers in modern web browsers are designed to be fault-tolerant and permissive. When a browser encounters an HTML tag with no text enclosed between its opening and closing tags (
<tag></tag>), or if content is omitted by mistake, it handles it in specific predictable ways depending on the type of element:+-----------------------------+ | EMPTY / OMITTED TAGS | +--------------+--------------+ | +------------------------+------------------------+ | | v v +--------------------+ +--------------------+ | Container Elements| | Void/Empty Elements| | <p></p>, <b></b> | | <br>, <hr>, <img> | | (Rendered as blank)| | (Self-contained) | +--------------------+ +--------------------+
2. Impact on Webpage Display
A. Non-Visual / Zero-Dimension Rendering
- For standard inline and block-level text formatting tags (such as
<p></p>,<b></b>,<i></i>,<span></span>,<h1></h1>), having no text inside results in an element with zero inner text content. - Inline tags (like
<b></b>or<span></span>) take up pixels on the screen, causing no visible impact or distortion to surrounding text.
B. Impact on Vertical Spacing and Margins (Block Elements)
- While empty text tags are invisible, empty block-level elements (like
<p></p>or<div></div>or<h1></h1>) still retain their default browser margin and padding rules (unless overridden by CSS). - An empty
<p></p>may introduce unexpected vertical empty white space (line gaps) between adjacent paragraphs.
C. Structural and Table Elements
- An empty table cell
<td></td>or table row<tr></tr>may collapse or render as a blank border square, potentially altering column alignment if table styling is not fixed.
3. Illustrative HTML Example
<!DOCTYPE html> <html> <head> <title>Empty Tags Test</title> <style> .highlight { border: 1px dashed red; } </style> </head> <body> <!-- Example 1: Empty inline bold and italic tags (No effect on text) --> <p>This is <b></b> a sample sentence with <i></i> omitted text.</p> <!-- Output: "This is a sample sentence with omitted text." (Normal spacing) --> <!-- Example 2: Empty block tags (Introduces vertical whitespace gap) --> <p>Paragraph 1: Introduction to Web Design.</p> <p class="highlight"></p> <!-- Empty tag with margins --> <p>Paragraph 2: Continuing after empty block.</p> <!-- Example 3: Empty heading tag --> <h2 class="highlight"></h2> <!-- Collapses vertically, zero width --> <!-- Example 4: Empty table cell --> <table border="1"> <tr> <td>Student Name</td> <td>Marks</td> </tr> <tr> <td>Rohan Kumar</td> <td></td> <!-- Empty data cell: renders as empty box --> </tr> </table> </body> </html>
4. Key Takeaways
- No Fatal Parser Crash: Omitting text inside HTML tags will not throw an error or crash the page rendering.
- Invisible Inline Tags: Inline tags without content produce zero visual footprint.
- Ghost Spacing: Empty block elements (
<p>,<div>,<h1>-<h6>) can produce unwanted vertical spacing due to default user-agent stylesheets. - Best Practice: Remove empty and redundant tags during code cleanup and minification to keep DOM trees light and maintain valid semantic structure.
- For standard inline and block-level text formatting tags (such as
Q2b. Describe the HTML code required for adding a form to a Web page.20197m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Describe the HTML code required for adding a form to a Web page.
Worked SolutionAnswer: HTML Code and Elements for Adding a Form to a Web Page
1. Introduction to HTML Forms
An HTML Form is a section of a document containing interactive controls used to collect user data (such as login credentials, registration details, feedback, or payment inputs) and send that data to a server for processing.
2. The
<form>Element and Core Attributes<form action="/submit-handler.php" method="POST" enctype="multipart/form-data"> <!-- Form Controls Go Here --> </form>Essential Form Attributes:
action: Specifies the destination URL (server script, e.g., PHP, Servlet, API endpoint) where the form data is sent upon submission.method: The HTTP transfer method used to send data:GET: Appends form data to the URL query string (e.g.,/search?q=java). Used for idempotent searches (not for passwords/sensitive data).POST: Sends form data in the HTTP request body. Used for secure, large, or state-modifying operations (login, registration, payments).
enctype: Defines the MIME encoding type of the data:application/x-www-form-urlencoded(default for text).multipart/form-data(mandatory for file uploads).
3. Major Form Controls and Input Elements
Form Element Description Code Example Text Input Single-line alphanumeric text box <input type="text" name="fullname" required>Password Masks characters with dots/asterisks <input type="password" name="pwd">Email Validates email syntax <input type="email" name="useremail">Radio Button Selects a single option from a group <input type="radio" name="gender" value="male"> MaleCheckbox Selects multiple independent options <input type="checkbox" name="skills" value="Java"> JavaDropdown List Selectable dropdown menu <select name="country"><option value="IN">India</option></select>Textarea Multi-line text entry box <textarea name="comments" rows="4"></textarea>File Upload Selects local files for upload <input type="file" name="resume">Submit Button Submits the form data <input type="submit" value="Submit Form">Reset Button Resets form inputs to defaults <input type="reset" value="Clear">
4. Comprehensive Working HTML Form Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Student Registration Form</title> <style> .form-container { width: 420px; padding: 20px; border: 1px solid #ccc; font-family: Arial, sans-serif; } .form-group { margin-bottom: 15px; } label { display: block; font-weight: bold; margin-bottom: 5px; } input[type="text"], input[type="email"], input[type="password"], select, textarea { width: 100%; padding: 8px; box-sizing: border-box; } </style> </head> <body> <div class="form-container"> <h2>Student Registration</h2> <form action="/register" method="POST" enctype="multipart/form-data"> <!-- Text Input with Label --> <div class="form-group"> <label for="name">Full Name:</label> <input type="text" id="name" name="student_name" placeholder="Enter full name" required> </div> <!-- Email Input --> <div class="form-group"> <label for="email">Email Address:</label> <input type="email" id="email" name="student_email" placeholder="name@example.com" required> </div> <!-- Password Input --> <div class="form-group"> <label for="password">Password:</label> <input type="password" id="password" name="student_password" required> </div> <!-- Radio Buttons --> <div class="form-group"> <label>Gender:</label> <input type="radio" id="male" name="gender" value="male"> <label for="male" style="display:inline;">Male</label> <input type="radio" id="female" name="gender" value="female"> <label for="female" style="display:inline;">Female</label> </div> <!-- Select Dropdown --> <div class="form-group"> <label for="course">Branch / Course:</label> <select id="course" name="branch"> <option value="CSE">Computer Science & Engineering</option> <option value="ECE">Electronics & Communication</option> <option value="EE">Electrical Engineering</option> <option value="ME">Mechanical Engineering</option> </select> </div> <!-- Textarea --> <div class="form-group"> <label for="address">Address:</label> <textarea id="address" name="student_address" rows="3"></textarea> </div> <!-- Submit & Reset Buttons --> <div class="form-group"> <input type="submit" value="Register Now"> <input type="reset" value="Reset Form"> </div> </form> </div> </body> </html>Q2b. What is SGML? Explain how HTML, XML, and XSL are related to SGML and used in web development.20257m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What is SGML? Explain how HTML, XML, and XSL are related to SGML and used in web development.
Worked SolutionAnswer: SGML and Its Relationship with HTML, XML, and XSL
1. What is SGML?
SGML (Standard Generalized Markup Language) is an international standard (ISO 8879:1986) metalanguage used to define descriptive markup languages for electronic documents.
- SGML separates document structure, content, and presentation.
- It provides rules for creating custom tags, attributes, and structural rules through a Document Type Definition (DTD).
- Although powerful and highly flexible, SGML is complex and heavy, making direct interpretation in lightweight web browsers difficult.
+------------------------+ | SGML | | (ISO 8879 Metalanguage)| +-----------+------------+ | +-----------------+-----------------+ | | (Application of SGML) (Subset of SGML) v v +---------------+ +---------------+ | HTML | | XML | | (Fixed Tags) | | (Custom Tags) | +---------------+ +-------+-------+ | (Stylesheet for XML) v +---------------+ | XSL | | (XSLT/XSL-FO)| +---------------+
2. Relationship with HTML, XML, and XSL
A. HTML (HyperText Markup Language)
- Relationship: HTML is an application of SGML. It is defined by a predefined SGML DTD.
- Characteristics:
- Has a fixed, predefined set of tags (
<h1>,<p>,<a>,<table>). - Primarily designed for displaying data and formatting user interfaces in web browsers.
- More lenient syntax (e.g., closing tags were optional in earlier HTML versions).
- Has a fixed, predefined set of tags (
- Role in Web Development: Acts as the standard structural language for all web pages delivered across the internet.
B. XML (eXtensible Markup Language)
- Relationship: XML is a simplified, strict subset of SGML designed by the W3C specifically for the World Wide Web.
- Characteristics:
- Has no predefined tags; developers create domain-specific tags describing data semantics.
- Strict syntax rules: all tags must close, case-sensitive, proper nesting, and root element required.
- Focuses on storing and transporting data, completely independent of presentation.
- Role in Web Development: Used for data exchange between heterogeneous platforms, web services (REST/SOAP), configuration files, and feeds (RSS).
C. XSL (eXtensible Stylesheet Language)
- Relationship: XSL is a family of recommendations written in XML to transform and style XML documents.
- Major Components:
- XSLT (XSL Transformations): Transforms XML documents into HTML, plain text, or another XML structure.
- XPath (XML Path Language): Navigates elements and attributes in XML documents.
- XSL-FO (XSL Formatting Objects): Formats XML data for output media such as PDF or print.
- Role in Web Development: Converts raw server-side XML data into styled HTML pages for display in browsers or transforms data between distinct API schemas.
3. Comparison Table
Feature SGML HTML XML XSL Type Metalanguage Markup Language Simplified Metalanguage / Data format Stylesheet & Transformation language Origin ISO 8879 (1986) SGML Application SGML Subset (W3C 1998) XML Application (W3C) Tags User-defined via DTD Fixed & Predefined User-defined Predefined XSL elements Primary Goal Document definition standard Web page presentation Data storage & transport XML transformation & styling Syntax Strictness Highly complex Relaxed / Lenient Very strict (Well-formed) Very strict (Well-formed XML)
Conclusion
SGML provided the foundational theory of structured markup. HTML applied SGML for web presentation, while XML simplified SGML for structured data exchange. XSL complements XML by providing the presentation and transformation rules needed to render XML data in modern web environments.
Q2b. What are logical and physical tags in HTML? What is CSS?20207m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What are logical and physical tags in HTML? What is CSS?
Worked SolutionAnswer: Physical vs Logical Tags in HTML and Introduction to CSS
1. Physical vs. Logical Tags in HTML
HTML tags used for formatting text are historically categorized into Physical Tags and Logical Tags:
+-----------------------------+ | HTML FORMATTING TAGS | +--------------+--------------+ | +------------------------+------------------------+ | | v v +--------------------+ +--------------------+ | PHYSICAL TAGS | | LOGICAL TAGS | | (Visual Appearance)| | (Semantic Meaning) | | <b>, <i>, <u> | | <strong>, <em> | +--------------------+ +--------------------+
A. Physical Tags
- Definition: Physical tags tell the browser strictly how to visually render the enclosed text (its appearance/style) without conveying any semantic meaning, importance, or context.
- Characteristics: Focused entirely on visual layout; ignored by assistive screen readers in terms of vocal inflection.
- Examples:
<b>Text</b>: Renders text in bold style.<i>Text</i>: Renders text in italicized style.<u>Text</u>: Underlines the text.<s>Text</s>or<strike>: Renders text with a strikethrough line.<tt>Text</tt>: Displays text in fixed-width teletype font.<sub>/<sup>: Subscript and superscript formatting.
B. Logical Tags (Semantic Tags)
- Definition: Logical tags describe the semantic meaning, purpose, or structural importance of the enclosed content to the browser, search engines, and screen readers.
- Characteristics: The browser standardly provides default formatting (e.g.,
<strong>is bolded,<em>is italicized), but screen readers adjust voice tone and emphasis accordingly. - Examples:
<strong>Text</strong>: Indicates strong importance or urgency (default rendered as bold).<em>Text</em>: Indicates emphasized stress (default rendered as italic).<code>Text</code>: Defines a snippet of computer code (monospace).<cite>Text</cite>: References the title of a creative work or author.<mark>Text</mark>: Highlights relevant text for reference.<abbr title="World Health Organization">WHO</abbr>: Defines an abbreviation or acronym.
C. Comparison Table
Parameter Physical Tags Logical (Semantic) Tags Focus Visual appearance and styling Meaning, context, and structural value Accessibility (Screen Readers) Treated as normal text without vocal change Read with appropriate vocal stress and emphasis SEO Impact Minimal search engine value High value for search engine indexers W3C Recommendation Deprecated in modern HTML5 (use CSS instead) Strongly recommended in modern semantic HTML Examples <b>,<i>,<u>,<tt>,<big><strong>,<em>,<code>,<cite>,<abbr>
2. What is CSS (Cascading Style Sheets)?
CSS (Cascading Style Sheets) is a style sheet language used to describe the visual presentation, layout, colors, typography, and responsive design of a document written in HTML or XML.
CSS Rule Syntax:
/* Selector { Property: Value; } */ h1 { color: #b23a2e; font-size: 24px; text-align: center; }Three Ways to Apply CSS in HTML:
- Inline CSS: Applied directly to an element via the
styleattribute:<p style="color: red; font-size: 14px;">Inline Styled Text</p> - Internal (Embedded) CSS: Written inside
<style>tags within the<head>section:<style> body { background-color: #f5f6f2; } </style> - External CSS (Best Practice): Stored in a separate
.cssfile and linked in<head>:<link rel="stylesheet" href="styles.css">
Key Benefits of CSS:
- Separation of Content and Design: Keeps HTML clean and easy to maintain.
- Faster Page Load: External stylesheets are cached by browsers.
- Responsive Layouts: Media queries (
@media) allow dynamic adaptation across mobile, tablet, and desktop viewports.
Q3(a). Discuss markup languages and their grammars. Explain the role of SGML, HTML, CSS, XML and XSL in web technologies.20267m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Discuss markup languages and their grammars. Explain the role of SGML, HTML, CSS, XML and XSL in web technologies.
Worked SolutionMarkup Languages and Their Grammars
A markup language uses tags or annotations to describe a document's structure or meaning. Its grammar defines legal elements, attributes, nesting and syntax; a parser checks documents against these rules.
- SGML: Standard Generalized Markup Language, a metalanguage used to define markup languages and document structures. HTML historically derived from SGML.
- HTML: describes web-page structure using elements such as headings, paragraphs, links, forms and images.
- CSS: a style-sheet language, not a markup language. It controls presentation, including colour, spacing, layout and responsive design.
- XML: defines custom tags for structured data exchange. XML documents must be properly nested and well-formed.
- XSL: a family of XML technologies. XSLT transforms XML into other formats; XPath selects nodes; XSL-FO supports formatted output.
SVGVector Architecture Diagram (SVG)Conclusion: HTML structures pages, CSS styles them, XML represents structured data, and XSL technologies transform or format XML. Their rules help software interpret content consistently.
Q3(a). What is N-tier software architecture? Explain its benefits and how it improves scalability and maintainability in web applications.20247m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What is N-tier software architecture? Explain its benefits and how it improves scalability and maintainability in web applications.
Worked SolutionN-tier architecture
N-tier (multi-tier) architecture divides an application into separate logical layers (tiers), each with one responsibility, that communicate only with adjacent layers. Tiers can run on the same machine or on different servers.
Presentation tier (browser, React/HTML UI) | Application / Business-logic tier (Node.js, Java, PHP server) | Data-access tier (ORM, DAO, API) | Data tier (MySQL, MongoDB)Common forms: 2-tier (client + database), 3-tier (presentation, logic, data), and larger N-tier with extra layers such as caching, API gateway, and messaging.
Tiers explained
- Presentation: displays data and captures user input.
- Business logic: rules, validation, processing, authentication.
- Data access / data: stores and retrieves persistent data.
Benefits
- Separation of concerns: each layer has a clear role.
- Independent development: teams work on UI, logic, and data separately.
- Reusability: the same business logic serves web, mobile, and other clients.
- Security: the database is not exposed directly to clients; only the logic tier reaches it.
- Flexibility: technology in one tier (e.g. the database) can be swapped with little effect on others.
- Easier testing: each tier can be tested in isolation.
How it improves scalability
- Each tier can be scaled independently: add more app servers behind a load balancer when traffic rises, or add database replicas for reads.
- Resource-heavy tiers can be placed on stronger machines.
- Caching and message queues between tiers absorb load spikes.
- Stateless application tiers make horizontal scaling straightforward.
How it improves maintainability
- A change in one tier (e.g. redesigning the UI) does not force changes in others.
- Bugs are easier to locate because responsibilities are isolated.
- Loose coupling through defined interfaces (REST APIs) allows components to be upgraded or replaced.
- Consistent structure makes the code easier to understand and extend.
Trade-offs: more components mean added complexity, network latency between tiers, and more deployment effort.
Q3(b). Explain the role of DTD in defining the structure of an XML document and discuss its relationship with XML.20267m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Explain the role of DTD in defining the structure of an XML document and discuss its relationship with XML.
Worked SolutionDTD and XML
A Document Type Definition (DTD) specifies the permitted structure of an XML document. It declares allowed elements and attributes, their order and repetition, and entities. XML conforming to its DTD is valid; a well-formed XML document only needs to obey XML syntax.
Example:
<!DOCTYPE student [ <!ELEMENT student (name, roll)> <!ELEMENT name (#PCDATA)> <!ELEMENT roll (#PCDATA)> ]> <student> <name>Raiyan</name> <roll>106</roll> </student>Here, a student element must contain name followed by roll; each contains parsed character data.
Types
- Internal DTD: declarations appear inside the XML document's DOCTYPE.
- External DTD: declarations are stored in a separate DTD file and referenced by the XML document.
Importance: DTDs standardize document structure, enable validators to detect missing or unexpected elements, document data expectations and support reusable entity declarations.
Limitations: DTD syntax is not itself XML, data types are limited, and namespace support is weak compared with XML Schema (XSD).
Remember: well-formed means syntactically correct XML; valid means well-formed XML that also conforms to a declared DTD or schema.
Q4. What are various Internet Addressing modes? Explain.202314m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What are various Internet Addressing modes? Explain.
Worked SolutionInternet addressing modes
Every device on the Internet needs an address so data can be delivered to it. Addressing works at four levels: physical (MAC), logical (IP), port, and domain name.
1. Physical (MAC) address
- 48-bit hardware address burned into the network card, written in hex (e.g.
00:1A:2B:3C:4D:5E). - Works at the Data Link layer and identifies a device inside a local network.
2. Logical (IP) address
Works at the Network layer and identifies a host across networks.
IPv4: 32 bits, written in dotted decimal (e.g.
192.168.1.10), about 4.3 billion addresses.Class First octet range Use A 1–126 Very large networks (8-bit network, 24-bit host) B 128–191 Medium networks (16/16) C 192–223 Small networks (24/8) D 224–239 Multicast E 240–255 Reserved / experimental IPv6: 128 bits, written in hex groups (e.g.
2001:0db8::1), a vastly larger address space.Address types by delivery:
- Unicast: one sender to one receiver.
- Broadcast: one to all hosts in a network.
- Multicast: one to a selected group.
- Anycast (IPv6): one to the nearest of a group.
Private vs public: private ranges (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) are used inside LANs; public addresses are globally routable. NAT translates between them.3. Port address
- 16-bit number (0–65535) at the Transport layer that identifies the application/process on a host.
- Examples: HTTP 80, HTTPS 443, FTP 21, SMTP 25, DNS 53.
- Socket address = IP address + port, e.g.
192.168.1.10:80.
4. Domain names (URL/DNS addressing)
- Humans use names like
www.example.com; DNS translates them to IP addresses. - A URL gives the full address of a resource:
protocol://host:port/path?query#fragment.
Summary
Level Address Layer Size Physical MAC Data Link 48 bits Logical IPv4 / IPv6 Network 32 / 128 bits Port Port number Transport 16 bits Name Domain / URL Application text - 48-bit hardware address burned into the network card, written in hex (e.g.
Q4(b). Explain the tags to create different types of lists using relevant HTML code. Additionally, apply CSS properties to change the text color, font size, and list style type.20247m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Explain the tags to create different types of lists using relevant HTML code. Additionally, apply CSS properties to change the text color, font size, and list style type.
Worked SolutionTypes of HTML lists
1. Unordered list
<ul>(bulleted)<ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul>2. Ordered list
<ol>(numbered)Attributes:
type(1, A, a, I, i),start,reversed.<ol type="1"> <li>Design</li> <li>Develop</li> <li>Deploy</li> </ol>3. Description (definition) list
<dl><dt>is the term and<dd>is its description.<dl> <dt>HTML</dt> <dd>Markup language for web pages</dd> <dt>CSS</dt> <dd>Language for styling pages</dd> </dl>Lists can also be nested by placing a
<ul>or<ol>inside an<li>.Applying CSS: colour, font size, list style
<!DOCTYPE html> <html> <head> <style> /* unordered list */ ul.tech { color: darkblue; /* text colour */ font-size: 18px; /* font size */ list-style-type: square; /* bullet style */ } /* ordered list */ ol.steps { color: crimson; font-size: 20px; list-style-type: upper-roman; /* I, II, III */ } /* description list */ dl dt { color: green; font-size: 19px; font-weight: bold; } dl dd { color: #555; font-size: 16px; } /* no bullets, e.g. for menus */ ul.plain { list-style-type: none; padding: 0; } </style> </head> <body> <ul class="tech"> <li>HTML</li><li>CSS</li><li>JavaScript</li> </ul> <ol class="steps"> <li>Design</li><li>Develop</li><li>Deploy</li> </ol> <dl> <dt>HTML</dt><dd>Markup language</dd> </dl> </body> </html>Useful
list-style-typevaluesFor Values uldisc,circle,square,noneoldecimal,lower-alpha,upper-alpha,lower-roman,upper-romanOther helpers:
list-style-image: url(icon.png)for custom bullets andlist-style-position: inside | outside.- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q4a. What do you understand by working layer in DHTML? Explain with the help of example.20197m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What do you understand by working layer in DHTML? Explain with the help of example.
Worked SolutionAnswer: Working with Layers in DHTML
1. What is a "Layer" in DHTML?
In Dynamic HTML (DHTML), a Layer refers to an independent, positioning-enabled rectangular content container (typically a
<div>element styled with CSS positioning) that exists on its own distinct plane above or below other page content.Layers enable overlapping content, 3D depth stacking (-indexing), dynamic visibility toggling, and animation across the coordinate plane without requiring full-page reloads.
+-----------------------------------+ | Top Layer (Z-Index: 3) | | (Dropdown / Modal / Tooltip) | +-----------------+-----------------+ | +--------------------------v------------------------+ | Middle Layer (Z-Index: 2) | | (Sidebar / Menu) | +--------------------------+------------------------+ | +-----------------------------------v-----------------------------------+ | Base Layer (Z-Index: 1) | | (Main Web Page Text) | +-----------------------------------------------------------------------+
2. Core CSS & DOM Properties Governing DHTML Layers
position: Enables coordinate positioning (absolute,relative, orfixed).top,left,right,bottom: Specifies exact 2D pixel coordinates of the layer relative to its container or viewport.z-index: Specifies the 3D stacking order along the Z-axis. Elements with higher integer values render on top of elements with lower values.visibility&display: Toggles visual appearance (visibility: visible/hiddenordisplay: block/none).overflow&clip: Controls whether content overflowing the layer's boundaries is clipped or scrollable.
3. Working Mechanism of DHTML Layers
A working DHTML layer is realized through three cooperating layers of technology:
- HTML: Defines the layer structure (
<div id="myLayer">). - CSS: Establishes initial positioning, dimensions, background color, and z-index.
- JavaScript: Dynamically alters style coordinates and visibility properties in response to user events (
element.style.left,element.style.display).
4. Complete Working DHTML Layer Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DHTML Layers Demo</title> <style> body { font-family: Arial, sans-serif; } /* Base Layer (Normal Document Flow) */ .base-content { background-color: #ebede7; padding: 20px; width: 500px; border: 1px solid #ccc; } /* Floating Interactive Layer */ #popupLayer { position: absolute; top: 80px; left: 120px; width: 280px; padding: 15px; background-color: #ffffff; border: 2px solid #b23a2e; box-shadow: 0 4px 12px rgba(0,0,0,0.25); z-index: 100; /* Stacks above base content */ display: none; /* Initially hidden */ } </style> </head> <body> <div class="base-content"> <h2>Main Webpage Content (Base Layer)</h2> <p>This text resides on the base layer of the webpage. DHTML layers can overlay this text dynamically.</p> <button onclick="toggleLayer()">Toggle Floating Layer</button> <button onclick="moveLayer()">Move Layer Right</button> </div> <!-- DHTML Layer --> <div id="popupLayer"> <h3 style="margin-top:0; color:#b23a2e;">Floating DHTML Layer</h3> <p>I am an independent layer positioned above the base content using CSS z-index and absolute positioning.</p> <button onclick="toggleLayer()">Close Layer</button> </div> <script> const layer = document.getElementById("popupLayer"); let currentLeft = 120; // Toggle Visibility function toggleLayer() { if (layer.style.display === "block") { layer.style.display = "none"; } else { layer.style.display = "block"; } } // Dynamic Coordinate Animation function moveLayer() { if (layer.style.display !== "block") layer.style.display = "block"; currentLeft += 40; layer.style.left = currentLeft + "px"; // Dynamically update X-coordinate } </script> </body> </html>
5. Applications of DHTML Layers
- Modal Dialogs and Lightbox Popups
- Dropdown & Flyout Navigation Menus
- Floating Tooltips and Context Menus
- Interactive Draggable Widgets & Games
Q4b. How can you do dragging and dropping data using DHTML? Explain with example.20197m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →How can you do dragging and dropping data using DHTML? Explain with example.
Worked SolutionAnswer: Dragging and Dropping Data Using DHTML / HTML5
1. Introduction
Drag and Drop (DnD) is an interactive user interface feature in DHTML/HTML5 that allows a user to click and hold the mouse button over an element, drag it across the screen, and release (drop) it onto a designated target container.
+-------------------+ +-------------------+ | Draggable Source | | Drop Target | | (Item Box) | | (Bucket) | +---------+---------+ +---------+---------+ | | | 1. ondragstart | | (dataTransfer.setData('text', id)) | |==================== [User Drags Item] ===================>| | | | | 2. ondragover | | (event.preventDefault()) | | | | 3. ondrop | | (dataTransfer.getData('text')) v v
2. The Drag and Drop Event Cycle
A. Events on the Draggable Source:
dragstart: Fires when the user begins dragging the element. Used to populate thedataTransferpayload.drag: Fires continuously while the element is being dragged.dragend: Fires when the drag operation completes (released or cancelled).
B. Events on the Drop Target:
dragenter: Fires when the dragged item enters the drop zone boundary.dragover: Fires continuously while the dragged item hovers over the drop zone. Must callevent.preventDefault()to allow dropping.dragleave: Fires when the dragged item leaves the drop zone boundary.drop: Fires when the dragged element is released onto the drop target.
3. The
DataTransferObjectThe
event.dataTransferobject holds the payload transferred during the drag operation:setData(format, data): Sets the drag data and MIME type (e.g.,event.dataTransfer.setData("text/plain", e.target.id)).getData(format): Retrieves the stored data during thedropevent.
4. Complete Working DHTML Code Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DHTML Drag and Drop Demo</title> <style> body { font-family: Arial, sans-serif; } .container { display: flex; gap: 30px; margin-top: 20px; } /* Drop Zone Containers */ .drop-box { width: 220px; min-height: 220px; padding: 15px; border: 2px dashed #5b6472; background-color: #f5f6f2; border-radius: 8px; } .drop-box.hovered { border-color: #b23a2e; background-color: #efe9de; } /* Draggable Item */ .drag-item { padding: 12px; margin: 8px 0; background-color: #1f4b43; color: #ffffff; font-weight: bold; border-radius: 4px; cursor: grab; text-align: center; } .drag-item:active { cursor: grabbing; opacity: 0.6; } </style> </head> <body> <h2>DHTML Drag and Drop Data Demo</h2> <p>Drag items between Box A and Box B:</p> <div class="container"> <!-- Box A --> <div id="boxA" class="drop-box" ondragover="allowDrop(event)" ondrop="handleDrop(event)" ondragleave="removeHover(event)"> <div id="item1" class="drag-item" draggable="true" ondragstart="handleDragStart(event)"> Item 1: JavaScript </div> <div id="item2" class="drag-item" draggable="true" ondragstart="handleDragStart(event)"> Item 2: HTML5 & CSS3 </div> </div> <!-- Box B --> <div id="boxB" class="drop-box" ondragover="allowDrop(event)" ondrop="handleDrop(event)" ondragleave="removeHover(event)"> <div id="item3" class="drag-item" draggable="true" ondragstart="handleDragStart(event)"> Item 3: Java Servlets </div> </div> </div> <script> // 1. Drag Start: Store element ID in dataTransfer function handleDragStart(event) { event.dataTransfer.setData("text/plain", event.target.id); event.dataTransfer.effectAllowed = "move"; } // 2. Drag Over: Must preventDefault to permit dropping function allowDrop(event) { event.preventDefault(); event.currentTarget.classList.add("hovered"); } function removeHover(event) { event.currentTarget.classList.remove("hovered"); } // 3. Drop: Retrieve element and append to new parent function handleDrop(event) { event.preventDefault(); event.currentTarget.classList.remove("hovered"); const draggedElementId = event.dataTransfer.getData("text/plain"); const draggedNode = document.getElementById(draggedElementId); if (draggedNode && event.currentTarget.classList.contains("drop-box")) { event.currentTarget.appendChild(draggedNode); } } </script> </body> </html>Q7. Explain simple and complex data types in XML with suitable example?202314m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Explain simple and complex data types in XML with suitable example?
Worked SolutionData types in XML Schema (XSD)
XML Schema defines the structure and data types of an XML document. Types are either simple or complex.
1. Simple types
A simple type holds only text/data. It has no child elements and no attributes.
Built-in simple types:
xs:string,xs:integer,xs:decimal,xs:boolean,xs:date,xs:time,xs:float.<xs:element name="name" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="dob" type="xs:date"/>Matching XML:
<name>Ravi</name> <age>21</age> <dob>2004-05-12</dob>User-defined simple type (restriction):
<xs:simpleType name="marksType"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="100"/> </xs:restriction> </xs:simpleType> <xs:element name="marks" type="marksType"/>Simple types can also be created as a list or union of other types.
2. Complex types
A complex type may contain child elements, attributes, or both, so it describes structured data.
<xs:element name="student"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="marks" type="xs:integer"/> </xs:sequence> <xs:attribute name="roll" type="xs:string" use="required"/> </xs:complexType> </xs:element>Matching XML:
<student roll="CS101"> <name>Ravi</name> <age>21</age> <marks>88</marks> </student>Content models:
xs:sequence(fixed order),xs:choice(one of several),xs:all(any order). Complex types can also mix text and elements (mixed="true") or be empty with only attributes.Comparison
Feature Simple type Complex type Child elements No Yes Attributes No Yes Content Text value only Elements, attributes, or both Example <age>21</age><student roll="1">...</student>Reuse Named simpleTypeNamed complexTypeNote that an attribute itself always has a simple type.
Q8(a). External style sheets are usually preferred over other kinds of style sheets. Why?20237m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →External style sheets are usually preferred over other kinds of style sheets. Why?
Worked SolutionWhy external style sheets are preferred
CSS can be applied in three ways: inline (
style="..."on an element), internal (a<style>block in the page), and external (a separate.cssfile linked with<link rel="stylesheet" href="style.css">).Reasons for preferring external CSS
- Reusability: one file styles every page of the site.
- Easy maintenance: a change in one file updates the whole site instantly.
- Separation of concerns: HTML holds structure and content, CSS holds presentation, so both stay cleaner and readable.
- Faster loading through caching: the browser downloads the file once and caches it, so later pages load faster and use less bandwidth.
- Consistency: a uniform look and feel across all pages.
- Smaller HTML files: no repeated style code in each page.
- Team work: designers edit CSS while developers edit HTML.
- Media adaptability: different files or
mediaqueries can serve screen, print, or mobile.
Comparison
Type Scope Reuse Maintenance Inline One element None Hard Internal One page Single page Moderate External Whole website Full Easy <head> <link rel="stylesheet" href="styles/main.css"> </head>Minor drawback: an extra HTTP request on the first load, and the page may briefly appear unstyled if the file fails to load. The benefits far outweigh this.
Q9. Write short notes on the following : (a) HTML commands (b) DHTML dragging and drooping (c) AWT (d) JDBC202014m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Write short notes on the following :
(a) HTML commands
(b) DHTML dragging and drooping
(c) AWT
(d) JDBCWorked SolutionAnswer: Short Notes on Web & Java Technologies
(a) HTML Commands (Tags & Elements)
HTML (HyperText Markup Language) commands (commonly referred to as HTML tags and elements) are syntax keywords enclosed within angle brackets (
<tagname>) used to define the structure, content, and hypermedia links of a webpage.Core HTML Command Categories:
- Document Skeleton Commands:
<!DOCTYPE html>: Declares HTML5 document type.<html>,<head>,<body>: Defines the root, metadata, and visible document body.
- Text Formatting Commands:
<h1>to<h6>: Headings;<p>: Paragraph;<br>: Line break;<hr>: Horizontal rule.
- Hyperlinks & Media Commands:
<a href="...">: Creates clickable hyperlinks.<img src="..." alt="...">: Embeds images.
- Lists & Tables:
<ul>,<ol>,<li>: Unordered (bulleted) and ordered (numbered) lists.<table>,<tr>,<th>,<td>: Renders structured tabular data.
- Interactive Forms:
<form>,<input>,<select>,<button>,<textarea>: Collects user data.
(b) DHTML Dragging and Dropping
DHTML (Dynamic HTML) is not a standalone language, but rather the synergistic combination of HTML, CSS, JavaScript, and the Document Object Model (DOM) to create interactive, animated web pages.
Drag and Drop Mechanism:
Drag and Drop allows users to click, grab an onscreen element, drag it over a target zone, and drop it.
[Draggable Element] -- (dragstart) --> [Dragging Over Target] -- (drop) --> [Dropped Element] (draggable="true") (event.preventDefault()) (dataTransfer)Core HTML5 / DHTML Drag-and-Drop Events:
dragstart: Fires when the user starts dragging an element. Usesevent.dataTransfer.setData("text", target.id)to store data.dragover: Fires continuously when a dragged element is over a valid drop target. Must invokeevent.preventDefault()to allow dropping.drop: Fires when the dragged item is released over the drop target. Retrieves data viaevent.dataTransfer.getData("text").
<div id="dragItem" draggable="true" ondragstart="event.dataTransfer.setData('text', this.id)"> Drag Me </div> <div id="dropZone" ondragover="event.preventDefault()" ondrop="this.appendChild(document.getElementById(event.dataTransfer.getData('text')))"> Drop Zone </div>
(c) AWT (Abstract Window Toolkit)
AWT (
java.awt) is Java's original, platform-dependent Graphical User Interface (GUI) framework introduced in JDK 1.0.+-----------------------------+ | Component | +--------------+--------------+ | +------------------------+------------------------+ | | v v +--------------------+ +--------------------+ | Basic Controls | | Container | | Button, Checkbox, | | (Panel, Window, | | Label, TextField | | Frame, Dialog) | +--------------------+ +--------------------+Key Features of AWT:
- Heavyweight Components: AWT components rely directly on the underlying operating system's native GUI peer widgets (e.g., a
java.awt.Buttoncreates a native Windows button on Windows and a Motif button on Unix). - Container Hierarchy:
Frame: Top-level window with a title bar, border, and minimize/maximize buttons.Panel: Space-allocating container used to group components.
- Layout Managers: Automatically arrange component geometry (
FlowLayout,BorderLayout,GridLayout,GridBagLayout). - Event Delegation Model: Decouples event sources (e.g.,
Button) from event listeners (ActionListener,MouseListener).
(d) JDBC (Java Database Connectivity)
JDBC (
java.sql/javax.sql) is the standard Java API specification that enables Java applications to interact independently with relational database management systems (RDBMS like MySQL, Oracle, PostgreSQL).+-----------------------+ | Java Application | +-----------+-----------+ | (JDBC API Calls) v +-----------------------+ | JDBC DriverManager | +-----------+-----------+ | v +-----------------------+ | JDBC Driver (MySQL) | +-----------+-----------+ | (Database Protocol) v +-----------------------+ | RDBMS Database | +-----------------------+Standard 5 Steps to Execute JDBC Operations:
- Load Driver Class:
Class.forName("com.mysql.cj.jdbc.Driver"); - Establish Database Connection:
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "password"); - Create Statement:
Statement stmt = con.createStatement(); // Or PreparedStatement for parameterized SQL - Execute SQL Query:
ResultSet rs = stmt.executeQuery("SELECT * FROM students"); while (rs.next()) { System.out.println(rs.getInt("roll_no") + " : " + rs.getString("name")); } - Close Resources:
rs.close(); stmt.close(); con.close();
- Document Skeleton Commands:
Q9(a). Write a short note on N-Tiered Software Architecture. Question 9: attempt any two short notes.20267m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Write a short note on N-Tiered Software Architecture. Question 9: attempt any two short notes.
Worked SolutionShort Note: N-Tiered Software Architecture
N-tier architecture divides an application into separate logical or physical layers, each with a clear responsibility.
Common three-tier model
- Presentation tier: user interface, such as a browser or mobile app.
- Application/business tier: rules, validation, workflows and APIs.
- Data tier: database and persistent storage.
MermaidDiagramRendering diagram…Advantages: separation of concerns, easier maintenance, independent scaling, improved testability and the ability to protect the database behind application services.
Disadvantages: more deployment complexity, network latency between tiers and additional operational cost.
Example: in an online shopping system, the browser displays products, the application server calculates orders, and the database stores products and orders.
Conclusion: N-tier architecture makes large applications easier to maintain and scale by separating interface, business logic and data responsibilities.
Q9(b). Write a short note on any two of the following: (i) DOM (Document Object Model) (ii) Static webpage vs. dynamic webpage (iii) Fat Client vs. Fat Servers. [3.5 × 2 = 7]20247m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →Write a short note on any two of the following: (i) DOM (Document Object Model) (ii) Static webpage vs. dynamic webpage (iii) Fat Client vs. Fat Servers. [3.5 × 2 = 7]
Worked SolutionAny two notes are required (3.5 marks each). All three are given below; write any two in the exam.
(i) DOM (Document Object Model)
The DOM is a platform- and language-independent programming interface that represents an HTML or XML document as a tree of objects (nodes). The browser builds it when parsing a page, and JavaScript can read and change it, so pages become dynamic.
Node types: document, element, attribute, text, and comment nodes.
document └─ html ├─ head ─ title └─ body ├─ h1 ─ "Hello" └─ p ─ "Text"What JavaScript can do with it:
const h = document.getElementById('title'); // select h.textContent = 'New heading'; // change content h.style.color = 'blue'; // change style const p = document.createElement('p'); // create node p.textContent = 'Added'; document.body.appendChild(p); // insert h.addEventListener('click', () => alert('Hi')); // handle eventsIt allows adding, removing, or modifying elements, attributes, and styles, and reacting to events.
(ii) Static vs dynamic web page
Basis Static page Dynamic page Content Fixed; same for every visitor Generated at request time; can differ per user Technology HTML, CSS (and client-side JS) Server-side scripting (PHP, Node.js, JSP) with a database Updates Manual editing of the file Content changes through a database or CMS Interaction Minimal Login, forms, search, shopping carts Development Simple and quick More complex Speed Faster; can be cached or served from a CDN Slower due to processing and database calls Cost / hosting Cheap Needs server and database Examples Portfolio, brochure page Facebook, Amazon, online banking (iii) Fat client vs fat server
Basis Fat (thick) client Fat server (thin client) Processing Most of the business logic on the client Most of the logic on the server Client Powerful, needs installation Simple; often just a browser Server Mainly stores data Does processing and stores data Maintenance Updates must be installed on every client Update once on the server Network use Lower (after local processing) Higher, since each action goes to the server Security Data and logic exposed on the client Centralised and easier to secure Offline use Possible Not possible Examples Desktop apps, MS Office, games Traditional web apps, terminal-based systems Modern single-page applications combine both: a rich JavaScript client with server APIs.
Q9(b). What are the drawbacks of HTML? How are they addressed in XML?20237m
Module I: Introduction to Web Technologies and Architectures
View this question on its own page →What are the drawbacks of HTML? How are they addressed in XML?
Worked SolutionDrawbacks of HTML
- Fixed, predefined tags: you cannot create custom tags that describe your own data.
- Content mixed with presentation: tags like
<b>,<font>, and<center>blend structure and looks. - No data meaning (no semantics for data):
<td>450</td>does not say whether 450 is a price or a roll number, so machines cannot understand it. - Not designed for data exchange: it is meant for display, not for transporting structured data between systems.
- Lenient syntax: browsers accept unclosed tags, missing quotes, and wrong nesting, leading to inconsistent rendering and hard-to-parse documents.
- No validation: there is no built-in way to enforce a required structure.
- Poor searching and reuse: the same content cannot be easily reformatted for other devices or purposes.
- Not extensible: new needs require changes to the standard itself.
How XML addresses them
HTML drawback XML solution Fixed tags Extensible: authors define their own tags, e.g. <price>,<author>Content and style mixed Separates data from presentation; styling is done with CSS or XSLT No data meaning Self-descriptive tags give data meaning: <price>450</price>Not for data exchange Designed for storing and transporting data (used in web services, configuration, RSS) Lenient syntax Strict, well-formed rules: every tag closed, correct nesting, quoted attributes, one root, case-sensitive No validation DTD or XML Schema validate structure and data types Poor reuse One XML source can be transformed to HTML, PDF, or other formats with XSLT <book> <title>Web Technology</title> <price currency="INR">450</price> </book>XML does not replace HTML: HTML displays data, while XML describes and carries data.