NCERT Solutions for Class 10 Foundation of Information Technology – Introduction to XML

ncert textbook

Created with Sketch.

NCERT Solutions for Class 10 Foundation of Information Technology – Introduction to XML

Very Short Answer Type Questions [1 Mark each]

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 [2 & 3 Marks each]

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-for-class-10-foundation-of-information-technology-introduction-to-xml-1

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 for Class 10 Foundation of Information Technology

Question 11. Write the full form of          CBSE 2014

  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 I Questions  [5 Marks each]

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-for-class-10-foundation-of-information-technology-introduction-to-xml-2
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-for-class-10-foundation-of-information-technology-introduction-to-xml-3

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-for-class-10-foundation-of-information-technology-introduction-to-xml-4
  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-for-class-10-foundation-of-information-technology-introduction-to-xml-5
  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-for-class-10-foundation-of-information-technology-introduction-to-xml-6
  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-for-class-10-foundation-of-information-technology-introduction-to-xml-7
  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-for-class-10-foundation-of-information-technology-introduction-to-xml-8
    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-for-class-10-foundation-of-information-technology-introduction-to-xml-9
  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-for-class-10-foundation-of-information-technology-introduction-to-xml-10

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.
ncert-solutions-for-class-10-foundation-of-information-technology-introduction-to-xml-11
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-for-class-10-foundation-of-information-technology-introduction-to-xml-12

Long Answer Type II Questions  [10 Marks each]

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: CBSE 2016
ncert-solutions-for-class-10-foundation-of-information-technology-introduction-to-xml-13

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: CBSE 2014
ncert-solutions-for-class-10-foundation-of-information-technology-introduction-to-xml-14

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: CBSE 2013
ncert-solutions-for-class-10-foundation-of-information-technology-introduction-to-xml-15
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: CBSE 2016

<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-for-class-10-foundation-of-information-technology-introduction-to-xml-16

Question 2. Draw the XML tree for the code given below: CBSE 2011

<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-for-class-10-foundation-of-information-technology-introduction-to-xml-17

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-for-class-10-foundation-of-information-technology-introduction-to-xml-18

Question 5. Draw the XML tree for the code given below:    CBSE 2011

< 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-for-class-10-foundation-of-information-technology-introduction-to-xml-19

Question 6. Draw the XML tree for the code given below:    CBSE 2014

<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-for-class-10-foundation-of-information-technology-introduction-to-xml-20

Question 7. Draw the XML tree for the code given below:    CBSE 2013

<bookstore> 
<book>
<title> ABC of Computers </title>
<author> A. Gandhi </author>
<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-for-class-10-foundation-of-information-technology-introduction-to-xml-21

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 [1 Mark each]

Q1. XML uses CBSE 2016
(a) Only 5 tags
(b) Predefined tags
(c) Custom tags
(d) HTML tags
Answer: (c) XML uses user defined or custom tags.

Q2. XML was not designed to      CBSE 2013
(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.

Q3. 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.

Q4. An XML document can be viewed in a CBSE 2014
(a) Word processor
(b) Web browser
(c) Notepad
(d) None of these
Answer: (b) An XML document can be viewed in a Web browser.

Q5. Name the root element in the following XML document:   CBSE 2011

<father>
<child1>
<name> Megha </name>
<age> 12 </age>
</child1>
<child2><name > Mana </name>
<age> 15 </age>
</child2>
</father>

(a) child 1
(b) child2
(c) father
(d) name
Answer: (c) father is the root element.

Q6. 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.

Q7. 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.

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.

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.

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.

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

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

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.

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.

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

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

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

18. DTD definition is used alongwith XML to specify     CBSE 2014
(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.

Q19. Valid XML document means CBSE 2016
(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.

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

21. Comment in XML can be given by:   CBSE 2016

(a) <?-->
(b) <!-- >
(c) <?!-->
(d) <!?-->

Answer: (b) <!–>

22. Which of the following XML fragments are well-formed? CBSE 2014

(a) < element attribute = value >
(b) < element attribute = "value" >
(c) < element attribute = !value >
(d) < element attribute ='value'>

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

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/>

24. Is this, a “well-formed” XML document? CBSE 2011

<?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.

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.

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.

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

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.

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.

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 [1 Mark each]

Q1. ……… is used to define the structure of an XML document.
Answer: DTD

Q2. XML is subset of ……….. . CBSE 2016
Answer: SGML

Q3. An XML attribute is a ………. of an element.
Answer: property >

Q4. XML attribute values should always be enclosed in ………… . CBSE 2014
Answer: double quotes

Q5. ……….. are the building blocks of an XML document and are represented by using tags.
Answer: Elements

Q6. The combination of XML document, DTD and stylesheet is known as ………. .
Answer: XML document system

Q7. An element can be written without the end tag.
Answer: empty

Q8. An attribute is a ……….. pair contained in the start tag of the element.
Answer: name-value

Q9. In all XML documents, the ………….. element is the parent of all other elements. CBSE 2011
Answer: root

Q10. All XML documents must have one element. CBSE 2011, 2014
Answer: root

Q11. ………. refers to the preface to an XML document.
Answer: Prolog

Q12. In XML, ……….. cannot contain multiple values. CBSE 2016
Answer: attributes

Q13. You can validate an XML document by using the XML validator and …………… .
Answer: XML parser

Q14. A ………… confirms to all the XML guidelines.
Answer: well-formed document

Q15. An XML document has both a ……….. structure and a ………….. structure.
Answer: physical, logical

Q16. We need a/an ………….. to create and edit an XML document. CBSE 2013
Answer: XML parser

Q17. ……… is a text document that is commonly used to define the style and layout of an XML document.
Answer: CSS

Q18. The ……….. is an XML element to which the CSS style is applied.
Answer: selector

Q19. ……….. is used to describe data and ……….. is used to display data. CBSE 2012
Answer: XML, HTML

True or False [1 Mark each]

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

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

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

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

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

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

Q7. 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.

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

Q9. 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.

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

Q11. 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.

Q12. An XML document can have only limited number of child elements.
Answer: False XML document can have unlimited number of child elements.

Q13. Pseudo attributes are the settings that appear in prologs.
Answer: True Pseudo attributes describe the overall document.

Q14. 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.

Q15. 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.

Q16. In XML, tag names cannot contain spaces but can uses underscores.
Answer: True Tag name must start either with a letter or underscore (_) character.

Q17. In XML, every opening tag may not have a closing tag. CBSE 2013
Answer: False Every tag must contain the opening and closing tag.

Q18. Extension of an XML files is .html.
Answer: False html is the extension of HTML file. An XML file extension is .xml.

Q19. One of the attributes of XML tag is Type.
Answer: True type is a attribute of XML tag.

Q20. Comments are displayed in the output.
Answer: False Comments are not displayed in the output.

Q21. XML document must have one root element. CBSE 2016
Answer: True XML document must have one root element.

Q22. Physical structure includes the actual data of an XML file.
Answer: True Physical structure stores actual data in the form of entity.

Q23. 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.

Q24. 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.

Q25. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *