1. Fill in the blanks,
a.__________is the extension of an XML file name.
b. XML altribute value should always be enclosed in__________
c. An XML document can only have one__________elements.
d. Some characters that have a special meaning in XML are called____________
e. PCDATA stands for Parsed___________Data.

Answer:-
a. .xml
b. Double quotation marks (“”)
c. Root
d. Reserved character
e. Character

2. Write T for the True statement and F for the False one. Correct the false statement(s).
a. An XML. document can have only a limited number of child elements.
b. XML is not case sensitive.
c. XML is designed to replace HTML.
d. XML is a software and hardware dependent language used for carrying information.
e. XML was developed as per W3C’s recommendation.
Answer:-
a. F
c. F
b. F
d. T
e. T

3. Choose the correct opfion.
a. Which one of the following is a valid name for an XML element?
i. <xmldocument> ii. <12rollno> iii. <customer number> ivRstudent>
b. Which of the following is the correct element type declaration for the occurrence of the ‘FirstName’ element and the ‘LastName’ element in arder, as the child element of the ‘Name’ Element?
i.<!ELEMENT Name (FirstName)>
<!ELEMENT Name (LastName)>
ii. <!ELEMENT Name (FirstName, LastName )>
iii. <!ELEMENT Name (FirstName | LastName )>
iv, <!ELEMENT Name (FirstName / LastName )>
C. Which of the following is used to specify the attribute list of an element?
i.#ATTLIST ii.!ATTLIST iii.*ATTLIST iv.?ATTLIST
d. The characters associated with elements that control how many times an element may appear in the XML document are
i.? ii.* iii.+ iv. All of these
e. The statement for associating external DTD declaration with ‘item.dtd’ is
i. <!DOCTYPE “item.dtd”>
ii. <!DOCTYPE SYSTEM “item.dtd”>
ii. <!DOCTYPE item SYSTEM “item.dtd”>
iv. <! DOCTYPE rcot SYSTEM “item.dtd”>

Answer:-
a. <student>
b. <!ELEMENT Name (FirstName)>
<!ELEMENT Name (LastName)>
c. IATTLIST
d. All of these
e. <!DOCTYPE item SYSTEM “item.dtd”>

4. Short answer questions

a. What is DTD? List the two types of DTD?
Ans: DTD (Document Type Definition) provides a list of elements contained in an XML document and provides their relationships with one  another.
Two types of DTD are:- (i) Internal DTD
(ii) External DTD

b. What is an XML parser? Define the two types of XML parsers.
Ans: XML parser is a software that reads an XML document, identifies all the XML tags, and passes the data to various applications.
The two types of XML parsers are:-
(i) Non-validating XML parser:- It checks if an XML document is well-formed, i.e., if the document is properly marked up according to syntax rules. All browsers are non-validating XML parsers. Examples are OpenXML, Lark, XP, etc.
(ii) Validating XML parser:- It checks if an XML document is well-formed, ensures that all the elements in the document are exactly specified as in the DTD to which the document is bound, i.e., it checks the validity of the XML document. Examples are XML4C, XML4J, etc.

c. What does an attribute list declaration contains?
Ans: The attribute list declaration contains the following information:

•The element to which an attribute is associated
• The name of the attribute
• The type of the attribute
• The default value of the attribute

d. What are the four default values of an attribute?
Ans: The four default values of an attribute are:-
(i)#REQUIRED
(ii)#IMPLIED
(ii)#FIXED
(iv)#SUPPLIED
e. What is an entity? What are its two types?
Ans: An entity is a sequence of characters used to represent another sequence of characters.
Its two types are:-

• Pre-defined entity
• User-defined entity

5. Long Answer Question
a. List five differences between HTML and XML.
Ans: The five differences between HTML and XML are:-
(i)XML was designed to store, carry and exchange data whereas HTML was designed to display it.

(ii)In XML, data is stored in a separated XML file and can be updated with a few lines of JavaScript whereas in HTML, the static text content is placed between the tags and is never modified by any process.

(iii) In XML,sharing of data is possible and it is independent of the software and hardware used whereas in HTML,data is a part of the HTML document.It is not stored separately and therefore such sharing of data is not possible.

(iv)In XML tags are user-defined whereas in HTML, tags are pre-defined.
(v)In XML, all tags must be enclosed whereas in HTML, it is not necessary to close each tag

b. What are the rules for defining a well-formed XML document?
Ans: The rules for defining a well-formed XML document are:-
(i)The ‘root’ and ‘child’ element must be nested in a proper way.
(ii)Each start tag must have the corresponding end tag.
(ii)All empty tags must be enclosed properly.
(iv)As XML tags are case-sensitive, the start and the end tags must be of the same spelling and case.
(v)XML’s attribute values are enclosed within double quotation marks.

c. Explain the difference between comma and pipe symbols in deciding how elements are used within an XML document.
Ans: The difference between comma and pipe symbols in deciding how elements are used within an XML document are In comma (,), the elements must appear strictly in the order in which they are defined in the element declaration whereas, in pipe (), the elements may appear one or more times in any order.

d. What is the difference in using the character? (question mark), *(asterisk) and +(plus) to control how many times an element appears in the XML document?
Ans: The difference in using the character?(question mark), *(asterisk) and +(plus) to control how many times an element appears in the XML document are:-
(i)? (Question mark)- This symbol indicates that an element may not appear at all or may appear once in the XML document (0 or 1).
(ii)* (Asterisk) – This symbol indicates that an element may not appear at allor may appear any number of times in the XML document (0 or many).
(iii)+ (Plus) + This symbol indicates that an element may not appear at all or any number of times in the XML document (1 or many).

e. Explain the four variations in specifying the value of an attribute by using an example each?
Ans: The four variations in specifying the value of an attribute are:-
(i)REQUIRED- The value of the attribute must be supplied.
(ii)IMPLIED- The XML application decides which value of the attribute to use if no value is supplied.
(iii)FIXED- The value of the attribute is included in the declaration itself. The XML document must either supply the same value or nothing.
(iv)SUPPLIED- The DTD supplies the default value of the attribute if it is not provided in the XML document. If the value is supplied, the supplied value is used.
Examples:
Attribute Type Declaration in DTD code
<IATTLIST emp status CDATA #REQUIRED>
<!ATTLIST emp status CDATA #IMPLIED>
<!ATTLIST emp status CDATA #FIXED “Permanent”>
<!ATTLIST emp status CDATA “Permanent”>

XML code
<emp status = “Permanent”>
<emp/> or <emp status = “Permanent”>
<emp status/> or <emp status = “Permanent”>
<emp status = “Temporary”> or <emp status “Contract”> or <emp status/>

LEAVE A REPLY

Please enter your comment!
Please enter your name here