- 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 IV
Q 1 - When to use a DOM Parser?
A - You need to know a lot about the structure of a document.
B - You need to move parts of the document around.
C - You need to use the information in the document more than once.
Answer : D
Explaination
In all of the above situations, DOM parsing is preferred.
Q 2 - What are the advantages of DOM Parsing?
A - The DOM is a common interface for manipulating document structures.
Answer : C
Explaination
The DOM is a common interface for manipulating document structures. One of its design goals is that Java code written for one DOM-compliant parser should run on any other DOM-compliant parser without changes.
Q 3 - What is a SAX Parser?
A - SAX Parser is an event-based parser for xml documents.
Answer : C
Explaination
SAX Parser is an event-based parser for xml documents.SAX Parser is PUSH API Parser so that client application is required to get information when SAX parser notifies the client application that information is available.
Answer : A
Explaination
SAX Parser is PUSH API Parser so that client application is required to get information when SAX parser notifies the client application that information is available.
Q 5 - When to use a SAX Parser?
A - You can process the XML document in a linear fashion from the top down.
B - You are processing a very large XML document whose DOM tree would consume too much memory.
C - The problem to be solved involves only part of the XML document
Answer : D
Explaination
In all of the above situations, SAX parsing is preferred.
Q 6 - Which of the following is true about JDOM Parser?
A - JDOM is an open source, java based library to parse XML document.
Answer : C
Explaination
JDOM is an open source, java based library to parse XML document and it is typically java developer friendly API.
Q 7 - Which of the following is true about JDOM Parser?
A - JDOM is an open source, java based library to parse XML document.
Answer : C
Explaination
JDOM is an open source, java based library to parse XML document and it is typically java developer friendly API.
Q 8 - When to use a JDOM Parser?
A - You need to know a lot about the structure of a document.
Answer : C
Explaination
In both of the above situations, JDOM parser is preferred.
Q 9 - When to use a JDOM Parser?
A - You need to use the information in the document more than once.
B - You are a java developer and want to leverage java optimized parsing of XML.
Answer : C
Explaination
In both of the above situations, JDOM parser is preferred.
Q 10 - What are the advantages of JDOM parser?
A - flexibility and easy maintainablity of xml parsing code.
Answer : C
Explaination
JDOM gives java developers flexibility and easy maintainablity of xml parsing code. It is light weight and quick API.
Q 11 - What is a StAX Parser?
A - StAX is a JAVA based PULL API to parse XML document.
Answer : C
Explaination
StAX is a JAVA based PULL API to parse XML document. It is very quick API and uses streams.
Answer : A
Explaination
StAX parser is a PULL API. It means in case of StAX parser, client application need to ask StAX parser to get information from XML whenever it needs.
Answer : A
Explaination
StAX parser is a PULL API. It means in case of StAX parser, client application need to ask StAX parser to get information from XML whenever it needs.
Answer : A
Explaination
Yes! Using StAX parser, we can parse, modify and create a XML document.
Answer : A
Explaination
Yes! Using SAX parser, we can parse, modify a XML document.
Answer : A
Explaination
Yes! Using StAX parser, we can parse, modify and even create a XML document.
Q 17 - When to use a StAX Parser?
A - You can process the XML document in a linear fashion from the top down.
Answer : C
Explaination
In both of the above situations, StAX parser is preferred.
Q 18 - When to use a StAX Parser?
A - You are processing a very large XML document whose DOM tree would consume too much memory.
Answer : C
Explaination
In both of the above situations, StAX parser is preferred.
Q 19 - When to use a StAX Parser?
A - You are processing a very large XML document whose DOM tree would consume too much memory.
Answer : C
Explaination
In both of the above situations, StAX parser is preferred.
Q 20 - Which method of the following of StAX Parser can be used to retrieve value and attributes of element?
Answer : A
Explaination
StartElement asStartElement() of XMLEventReader class can be used to retrieve value and attributes of element.
Q 21 - Which method of the following of StAX Parser can be used to obtain characters such a CDATA, whitespace etc?
Answer : C
Explaination
Characters asCharacters() of XMLEventReader class can be used to obtain characters such a CDATA, whitespace etc.
Q 22 - Which method of the following of StAX Parser can be used to add start element of given name?
A - writeStartElement(String localName)
B - writeEndElement(String localName)
Answer : A
Explaination
writeStartElement(String localName) of XMLStreamWriter class can be used to add start element of given name.
Q 23 - Which method of the following of StAX Parser can be used to add end element of given name?
A - writeStartElement(String localName)
B - writeEndElement(String localName)
Answer : B
Explaination
writeEndElement(String localName) of XMLStreamWriter class can be used to add end element of given name.
Q 24 - Which of the following predicate selects the first student element that is the child of the class element?
Answer : A
Explaination
/class/student[1] predicate selects the first student element that is the child of the class element.
Q 25 - Which of the following predicate selects the last student element that is the child of the class element?
Answer : B
Explaination
/class/student[last()] predicate selects the last student element that is the child of the class element.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | C |
3 | C |
4 | A |
5 | D |
6 | C |
7 | C |
8 | C |
9 | C |
10 | C |
11 | C |
12 | A |
13 | A |
14 | A |
15 | A |
16 | A |
17 | C |
18 | C |
19 | C |
20 | A |
21 | C |
22 | A |
23 | B |
24 | A |
25 | B |