NCERT Solutions Class 10 Information Technology Chapter 8 Introduction to XML

Class 10 - Information Technology
Chapter 8 - Introduction to XML

NCERT Solutions Class 10 Social Science Information Technology Textbook
Top Block 1

Very Short Answer Type Questions


Question : 1. What do you mean by XML file?

Answer :
XML file or XML document is a component of XML document system which contains the real data and its semantics.


Question : 2. List the components of prolog.

Answer :
1. An XML Declaration
2. Processing Instructions (PI)
3. Document Type Definition (DTD)
4. Comments
5. White Spaces and New line


Question : 3. By which we can describe the properties of elements?

Answer :
The properties of elements can be described through attributes.


Question : 4. Write the components of an XML file in terms of logical structure.

Answer :
An XML file contains:
1. an optional prolog
2. a data instance


Question : 5. How will you define an element in DTD contain plain text?

Answer :
If an element should contain plain text, you define the element using #PCDATA. PCDATA stands for Parsed Character Data and is the way you specify non-markup text in your DTDs.


Question : 6. What does XML parser do?

Answer :
An XML parser basically checks whether a document is following XML standard or not.


Question : 7. Which document is used to define the style of an XML document?

Answer :
CSS is a text document (or stylesheet) that is commonly used to define the style and layout of an XML document.


Question : 8. Can same CSS document be used in multiple XML documents?

Answer :
Yes, the same CSS document can be used in multiple XML documents.


Question : 9. Explain the usage of an XML parser. CBSE 2011

Answer :
XML parser is a software used to read, write and update to an XML document. An XML parser converts an XML document into an XML DOM object.

Short Answer Type Questions


Question : 1. What does it mean when we say that XML tags are case sensitive?

Answer :
The case sensitivity of XML tags means, the opening and closing tags must be in the same case. The following codes is an example of a well-formed document, where the opening and closing tags are in the same case, i.e.
<Name>Amit </Name>


Question : 2. List the important points to create an XML document.

Answer :
The points while creating an XML documents are as follows:
1. XML documents must have starting and closing tags.
2. XML tags are case sensitive.
3. XML elements must be properly nested.
4. XML documents must have one root element.
5. The values of XML attributes must be enclosed in double quotes.


Question : 3. Explain the utility of comments in XML.

Answer :
A comment is a note or information that appears in the code of an XML document to help you understand the code better.
Comments are not displayed in the Output. They are not part of the program and therefore, are not parsed by the XML parser.


Question : 4. State whether the following XML document is well-formed or not
<Student> Mapoj </Student>
<Student> Ankur</Student>

Answer :
The preceding XML document is not well-formed because it contains two root elements. An XML document contains only one root element.


Question : 5. Name some languages, which are derived from XML.

Answer :
Some languages are as follows:
1. Ink Markup Language (InkML)
2. Business Narrative Markup Language (BNML)
3. Financial Product Markup Language (FPML)
4. Virtual Human Markup Language (VHML) .
5. Architecture Description Markup Language (ADML)
6. Artificial Intelligence Markup Language (AIML)
7. Chess Markup Language (ChessML) etc.


Question : 6. Define prolog and data instance.

Answer :
The prolog is a preface or introduction to XML document. It can contain upto five optional components. The grammar structure of the XML document is defined under prolog. The data instance consists of real data and its description through elements. It is also known as body of XML document.


Question : 7. Create XML markup to represent a message sent on 7 June, 2014 to Amit and Saurabh by Mohit. The message is “Submitted Successfully”.

Answer :
<?xml version = “1.0”?>
<message date=”7/6/2014″>
<sender> Mohit </sender>
<receiversXreceiver> Amit </receiver>
<receiver> Saurabh </receiver></receivers>
<text> Submitted Successfully </text>
</message>


Question : 8. Write the procedure to link a stylesheet with an XML document.

Answer :
Using CSS with an XML Document
To link an XML document with a stylesheet perform the following steps:
1. Create an XML document and save it as a file with the .xml extension.
2. Create a stylesheet and save it as a file with the .css , extension.
3. Link both the files in the XML document by using the PI.
<?xml-stylesheet href = “test.css” type = “text/css”?>
e.g. The following is the CSS document:
People
{
background-color : light green;
display : block;
padding : 5px;
font-family : arial;
}
Person
{
background-color : pink;
border : 2px solid black;
display : block;
margin-bottom : 5px;
Name
{
font-family : bold;
display : block;
}
Birthdate
{
display : block;
}
Eyes
{
display : block;
}
Now, save it as test.css
The following is the XML document:
<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type = “text/css” href = “test.css”?>
<People>
<Person>
<Name>A</Name>
<Birthdate>Jan 24, 1987</Birthdate>
<Eyes>Blue</Eiyes>
</Person>
<Person>
<Name>B</Name>
<Birthdate>Dec 15, 2009</Birthdate>
< Eyes >Brown</Eyes >
</Person>
</People>
Now, save it as test1.xml


Question : 9. What do you mean by Processing Instructions (PI)?

Answer :
PI can be used to pass information to applications in such a way that escapes most XML rules. Its main use is of linking to an XML stylesheet in the prolog of an XML document. Processing instructions do not have to follow much internal syntax, it can include markup characters without escaping them and can appear anywhere in the document.

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 10. Explain child elements with an example.

Answer :
The elements nested inside other elements are called child elements.
Consider the following code:

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 11. Write the full form of
1. XML
2. DTD
3. SGML
4. CSS

Answer :
Full form of given terms are as follows:
1. XML extensible Markup Language
2. DTD Document Type Declaration
3. SGML Standardised Generalised Markup Language
4. CSS Cascading Style Sheet

Long Answer Type Questions


Question : 1. Explain two softwares which are used to validate XML documents.

Answer :
Two important software that validate or process XML documents are as follows:
1. XML Validator are the software packages that check the XML document as per the specified DTD and give you feedback about the document.
Some XML validators are as follows:
(a) W3C XML Validator
(b) Tidy
(c) XML. com’s
(d) Brown University
2. XML Parsers are the software packages, which are part of bigger applications that provide XML support.
The role of an XML parser is to dissect a valid XML document to obtain actual data from the XML document. Some XML parsers are as follows:
(a) SAXfSimple API for XML)
(b) Expat
(c) LT-XML etc.


Question : 2. Write an XML document that marks up the following data:
All these must be rendered. Use attribute to make the data more informative.

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
Mddle block 1

Answer :
<?xml version = “1.0” encoding=”UTF-8″ standalone = “yes”?>
<employees>
<employee EmpID = “e001”>
<Name> Raj Kumar </Name>
<City> Delhi </City></employee>
<employee EmpID=”e002″>
<Name> Pankaj </Name>
<Ci ty> Mumbai </City></employee>
<employee EmpID=”e003″>
<Name> Rahul Sharma </Name>
<City> Delhi </City></employee>
<employee EmpID=”e004″>
<Name> Praveen </Name>
<City> Noida </City></employee>
</employees>


Question : 3. Compare XML with similar type of other languages.

Answer :
1. Comparing XML and SGML

XML SGML
XML is a markup language. SGML is a meta language used to define and describe generic markup language.
It does not include complex and optional features of SGML. It is complex and requires overheads to use it.
XML allows creation of new tags to describe and present your data. It is an ISO standard for specifying a set of tags,
XML allows data validation. SGML does not allow data validation.
It describes the data and transfers data between applications. It allows you to define and create platform-independent files.

2. Comparing HTML and XML

HTML XML
HTML tags are predefined. XML tags are not predefined.
HTML is case insensitive. XML is case sensitive.
HTML is markup language that creates the form and appearance of the Web page. XML is neither a programming nor a presentation language.

3. Comparing EDI and XML

EDI XML
EDI (Electronic Data Interchange) is a collection of standards, formats and file layout. XML is an emerging standard designed to simplify Web-based E-Commerce transactions between computer application.
EDI enables highly secure document exchanges. XML document typically needs to be encrypted to maintain security level.
EDI documents are sent via private and relatively expensive Value Added Networks (VANs). XML documents are generally sent via the Internet.
EDI does not processes low transaction values. XML processes relatively low transaction values.
EDI allows companies to exchange electronic documents quickly between their trading partners. XML allows you to create custom tags to present your document in a structured format.


Question : 4. Consider the following XML document.
Check this for well- formedness.
<Employees><FirstName> Ambrish
<MiddleName> Kumar</FirstName>
</MiddleName>
<lastname> Garg </LastName>
</Employees>

Answer :
The above XML document is not well-formed.
The document suffers from two errors which are as follows:
1. Improper nesting The MiddleName element is opened inside the FirstName element, yet MiddleName is not closed before the FirstName element is closed.
2. Mismatched cases of start and end tags The tag <lastname> is closed with </LastName>, which is incorrect. XML is case sensitive, thus the end tag of <lastname> should be </lastname>.


Question : 5. Explain the structure of XML document.

Answer :
Structure of XML- File/Document
Every XML document includes both physical and logical structure which are as follows:
1. Physical Structure
It contains the actual data used in a document. The basic storage unit called entity, each of which may refer to other entities. An entity has a name and content. It contains references to other entities. There is a special entity called document entity or root, that serves as a main storage unit. XML processor always start document processing from that unit.
We have three classifications of entities, these are as follows:
1. Internal and External Entities
For internal entity, there is no separate physical storage object and the content of the entity is given in the declaration. It contained inside the document. If the entity is not internal, then it is an external entity.

2. General and Parameter Entities
General entities are entities which are used within the document content. In this specification, general entities are sometimes referred to with the unqualified entity, when this leads to no ambiguity. Generally, entities are declared and used differently. Parameter entities are parsed and used only in the DTD part of the XML document.

3. Parsed and Unparsed Entities
Parsed entities contain text that is referred as replacement text intended to be processed by the parser and is considered as an integral part of the document. Unparsed entities are resources that can be of any type including text objects. This type of entity is never process by parser.

2. Logical Structure
It is a template that enables the elements to be included in a document and in the order in which they have to be included. The logical structure includes the basic components of the XML document. It indicates how a document is built, irrespective of what a document contains. The first structural element is prolog which is the base for the logical structure.

The structure of the document of example code:

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 6. A well-formed document must have a root element. Explain with an example.

Answer :
To create a well-formed XML document, it is necessary for it to have a root element. A root element is a unique element that contains all other elements in the XML document.
The XML document cannot contain more than one root element.
The following code is an example of a well-formed document:
<address>
<city> Delhi </city>
<state> Delhi </state>
<country> India </country>
</address>

Consider the same code written in the following way:
<city> Delhi </city>
<state> Delhi </state>
<country> India </country>
The preceding code is not a well-formed document, since it does not contain a root element.


Question : 7. Explain the difference between a well-formed and a valid XML documents. CBSE 2011

Answer :
1. Well-Formed XML Documents
A “Well-Formed” XML document means that document has the correct XML syntax.
The XML document that follows XML grammar rules is called well-formed document. A document that includes sequence of markup characters that cannot be parsed or are invalid cannot be well-formed. The following points are to be kept in mind for a valid XML document:
1. The document must contain atleast one element

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
2. The document must have a root element A root element is a unique element in the XML document, which contains the complete document.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
3. The element must have the opening and the closing tags To close a tag, you need to prefix the forward slash with the normal tag.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
4. XML tags must be closed properly There must be a proper closing tag. In XML, empty tags must end with a following slash.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
5. XML elements must be properly nested The parent element has to be opened before the child element and closed after the child element.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
This code is not well-formed because the root element (College) is closed before the parent element (Student).
6. XML tags are case sensitive XML tags are case sensitive means the opening and ending tags must be in the same case.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
7. XML attribute values should be in double quotation marks The attribute value in an XML document should be enclosed in proper quotes.
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml
2. Valid XML Document
A valid XML document is .not only a well-formed document but as well as they also checked error against a DTD or schema. DTD is a set of rules that defines what tags appear, what value those tags may contain and how the tags are related to each other in an XML document. Validation can be done only if the XML document has valid DTD. When an XML document is checked or parsed according to a particular structure or guidelines, the process is known as validation of the document.


Question : 8. Define CSS. How to create a CSS file?

Answer :
CSS is a simple design language intended to simplify the process of making Web pages presentable.
CSS is a type of stylesheet and this stylesheet consists of a list of rules. You can include a CSS in multiple XML documents that have the same data structure.
Syntax
selector
{
property: value; } Declaration Block
}
Creating a CSS File
To create a CSS file, you need to have all the style rules composed in it and save it with extension .css.

v
You can define the color in CSS by name as well as by code like green color may be written as #008000 or rgb(0,128,0).
NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Long Answer Type Questions


Question : 1. Write two points of difference in HTML and XML. Write three points of well-formed XML document. Write the code to create an XML document to present following data:

Furniture Material Quantity Floor
Table Wood 75 Ist
Chair Plastic 85 IInd

Answer :
Two points of difference between HTML and XML follows:

HTML XML
HTML is a markup language that creates the form and appearance of the Web page. XML is a text-based markup language for processing and displaying data in a structured format.
HTML documents are viewable in a browser. XML documents can be viewed only if proper stylesheet file is also available alongwith XML file.

Three points of well-formed XML document are as follows:
1. The document must have a root element.
2. The element must have the opening and closing tags.
3. XML attributes values, should be in double quotation marks.
<?xml version =”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<Data><Datal>
<Furniture>Table</Furniture>
<Material >Wood</Material >
<Quantity>75</Quantity>
<Floor>1st</Floor>
</Datal>
<Datal>
<Furniture>Chair</Furniture>
<Materi al >Plastic</Materi al >
<Quantity>85</Quantity>
<Floor>IInd</Floor>
</Datal>
</Data>


Question : 2. XML document structure can be divided in which two parts? What is meant by valid XML document (write three points)? Write the code to create an XML document to present following data:

Name Job Department Cubicle
Srishti Programmer Engineering 5E
Aditi Designer Marketing 19T

Answer :
XML document structure can be divided into two parts as follows:
1. Well-formed XML document
2. Valid XML document
A valid XML document means to follow several terms, such as follows:
1. It is not only a well-formed document but as well as check error against a DTD.
2. It signifies that a document is well-formed.
3. It uses XML parser, XML validator for validation.
The XML code is
<?xml version = “1.0” encoding = “UTF-8”?>
<Employees>
<Employee>
<Name> Srishti </Name>
<Job> Programmer </Job>
<Department> Engineering </Department>
<Cubicle> 5E </Cubicle>
</Employee>
<Employee>
<Name> Aditi </Name>
<Job> Designer </Job>
<Department> Marketing </Department>
<Cubicle> 19T </Cubicle>
</Employee>
</Employees>



Question : 3. Write two points of differences between XML and HTML. What is meant by a well-formed XML document (write two points)? Write the code to create an XML document with following data:

.
Designation Cost No_of_days Made_Of_trans
Singapore 200000 8 Aeroplane
Shimla 10000 4 Bus

Answer :
The differences between XML and HTML are as follows:
1. HTML has predefined tags while XML has user-defined tags.
2. HTML document can be viewed directly by the Web browser while XML document cannot be viewed directly and need some proper stylesheet files.

A well-formed document means to follow several generic rules, such as follows:
1. XML document must contain atleast one element.
2. All tags must have the opening and closing tags as these XML tags are case sensitive.

The XML code is
<?xml version = “1.0” encoding = “UTF-8”?>
<Travels><Travel>
<Designation> Singapore </Designation>
<Cost> 200000 </Cost>
<No_of_days> 8 </No_of_days>
<Mode_of_trans> Aeroplane </Mode_of_trans>
</Travel>
</Travel>
<Designation>Shimla</Designation>
<Cost> 10000 </Cost>
<No_of_days> 4</No_of_days>
<Mode_of_trans> Bus </Mode_of_trans>
</Travel></Travels>


Question : 4. Explain with a help of an example, how root elements are placed in a XML document?

Answer :
XML documents must contain one element that is the parent of all other elements. This element is called the root element. The root element encloses all other elements in XML. All other elements inside the root elements are the form of child element. The structure of the XML file should look like
<root>
<child>
<subchild>….</subchild>
</child>
</root>

e.g.
<company>
<employee>
<ecode> 101 </ecode>
<name> Rahul </name>
</employee>
<employee>
<ecode> 102 </ecode>
<name> Sahil </name>
</employee>
<employee>
<ecode> 103 </ecode>
<name> Muskan </name>
</employee>
</company>
You can see in the above example that the root element declared out here is <company> then comes the child element <employee> which in turn stores the <ecode> and <name> of the employee in the tags.

Application Oriented Questions


Question : 1. Draw the XML tree for code given below:
<Library>
<Books category=”Thriller”>
<Author>ABC</Author>
<Price>150</Price>
</Books>
<Books category=”Fiction”>
<Author>EFG</Author>
<Price>250</Price>
</Books>
</Library>

Answer :
The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 2. Draw the XML tree for the code given below:
<MOVIES>
<ENGLISH>
<NAME> PLAYERS </NAME>
<DIRECTOR) ABC </DIRECTOR>
<PRODCOST> 50 Lakhs</PRODCOST>
</ENGLISH>
<HINDI>
<NAME> KHILADI </NAME>
<DIRECTOR> XYZ </DIRECTOR>
<PRODCOST> 70 Lakhs</PRODCOST>
</HINDI>
</MOVIES>

Answer :
The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 3. Write the DTD for the following XML document:
<Examples>
<example>
<name> CSS example </name>
<url> http://www.google.com </url>
</example>
<example>
<name> DTD example </name>
<url> http://www.google.com </url>
</example>
</Examples>

Answer :
<?xml version = “1.0” standalone = “yes”?>
<!DOCTYPE Examples![
<!ELEMENT Examples (example)>
<! ELEMENT example (name, url )> <!ELEMENT name (#PCDATA)>
<! ELEMENT url (#PCDATA)>
]>


Question : 4. Vallesoft Pvt. Ltd has designed and developed a Website that will be displayed differently in each of the continents. It has decided to use XML instead of HTML to develop the Website.
(i) A developer has written some XML code. Which of the following XML code fragments is well-formed?
<channel><time> STAR TV 9.00 PM </channel></time>
<Description> Family Drama </description>
(ii) Correct all the mistakes in the XML code fragments that are not well-formed given in part (i).
(iii) Design an XML tree for the following XML code:
<program>
<channel> STAR TV </channel>
<time> 9.00 PM </time>
<day> Monday, Tuesday, Wednesday </day>
<description> Family Drama </description>
</program>

Answer :
(i) None of the given code fragments are well-formed.
(ii) The correct code is:
<channel><time> STAR TV 9.00PM </time></channel>
<Description> Family Drama </Description>
(iii) The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 5. Draw the XML tree for the code given below:
< DIET>
<MORNING>
<CEREAL> OATS </CEREAL>
<FRUIT> PAPAYA </FRUIT>
<LIQUID> TEA </LIQUID></MORNING>
<AFTERNOON>
<CEREAL> BRAN </CEREAL>
<FRUIT> APPLE </FRUIT>
<LIQUID> JUICE </LIQUID>
</AFTERNOON> </DIET>

Answer :
The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 6. Draw the XML tree for the code given below:
<employees>
<employee sex = “male”>
<name>
<first> Harry </first>
<last> Potter </last>
</name>
</employee>
<employee sex = “female”>
<name>
<first> Linda </first>
<1ast> Ray </last>
</name>
</employee>
</employees>

Answer :
The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 7. Draw the XML tree for the code given below:
<bookstore>
<book>
<title> ABC of Computers </title>
<author> A. Gandhi </author>v <year> 2005 </year>
<pri ce> 29.99 </pri ce></book>
<book>
<title> Learning XML </title>
<author> Erik T. Ray </author>
<year> 2003 </year>
<price> 39.95 </price> </book> </bookstore>

Answer :
The XML tree is

NCERT Solutions Class 10 Social Science Information Technology introduction to Sxml

Question : 8. Create a DTD for storing book information for a library. The DTD should contain details about each book in terms of title, author (name), number of copies, all of which can store character data. The number of copies should contain two attributes named ‘inhand’ and issued which are both mandatory.

Answer :
<?xml version = “1.0”>
<!DOCTYPE LIBRARY [
<!ELEMENT LIBRARY (BOOK +)>
<!ELEMENT BOOK (TITLE, AUTHOR, NOC)>
<!ELEMENT AUTHOR (NAME)>
<!ELEMENT TITLE (# PCDATA)>
<!ELEMENT NAME (# PCDATA)>
<!ELEMENT NOC (# PCDATA)>
<! ATTLIST NOC INHAND ISSUED CDATA # REQUIRED>
]>

Multiple Choice Questions


Question : 1. XML uses
(a) Only 5 tags
(b) Predefined tags
(c) Custom tags
(d) HTML tags

Answer :
(c) XML uses user defined or custom tags.


Question : 2. XML was not designed to
(a) display Web pages
(b) store data
(c) carry data
(d) Both (b) and (c)

Answer :
(a) XML was designed to store and carry data, not to display Web pages.


Question : 3. A root element is
(a) a bridge between HTML and XML
(b) the parent of all other elements
(c) child element of the parent
(d) None of the above

Answer :
(b) A root element is the parent of all other elements.


Question : 4. An XML document can be viewed in a
(a) Word processor
(b) Web browser
(c) Notepad
(d) None of these

Answer :
(b) An XML document can be viewed in a Web browser.


Question : 5. Name the root element in the following XML document:
<father>
<child1>
<name> Megha </name>
<age> 12 </age>
</child1>
<child2><name > Mana </name>
<age> 15 </age>
</child2>
</father>

(a) child 1
(b) child 2
(c) father
(d) name

Answer :
(c) father is the root element.


Question : 6. Which of them is the correct statement?
(a) An XML elements must have a closing tag.
(b) An XML elements must be lowercase.
(c) An XML documents must have a DTD.
(d) All of the above

Answer :
(a) An XML elements must have a closing tag.


Question : 7. Which is not a correct name for an XML element?
(a) <xmldocument>
(b) <7eleven>
(c) <phone_number>
(d) <root>

Answer :
(b) <7eleven> is not a correct name for an XML element.


Question : 8. XML allows you to CBSE 2012
(a) create new tags
(b) arrange your tags in any order
(c) closing tags are not required
(d) All of the above

Answer :
(b) XML allows you to arrange your tags in any order.


Question : 9. Which one of these is correct syntax of the declaration, that defines the XML version?
(a) <?xml version = “1.0”?>
(b) <?xml version = “1.0”>
(c) </xml version = ”1.0″>
(d) <xml version = “1.0”?>

Answer :
(a) <?xml version = “1.0”?> is a correct syntax of the declaration.


Question : 10. The way of describing XML data is
(a) XML uses XSL to describe data
(b) XML uses a description node to describe data
(c) XML uses a DTD to describe the data
(d) None of the above

Answer :
(c) XML uses a DTD to describe XML data.


Question : 11. Which of the following is a prolog component?
(a) Element
(b) Tab
(c) White space
(d) All of these

Answer :
(a) Element is a prolog component.


Question : 12. PI is a component of
(a) prolog
(b) data instance
(c) element
(d) root element

Answer :
(a) PI is a component of prolog.


Question : 13. To link an XML document with a stylesheet, you need to
(a) use the PI component in the XML document
(b) use the document declaration component in the XML document
(c) add the tag in the XML document
(d) None of the above

Answer :
(a) To link an XML document with a stylesheet, you have to use the PI component in the XML document.


Question : 14. The XML document is like a
(a) tree structure
(b) inverted tree structure
(c) flat structure
(d) None of the above

Answer :
(a) The xml document is like a tree structure.


Question : 15. What does XML stand for?
(a) Extra Markup Language
(b) extensible Markup Language
(c) Example Markup Language
(d) None of the above

Answer :
(b) extensible Markup Language


Question : 16. What does DTD stand for?
(a) Dynamic Type Definition
(b) Dynamic Type Declaration
(c) Document Type Declaration
(d) Document Type Definition

Answer :
(c) Document Type Declaration


Question : 17. In XML, value of attribute must appear
(a) in uppercase
(b) in brackets
(c) in quotes
(d) in lowercase

Answer :
(c) in quotes


Question : 18. DTD definition is used alongwith XML to specify
(a) the presentation of XML document
(b) the links with other documents
(c) the structure of XML document
(d) None of the above

Answer :
(c) DTD definition is used alongwith XML to specify the structure of XML document.


Question : 19. Valid XML document means
(a) the documents has one root element
(b) the document contains atleast one or more root elements
(c) the XML document has a DTD associated with it and it compiles with that DTD
(d) each element must nest inside any enclosing element properly

Answer :
(c) Valid XML document check errors and has DTD or schema and compiles to it.


Question : 20. Comments in XML are
(a) having the same syntax as that of comments in HTML
(b) used to add additional notes
(c) not displayed on the final Web page
(d) All of the above

Answer :
(d) All of the above


Question : 21. Comment in XML can be given by:
(a) <?–>
(b) <!–>
(c) <?!–>
(d) <!?–>

Answer :
(b) <!–>


Question : 22. Which of the following XML fragments are well-formed?
(a) < element attribute = value >
(b) < element attribute = “value” >
(c) < element attribute = !value >
(d) < element attribute =’value’>

Answer :
(b) < element attribute = “value” > all well-formed.


Question : 23. How is an empty element defined in XML?
(a) <name></name>
(b) <name/>
(c) name
(d) All of these

Answer :
(b) The empty tag name is followed by <name/>


Question : 24. Is this, a “well-formed” XML document?
<?xml version = “1.0”?>
<note>
<to age=”29″> Tove </tO>
<from> Jani </from>
(a) Yes
(b) No
(c) Cannot be determined without the DTD
(d) None of the above

Answer :
(b) No, because </tO> is not a correct element and element is not closed.


Question : 25. Well-formed XML document means
(a) it contains a root element
(b) it contains an element
(c) it contains one or more elements
(d) must contain one or more elements and root elements

Answer :
(d) Well-formed XML document must contain one or more elements and root element must contain all other elements.


Question : 26. An XML parser is used to
(a) extract data from the XML file and build tree like structure.
(b) check whether or not an XML document is well-formed.
(c) Both (a) and (b)
(d) None of the above

Answer :
(b) Check whether or not an XML document is well-formed.


Question : 27. An XML document that follows the XML syntax is called a
(a) valid XML document
(b) well-formed XML document
(c) correct XML document
(d) All of the above

Answer :
(b) well-formed XML document


Question : 28. Which of the following is not an online XML validator?
(a) W3C validation service
(b) Tidy
(c) XML.com’s
(d) expat

Answer :
(d) expat is an online XML parser not an online XML validator.


Question : 29. What makes XML more powerful than HTML?
(a) The fact that it’s supported by all of the major software vendors. (b) Not as much coding is needed.
(c) Its ability to adopt to new uses.
(d) None of the above

Answer :
(c) XML is more powerful than HTML because we can define our own tags for different uses in XML.


Question : 30. HTML and XML are
(a) markup languages
(b) programming languages
(c) system softwares
(d) utilities

Answer :
(a) Both HTML and XML are markup languages.

Fill in the Blanks


Question : 1. ……… is used to define the structure of an XML document.

Answer :
DTD


Question : 2. XML is subset of ……….. . CBSE 2016

Answer :
SGML


Question : 3. An XML attribute is a ………. of an element.

Answer :
property >


Question : 4. XML attribute values should always be enclosed in ………… . CBSE 2014

Answer :
double quotes


Question : 5. ……….. are the building blocks of an XML document and are represented by using tags.

Answer :
Elements


Question : 6. The combination of XML document, DTD and stylesheet is known as ………. .

Answer :
XML document system


Question : 7. An element can be written without the end tag.

Answer :
empty


Question : 8. An attribute is a ……….. pair contained in the start tag of the element.

Answer :
name-value


Question : 9. In all XML documents, the ………….. element is the parent of all other elements. CBSE 2011

Answer :
root


Question : 10. All XML documents must have one element. CBSE 2011, 2014

Answer :
root


Question : 11. ………. refers to the preface to an XML document.

Answer :
Prolog


Question : 12. In XML, ………..cannot contain multiple values. CBSE 2016

Answer :
attributes


Question : 13. You can validate an XML document by using the XML validator and …………… .

Answer :
XML parser


Question : 14. A ………… confirms to all the XML guidelines.

Answer :
well-formed document


Question : 15. An XML document has both a ……….. structure and a ………….. structure.

Answer :
physical, logical


Question : 16. We need a/an ………….. to create and edit an XML document. CBSE 2013

Answer :
XML parser


Question : 17. ……… is a text document that is commonly used to define the style and layout of an XML document.

Answer :
CSS


Question : 18. The ……….. is an XML element to which the CSS style is applied.

Answer :
selector


Question : 19. ……….. is used to describe data and ……….. is used to display data. CBSE 2012

Answer :
XML, HTML

True or False


Question : 1. XML is used to define other languages.

Answer :
True XML is a meta language, which is used to define other languages.


Question : 2. XML is case sensitive. CBSE 2014

Answer :
True XML is case sensitive, while HTML is not case sensitive.


Question : 3. XML is widely used for storing data.

Answer :
True XML is used to describe data and storing data.


Question : 4. XML is extensible Meta Language. CBSE 2012

Answer :
False XML is not an extensible Meta Language. It is extensible Markup Language.


Question : 5. A tag only consists of opening angular bracket.

Answer :
False A tag consists of opening as well as closing angular brackets (<>).


Question : 6. XML is a platform-independent language.

Answer :
True XML can run on all platforms, so it is platform-independent language.


Question : 7. The root element is a parent element of all other elements in data instance.

Answer :
True The root element is an element that contains all other elements in XML document.


Question : 8. The values of the attributes are enclosed in double question marks.

Answer :
False The values of the attributes are enclosed in double quotation marks.


Question : 9. A special character can be defined as a short name given to a set of information.

Answer :
True When a special character is used in an XML document, it expands to its full definition.


Question : 10. XML is design to describe data.

Answer :
True The focus of XML is on the description of data, not its presentation.


Question : 11. DTD is a set of rules that defines what tags appear in an HTML document. CBSE 2014

Answer :
False DTD is used in XML documents.


Question : 12. An XML document can have only limited number of child elements.

Answer :
False XML document can have unlimited number of child elements.


Question : 13. Pseudo attributes are the settings that appear in prologs.

Answer :
True Pseudo attributes describe the overall document.


Question : 14. Names in XML document must start either with a letter, number or underscore.

Answer :
False Names in XML must start either with a letter or underscore character.


Question : 15. XML uses a DTD to describe its data to users.

Answer :
True The DTD are used in XML to specify its information and data to users.


Question : 16. In XML, tag names cannot contain spaces but can uses underscores.

Answer :
True Tag name must start either with a letter or underscore (_) character.


Question : 17. In XML, every opening tag may not have a closing tag. CBSE 2013

Answer :
False Every tag must contain the opening and closing tag.


Question : 18. Extension of an XML files is .html.

Answer :
False html is the extension of HTML file. An XML file extension is .xml.


Question : 19. One of the attributes of XML tag is Type.

Answer :
True type is a attribute of XML tag.


Question : 20. Comments are displayed in the Output.

Answer :
False Comments are not displayed in the Output.


Question : 21. XML document must have one root element. CBSE 2016

Answer :
True XML document must have one root element.


Question : 22. Physical structure includes the actual data of an XML file.

Answer :
True Physical structure stores actual data in the form of entity.


Question : 23. A valid XML document that follows all grammar rules is well-formed document.

Answer :
True A well-formed XML document means that the document has the correct XML syntax and follows proper grammar rules.


Question : 24. Both HTML and XML are markup language used to format data. CBSE 2011

Answer :
False XML is used to describe data, while HTML is used to format data.


Question : 25. HTML is about displaying information while XML is about describing information.

Answer :
True HTML was designed to describe data with focus on how data look while XML was designed to describe data with focus on what data is.

Bottom Block 3
Share with your friends

Leave a Reply