Java XML Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to Java XML Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 2 - Which of the following component represent actual content of an element or attribute in DOM Parsing?

A - Text

B - Element

C - Attr

D - Document

Answer : A

Explaination

Text represents the actual content of an Element or Attr.

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 text of XML tag?

A - Document

B - Element

C - Attribute

D - Text

Answer : D

Explaination

Text represents the text of XML tag.

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 6 - Can we create an XML document using XPath parser?

A - true

B - false

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 7 - Which of the following method of DOM4J Parser gets the root element of the XML?

A - SAXReader.getRootElement()

B - Dom4j.getRootElement()

C - Document.getRootElement()

D - Node.getRootElement()

Answer : C

Explaination

Document.getRootElement() gets the root element of the XML.

Q 8 - XML is Extensible.

A - false

B - true

Answer : B

Explaination

In XML, custom tags can be created and used very easily.

Answer : C

Explaination

In both of the above situations, JDOM parser is preferred.

Q 10 - Can we modify an XML document using StAX parser?

A - true

B - false

Answer : A

Explaination

Yes! Using StAX parser, we can parse, modify and even create a XML document.

java_xml_questions_answers.htm
Advertisements