XML Elements MCQ
This section focuses on "Elements" in XML. These Multiple Choice Questions (MCQ) should be practiced to improve the XML skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. Elements can behave as containers to hold?
A. Objects
B. text
C. attributes
D. All of the above
View Answer
Ans : D
Explanation: XML elements can be defined as building blocks of an XML. Elements can behave as containers to hold text, elements, attributes, media objects or all of these.
2. Each XML document contains _______ element?
A. Zero
B. One
C. Zero and more
D. One and more
View Answer
Ans : D
Explanation: Each XML document contains one or more elements.
3. Which of the following is correct syntax to write an XML element?
A. <?element-name attribute1 attribute2>
B. <?element-name attribute1 attribute2?>
C. <element-name attribute1 attribute2>
D. <! element-name attribute1 attribute2>
View Answer
Ans : C
Explanation: Following is the syntax to write an XML element : <element-name attribute1 attribute2>
4. Element with no content is known as?
A. free element
B. empty element
C. vacent element
D. idle element
View Answer
Ans : B
Explanation: An empty element : element with no content.
5. Which of the following is correct XML Elements Rules?
A. The only punctuation mark allowed in names are the hyphen (-).
B. An element name cannot contain any alphanumeric characters.
C. Start and end tags of an element must be identical.
D. Names are case insensitive
View Answer
Ans : C
Explanation: Start and end tags of an element must be identical is true statement.
6. Which of the following is true?
A. An attribute defines a property of the element.
B. An element, which is a container, can contain text or elements
C. The only punctuation mark allowed in names are the hyphen (-), under-score (_) and period (.).
D. All of the above
View Answer
Ans : D
Explanation: All of the above statement are true.
7. The default model for complex type, in XML schemas for element is
A. textOnly
B. elementOnly
C. no default type
D. Both A and B
View Answer
Ans : B
Explanation: The default model for complex type, in XML schemas for element is elementOnly.
8. A validating XML application should be used when?
A. the design demands that all elements use both start and end tags
B. missing or out-of-place elements could cause application errors
C. attribute values cannot refer to external entity references
D. High performance is an important architectural constraint
View Answer
Ans : B
Explanation: A validating XML application should be used when missing or out-of-place elements could cause application errors.
9. The syntax for writing the minimum occurrence for an element is?
A. <xsd:element ref=” note” min=” 0” />
B. <xsd:elements ref=” note” min=” 0” />
C. <xsd:elements ref=” note” minOccur=”0” />
D. <xsd:elements ref=” note” minOccurs=” 0” />
View Answer
Ans : D
Explanation: The syntax for writing the minimum occurrence for an element is : <xsd:elements ref=” note” minOccurs=” 0” />
10. Which of the following is used to specify the attribute list of an element?
A. ATTLIST
B. ?ATTLIST
C. !ATTLIST
D. #ATTLIST
View Answer
Ans : C
Explanation: !ATTLIST is used to specify the attribute list of an element.
Discussion