- 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 II
Q 1 - Which of the following method is used to read contents in SAX parsing?
Answer : B
Explaination
characters() method is called when character data is encountered and can be used to read contents.
Q 2 - Which of the following is true about JDOM Parser?
A - It is java optimized, it uses java collection like List and Arrays.
B - It works with DOM and SAX APIs and combines the best of the two.
Answer : C
Explaination
JDOM Parser is java optimized, it uses java collection like List and Arrays. It works with DOM and SAX APIs and combines the best of the two.
Q 3 - Which of the following is true about JDOM Parser?
A - It is of low memory footprint.
Answer : C
Explaination
JDOM Parser is of low memory footprint and is nearly as fast as SAX.
Q 4 - Which component of JDOM Parser represents DOM tree?
Answer : A
Explaination
Document represents the entire XML document. A Document object is often referred to as a DOM tree.
Q 5 - Which component of JDOM Parser represents XML Element?
Answer : B
Explaination
Element represents an XML element. Element object has methods to manipulate its child elements,its text, attributes and namespaces.
Q 6 - Which component of JDOM Parser represents XML attribute?
Answer : C
Explaination
Element represents an attribute of an element. Attribute has method to get and set the value of attribute. It has parent and attribute type.
Q 7 - Which component of JDOM Parser represents text of XML tag?
Answer : D
Explaination
Text represents the text of XML tag.
Q 8 - Which component of JDOM Parser represents comments in a XML document?
Answer : A
Explaination
Comment represents comments in a XML document.
Q 9 - Which method of JDOM Parser builds the JDOM document from the xml source?
Answer : A
Explaination
SAXBuilder.build(xmlSource) builds the JDOM document from the xml source.
Q 10 - Which method of JDOM Parser gets the root element of the XML?
Answer : B
Explaination
Document.getRootElement() get the root element of the XML.
Q 11 - Which method of JDOM Parser gets all the direct child nodes of an element?
Answer : A
Explaination
Element.getChildren() gets all the direct child nodes of an element.
Answer : A
Explaination
Yes! Using JDOM parser, we can parse, modify or create a XML document.
Q 13 - Which of the following is true about StAX Parser?
A - StAX is a JAVA based API to parse XML document in a similar way as SAX parser does.
Answer : C
Explaination
StAX is a JAVA based API to parse XML document in a similar way as SAX parser does but StAX is a PULL API where as SAX is a PUSH API.
Q 14 - Which of the following class of StAX parser provide iterator of events which can be used to iterate over events as they occur while parsing the XML document?
Answer : A
Explaination
XMLEventReader provide iterator of events which can be used to iterate over events as they occur while parsing the XML document.
Q 15 - Which of the following class of StAX parser specifies methods for creating an event?
Answer : B
Explaination
XMLEventWriter specifies methods for creating an event.
Q 16 - Which of the following is true about XPath?
A - XPath is an official recommendation of the World Wide Web Consortium (W3C).
B - It defines a language to find information in an XML file.
Answer : C
Explaination
XPath is an official recommendation of the World Wide Web Consortium (W3C).It defines a language to find information in an XML file.
Q 17 - Which of the following is true about XPath?
A - XPath is used to traverse elements and attributes of an XML document.
Answer : C
Explaination
XPath is used to traverse elements and attributes of an XML document. XPath provides various type of expressions which can be used to enquire relevant information from the XML document.
Q 18 - XPath defines the parts of an XML document like element, attribute, text, namespace, processing-instruction, comment, and document nodes.
Answer : A
Explaination
XPath defines the parts of an XML document like element, attribute, text, namespace, processing-instruction, comment, and document nodes.
Q 19 - XPath provides powerful path expressions select nodes or list of nodes in XML documents.
Answer : B
Explaination
XPath provides powerful path expressions select nodes or list of nodes in XML documents.
Q 20 - XPath provides a rich library of standard functions for manipulation of string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values etc.
Answer : A
Explaination
XPath provides a rich library of standard functions for manipulation of string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values etc.
Q 21 - XPath is one of the major element in XSLT standard and is must have knowledge in order to work with XSLT documents.
Answer : B
Explaination
XPath is one of the major element in XSLT standard and is must have knowledge in order to work with XSLT documents.
Answer : A
Explaination
XPath is official recommendation of World Wide Web Consortium (W3C).
Q 23 - Predicate in XPath are used to find specific node or a node containing specific value and are defined using [...] .
Answer : B
Explaination
Predicate in XPath are used to find specific node or a node containing specific value and are defined using [...] .
Q 24 - XPath uses a path expression to select node or list of nodes from an xml document.
Answer : A
Explaination
XPath uses a path expression to select node or list of nodes from an xml document.
Q 25 - Which of the following XPath expression will select all nodes with the given name 'nodename'?
Answer : A
Explaination
nodename selects all nodes with the given name 'nodename'.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | C |
3 | C |
4 | A |
5 | B |
6 | C |
7 | D |
8 | A |
9 | A |
10 | B |
11 | A |
12 | A |
13 | C |
14 | A |
15 | B |
16 | C |
17 | C |
18 | A |
19 | B |
20 | A |
21 | B |
22 | A |
23 | B |
24 | A |
25 | A |