0% found this document useful (0 votes)
29 views

Unit Previous 3 Years Solution Web Tech

Web tech Solution previous 3 years

Uploaded by

pathak639326
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Unit Previous 3 Years Solution Web Tech

Web tech Solution previous 3 years

Uploaded by

pathak639326
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Unit-2(22,23,19)

Q1.22:

Create a css rule that makes all the text 2 times larger than the base font of the
system. Mention can you integrate css on a web page

Ans:

To create a CSS rule that makes all the text 2 times larger than the base font size of the
system, you can use the font-size property with a relative unit like em.

Here is the CSS rule for that:

body {

font-size: 2em;

This rule will apply to all text within the <body> tag, making it 2 times larger than the
base font size of the browser or system.

Integrating CSS on a Web PageYou can integrate CSS into a web page in several
ways:

Inline CSS: You can use the style attribute directly within HTML tags.<p style="font-size:
2em;">This is a paragraph with inline CSS.</p>Internal CSS: You can include CSS rules
within a <style> tag in the <head> section of your HTML document.

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

body {

font-size: 2em;

</style>

<title>Document</title>

</head>
<body>

<p>This is a paragraph with internal CSS.</p>

</body>

</html>

External CSS: You can link to an external CSS file from within the <head> section of
your HTML document.

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="styles.css">

<title>Document</title>

</head>

<body>

<p>This is a paragraph with external CSS.</p>

</body>

</html>And the styles.css file would contain:body {

font-size: 2em;

Each method has its use cases. Inline CSS is useful for quick, one-off styles. Internal
CSS is good for single-page applications. External CSS is best for applying consistent
styles across multiple pages.

Q2.22

Create an HTML code to create a web page that contains the user registration form
with following details user name, user date of birth, user address, user gender, user
email id, user mobile number.

Ans:

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>User Registration Form</title>

</head>

<body>

<h2>User Registration Form</h2>

<form action="#" method="post">

<div>

<label for="username">User Name:</label>

<input type="text" id="username" name="username" required>

</div>

<div>

<label for="dob">Date of Birth:</label>

<input type="date" id="dob" name="dob" required>

</div>

<div>

<label for="address">Address:</label>

<input type="text" id="address" name="address" required>

</div>

<div>

<label>Gender:</label>

<input type="radio" id="male" name="gender" value="male" required>

<label for="male">Male</label>

<input type="radio" id="female" name="gender" value="female">

<label for="female">Female</label>

<input type="radio" id="other" name="gender" value="other">


<label for="other">Other</label>

</div>

<div>

<label for="email">Email ID:</label>

<input type="email" id="email" name="email" required>

</div>

<div>

<label for="mobile">Mobile Number:</label>

<input type="tel" id="mobile" name="mobile" required pattern="[0-9]{10}">

</div>

<div>

<button type="submit">Register</button>

</div>

</form>

</body>

</html>

OUTPUT:

User Registration Form


User Name:

Date of Birth:
Address:
Gender: Male Female Other

Email ID:
Mobile Number:
Register

Q3.22 ) Design a XML DTD for self describing weather report having
following details: Date, location, temperature range (Location describes
city, state and its country. Country code is unique and not left blank.
Temperature range describes high and low temp. In Fahrenheit or
Celsius).

Ans:
Here's an example of an XML DTD (Document Type Definition) for a self-
describing weather report with the specified details:

Weather Report XML DTD

<!DOCTYPE weatherReport [
<!ELEMENT weatherReport (date, location, temperatureRange)>

<!ELEMENT date (#PCDATA)>

<!ELEMENT location (city, state, country)>

<!ELEMENT city (#PCDATA)>


<!ELEMENT state (#PCDATA)>

<!ELEMENT country (countryCode, countryName)>

<!ELEMENT countryCode (#PCDATA)>

<!ELEMENT countryName (#PCDATA)>

<!ELEMENT temperatureRange (high, low, unit)>

<!ELEMENT high (#PCDATA)>


<!ELEMENT low (#PCDATA)>

<!ELEMENT unit (#PCDATA)>


<!ATTLIST countryCode
unique CDATA #REQUIRED>

]>
Example XML Document Conforming to the DTD
<?xml version=”1.0” encoding=”UTF-8”?>

<!DOCTYPE weatherReport [
<!ELEMENT weatherReport (date, location, temperatureRange)>

<!ELEMENT date (#PCDATA)>

<!ELEMENT location (city, state, country)>

<!ELEMENT city (#PCDATA)>

<!ELEMENT state (#PCDATA)>

<!ELEMENT country (countryCode, countryName)>

<!ELEMENT countryCode (#PCDATA)>


<!ELEMENT countryName (#PCDATA)>

<!ELEMENT temperatureRange (high, low, unit)>

<!ELEMENT high (#PCDATA)>

<!ELEMENT low (#PCDATA)>


<!ELEMENT unit (#PCDATA)>

<!ATTLIST countryCode
Unique CDATA #REQUIRED>
]>

<weatherReport>
<date>2024-06-18</date>
<location>

<city>San Francisco</city>
<state>California</state>
<country>

<countryCode unique=”US”>US</countryCode>
<countryName>United States</countryName>

</country>
</location>

<temperatureRange>

<high>75</high>

<low>55</low>

<unit>Fahrenheit</unit>

</temperatureRange>
</weatherReport>

Output:

2024-06-18

San Francisco California US United States 75 55 Fahrenheit

Q1,23:

Discuss the application of XML. Also compare XSD and DTD.


Ans:-
XML (eXtensible Markup Language) is a versatile and widely-used language for
defining, transmitting, validating, and interpreting data across different
systems.

Here are some common applications of XML:


Web Services and APIs:

XML is frequently used to structure data exchanged between web services


and applications, often in the form of SOAP (Simple Object Access Protocol).
Configuration Files:

Many software applications use XML files to store configuration settings,


making it easy to modify and manage these settings.

Data Interchange:
XML serves as a standard format for exchanging data between different
systems and applications, ensuring that data can be shared regardless of the
underlying platform.
Content Management Systems: XML is used to store and transport data in
content management systems (CMS), enabling the separation of content from
presentation.

Document Storage and Transport:


XML is utilized for representing complex documents, such as technical
manuals, books, and legal documents, allowing for consistent storage and
transport.

Electronic Data Interchange (EDI):

In various industries, XML is used for EDI to facilitate the automated exchange
of business information, such as invoices and purchase orders.

Comparison of XSD and DTDXSD (XML Schema Definition):


Definition:
XSD is an XML-based language used to define the structure and data types of
XML documents.
Data Types: Supports complex data types, such as integers, strings, dates,
and custom types.

Namespace Support: Provides strong support for XML namespaces, allowing


elements and attributes to be qualified with different namespaces.
Extensibility: Highly extensible, allowing users to create their own data types
and extend existing ones.

Syntax: Written in XML, making it more expressive and allowing for greater
validation capabilities.

Tools and Support: Widely supported by modern XML parsers and editors,
offering advanced validation and editing features.

DTD (Document Type Definition):


Definition: DTD is a set of markup declarations that define the structure and
the legal elements and attributes of an XML document.

Data Types: Limited support for data types, primarily focusing on the
structure of the document rather than the type of data.
Namespace Support: Lacks robust support for XML namespaces, making it
less suitable for documents that require namespace qualification.

Extensibility: Less flexible compared to XSD, with limited capabilities for


extending and customizing data types.

Syntax: Uses a unique syntax different from XML, which can be less intuitive
for users familiar with XML.

Tools and Support: Although still supported, DTDs are less favored in modern
applications due to their limitations and the richer capabilities of XSD.

Q2.23
Describe frames in HTML. Write markup to create a web page that
contains three vertical columns, having background color as red,blue,
green respectively.

Ans:
Frames in HTML allow the division of a web browser window into multiple
sections, each capable of loading a separate HTML document.

This is accomplished using the <frameset> and <frame> tags. However, it is


important to note that frames are considered obsolete in HTML5 and it is
recommended to use other layout techniques such as CSS Flexbox or Grid for
modern web development.

To create a web page with three vertical columns, each having different
background colors (red, blue, and green), you can use HTML and CSS.
Below is an example of the markup and styles needed to achieve this:

<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">

<title>Three Vertical Columns</title>


<style>
body {

display: flex;

height: 100vh; /* Makes the columns fill the full height of the
viewport */

margin: 0;

.column {
flex: 1;

display: flex;

align-items: center; /* Centers content vertically */


justify-content: center; /* Centers content horizontally */
color: white;

font-size: 2em;
}
.red {

background-color: red;
}
.blue {

background-color: blue;
}

.green {
background-color: green;

</style>

</head>

<body>

<div class="column red">Column 1</div>


<div class="column blue">Column 2</div>

<div class="column green">Column 3</div>

</body>
</html>

Output:
Q3,23:

Design a self-describing XML DTD for storing email data .


Ans:
To create a self-describing XML DTD (Document Type Definition) for storing
email data, we need to define the structure of the XML document,
including the elements and their attributes. Here is an example DTD for
storing basic email data such as the sender, receiver, subject, and body of
the email:
DTD (email.dtd):

<!ELEMENT email (header, body)>


<!ELEMENT header (from, to, subject, date)>
<!ELEMENT from (#PCDATA)>

<!ELEMENT to (#PCDATA)>

<!ELEMENT subject (#PCDATA)>


<!ELEMENT date (#PCDATA)>
<!ELEMENT body (content)>

<!ELEMENT content (#PCDATA)>

Example XML Document:

<!DOCTYPE email SYSTEM "email.dtd">


<email>
<header>

<from>sender@example.com</from>
<to>receiver@example.com</to>

<subject>Meeting Reminder</subject>
<date>2024-06-18</date>

</header>

<body>

<content>Dear Team, This is a reminder for our meeting scheduled at


10 AM tomorrow.</content>

</body>
</email>

Output:
sender@example.com receiver@example.com Meeting Reminder 2024-06-18Dear
Team, This is a reminder for our meeting scheduled at 10 AM tomorrow.

Q1.2019:
Describe the role and importance of CSS in web designing. Also
Differentiate Class and Id in CSS.

Ans:
Role and Importance of CSS in Web Designing
Cascading Style Sheets (CSS) play a crucial role in web design by
controlling the visual presentation of web pages. Here are some key
aspects:

1.Separation of Content and Presentation:


CSS allows the separation of the HTML content from its visual styling.

This separation makes the HTML code cleaner and more semantic,
focusing on the structure and meaning of the content.
2.Consistency and Reusability:

By defining styles in a CSS file, you can apply the same styles across
multiple pages of a website, ensuring a consistent look and feel.

This approach also makes it easier to maintain and update the design, as
changes in the CSS file will automatically reflect across all pages.
3.Enhanced Design Flexibility:

CSS provides a wide range of styling options, including layout control


(Flexbox, Grid), colors, fonts, spacing, animations, and more.
This flexibility allows designers to create visually appealing and responsive
designs that work on various devices and screen sizes.

4.Improved Performance:

By separating the styling from the HTML, CSS files can be cached by the
browser.

This caching reduces the amount of data transferred and speeds up page
load times, improving the overall performance and user experience.

5.Accessibility:
CSS can be used to improve the accessibility of web pages. For instance,
CSS can be used to create responsive designs that adapt to different
screen readers, making the content more accessible to users with
disabilities.

Differentiating Class and Id in CSS


Both class and id are attributes used in HTML elements and can be
targeted in CSS for styling, but they serve different purposes and have
different rules:

Class Selector:
Syntax:

.classnameUsage:

The class attribute is used to define a style for a group of elements.


It is reusable and can be applied to multiple elements within the same
document.

Example:

<div class="highlight">Content 1</div>


<p class="highlight">Content 2</p>.highlight {

background-color: yellow;

}
Purpose:
Classes are typically used for styling elements that share common
properties, such as buttons, headings, or any repeated visual components.
Id Selector:
Syntax: #idnameUsage:

The id attribute is used to define a unique style for a single element.


Each id must be unique within the HTML document.
Example:

<div id="header">Header Content</div>#header {


background-color: blue;

Purpose: Ids are used for unique elements that need specific styling or for
targeting individual elements in JavaScript.
Q2.2019
“Document Type Definition (DTD) in XML is necessary”, justify the
statement With suitable example. Under which conditions which DTD
is more preferable.
Ans:

Justification for the Necessity of DTD in XMLA Document Type Definition


(DTD) in XML is crucial for several reasons:
1.Validation of Structure and Content:

Consistency: Ensures that the XML document adheres to a predefined


structure, making the data consistent and predictable.

Error Checking: Helps in identifying errors in the XML document by


validating elements, attributes, and their relationships.
2.Interoperability:

Standardization: Facilitates interoperability between different systems


by providing a standard way to describe the data structure.
Data Exchange: Ensures that the data being exchanged between
different applications conforms to the agreed-upon format, reducing the
chances of misinterpretation.
3.Documentation:

Self-Describing: Acts as a form of documentation for the structure of the


XML document, making it easier for developers to understand and work
with the data.

4.Enforcement of Rules:
Constraints: Enforces rules regarding the presence, order, and data type
of elements and attributes, ensuring that the XML document is well-formed
and valid.
Example of a DTD and XML Document

DTD Definition (example.dtd):

<!ELEMENT person (name, age, email)>


<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>

<!ELEMENT email (#PCDATA)>


XML Document Validated Against the DTD (example.xml):
<!DOCTYPE person SYSTEM "example.dtd">

<person>
<name>John Doe</name>
<age>30</age>

<email>john.doe@example.com</email>
</person>

The preference for using internal or external DTDs depends on several


factors, including the size of the XML documents, the need for reuse,
ease of maintenance, and project requirements.
Here are the conditions under which each type of DTD is more
preferable:

Internal DTD

Definition: An internal DTD is defined within the XML document itself.


Preferred When:

*Small, Self-Contained Documents:


The XML document is relatively small and not part of a larger set of
documents.

Example: A single configuration file or a simple data exchange between


two applications.

*No Need for Reuse:The DTD is specific to a single document and does
not need to be reused across multiple documents.

Example: A one-time data export or a one-off document.


*Quick Development and Simplicity:
The project requires quick development and simplicity, with all information
in one place.
Example: Prototyping or developing simple applications where ease of
development is prioritized.

*Immediate Validation:

Immediate validation is needed without referring to external resources.


Example: When working in environments with limited or no internet
access, ensuring the document validates with its own DTD.

Example:

<!DOCTYPE person [
<!ELEMENT person (name, age, email)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT age (#PCDATA)>


<!ELEMENT email (#PCDATA)>
]>

<person>

<name>John Doe</name>
<age>30</age>

<email>john.doe@example.com</email>
</person>
2.External DTD

Definition:
An external DTD is defined in a separate file and referenced by the XML
document.

Preferred When:

*Large Projects with Multiple XML Documents


*Ease of Maintenance
*Consistency and Reusability

*Modularity and Separation of Concerns


Example:
DTD File (example.dtd):

<!ELEMENT person (name, age, email)>


<!ELEMENT name (#PCDATA)>

<!ELEMENT age (#PCDATA)>


<!ELEMENT email (#PCDATA)>

XML Document:

<!DOCTYPE person SYSTEM "example.dtd">

<person>

<name>John Doe</name>

<age>30</age>
<email>john.doe@example.com</email>

</person>

Summary
1.Internal DTD is preferable for small, self-contained documents, quick
development, and situations where the DTD does not need to be reused.

2.External DTD is preferable for larger projects with multiple XML


documents, ease of maintenance, ensuring consistency and reusability,
and promoting modularity by separating the structure definition from the
data.

Q3.2019
ans:

<!DOCTYPE html>

<head>
<title>Heade.html</title>

</head>

<FRAMESET COLS="*,*">
<FRAME SRC="Menu.html">

<FRAME SRC="Output.html">

</FRAMESET>
<NOFRAMES>Your browser does not support frames.</NOFRAMES>

</html>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy