- Java XML Tutorial
- Java XML Home
- Java XML Overview
- Java XML Parsers
- Java DOM Parser
- Java DOM Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- Java SAX Parser
- Java SAX Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- JDOM XML Parser
- JDOM XML Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- Java StAX Parser
- Java StAX Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- Java XPath Parser
- Java XPath Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- Java DOM4J Parser
- Java DOM4J Parser
- Parse XML Document
- Query XML Document
- Create XML Document
- Modify XML Document
- Java XML Useful Resources
- Java XML - Questions and Answers
- Java XML - Quick Guide
- Java XML - Useful Resources
- Java XML - Discussion
JAVA XML Mock Test
This section presents you various set of Mock Tests related to JAVA XML Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
JAVA XML Mock Test III
Q 1 - Which of the following XPath expression ensures that selection starts from the root node?
Answer : B
Explaination
/ ensures that selection starts from the root node.
Q 2 - Which of the following XPath expression ensures that selection starts from the current node that match the selection?
Answer : D
Explaination
// ensures that selection starts from the current node that match the selection.
Answer : A
Explaination
. selects the current node.
Q 4 - Which of the following XPath expression selects the parent of the current node?
Answer : B
Explaination
.. selects the parent of the current node.
Answer : C
Explaination
@ selects attributes.
Q 6 - Which of the following XPath expression selects all student elements that are children of class?
Answer : D
Explaination
class/student selects all student elements that are children of class.
Q 7 - Which of the following XPath expression selects all student elements no matter where they are in the document?
Answer : D
Explaination
//student selects all student elements no matter where they are in the document.
Answer : B
Explaination
No! XPath parser is used to to navigate XML Document only. It is better to use DOM parser for creating XML.
Q 9 - Which of the following is true about DOM4J Parser?
A - DOM4J is an open source, java based library to parse XML document.
B - It is highly flexible, high-performance, and memory-efficient API.
Answer : C
Explaination
DOM4J is an open source, java based library to parse XML document. It is highly flexible, high-performance, and memory-efficient API.
Q 10 - Which of the following is true about DOM4J Parser?
A - DOM4J is java optimized and uses java collection like List and Arrays.
B - It works with DOM, SAX, XPath and XSLT.
C - It can parse large XML document with very low memory footprint.
Answer : D
Explaination
DOM4J is java optimized, it uses java collection like List and Arrays. It works with DOM, SAX, XPath and XSLT. It can parse large XML document with very low memory footprint.
Q 11 - Which of the following is true about Document Class of DOM4J Parser?
A - It represents the entire XML document. A Document object is often referred to as a DOM tree.
C - It represents Element, Attribute or ProcessingInstruction.
Answer : A
Explaination
Document Class represents the entire XML document. A Document object is often referred to as a DOM tree.
Q 12 - Which of the following is true about Element Class of DOM4J Parser?
A - It represents the entire XML document. A Document object is often referred to as a DOM tree.
C - It represents Element, Attribute or ProcessingInstruction.
Answer : B
Explaination
Element Class represents an XML element. Element object has methods to manipulate its child elements,its text, attributes and namespaces.
Q 13 - Which of the following is true about Attribute Class of DOM4J Parser?
A - It represents the entire XML document. A Document object is often referred to as a DOM tree.
C - It represents Element, Attribute or ProcessingInstruction.
Answer : D
Explaination
Attribute Class represents an attribute of an element. Attribute has method to get and set the value of attribute. It has parent and attribute type.
Q 14 - Which of the following is true about Node Class of DOM4J Parser?
A - It represents the entire XML document. A Document object is often referred to as a DOM tree.
C - It represents Element, Attribute or ProcessingInstruction.
Answer : C
Explaination
Node Class represents Element, Attribute or ProcessingInstruction.
Q 15 - Which of the following method of DOM4J Parser builds the DOM4J document from the xml source?
Answer : A
Explaination
SAXReader.read(xmlSource) builds the DOM4J document from the xml source.
Q 16 - Which of the following method of DOM4J Parser gets the root element of the XML?
Answer : C
Explaination
Document.getRootElement() gets the root element of the XML.
Q 17 - Which of the following method of DOM4J Parser gets the XML node at particular index in the element?
Answer : C
Explaination
Element.node(index) gets the XML node at particular index in the element.
Q 18 - Which of the following method of DOM4J Parser gets all the attributes of an element?
Answer : A
Explaination
Element.attributes() gets all the attributes of an element.
Q 19 - Which of the following method of DOM4J Parser gets all the attributes of an element?
Answer : C
Explaination
Node.valueOf(@Name) gets all the attributes of an element.
Answer : A
Explaination
Yes! Using DOM4J parser, we can parse, modify and create a XML document.
Answer : A
Explaination
Being plain text, XML is technology independent. It can be used by any technology for data storage and transmission purpose.
Answer : B
Explaination
In XML, custom tags can be created and used very easily.
Answer : B
Explaination
Using XSD, DTD and XML structure can be validated easily.
Q 24 - What is XML Parsing?
Answer : A
Explaination
Parsing XML refers to going through XML document to access data or to modify data in one or other way.
Q 25 - What is XML Parser?
A - XML Parser provides way how to access data present in an XML document.
B - XML Parser provides way how to modify data present in an XML document.
Answer : C
Explaination
XML Parser provides way how to access or modify data present in an XML document.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | D |
3 | A |
4 | B |
5 | C |
6 | D |
7 | D |
8 | B |
9 | C |
10 | D |
11 | A |
12 | B |
13 | D |
14 | C |
15 | A |
16 | C |
17 | C |
18 | A |
19 | C |
20 | A |
21 | A |
22 | B |
23 | B |
24 | A |
25 | C |