Java XML Online Quiz


Advertisements


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 1 - Which of the following provides options to parse XML, XPath and XSLT using Java Collections Framework and provides support for DOM, SAX and JAXP?

A - XPath Parser

B - DOM4J Parser

C - JDOM Parser

D - StAX Parser

Answer : B

Explaination

DOM4J Parser is a java library to parse XML, XPath and XSLT using Java Collections Framework , provides support for DOM, SAX and JAXP.

Answer : C

Explaination

DOM stands for Document Object Model.

Q 3 - Which of the following method get called when element ends in SAX parsing?

A - startDocument()

B - endDocument()

C - startElement()

D - endElement()

Answer : D

Explaination

endElement() method is called at the end of an element.

Q 4 - Which method of JDOM Parser gets all the direct child nodes of an element?

A - Element.getChildren()

B - Document.getChildren()

C - Node.getChildren()

D - Node.getChild()

Answer : A

Explaination

Element.getChildren() gets all the direct child nodes of an element.

Q 5 - XPath uses a path expression to select node or list of nodes from an xml document.

A - true

B - false

Answer : A

Explaination

XPath uses a path expression to select node or list of nodes from an xml document.

Q 6 - Which of the following XPath expression selects the parent of the current node?

A - .

B - ..

C - ./

D - //

Answer : B

Explaination

.. selects the parent of the current node.

Q 7 - Can we create an XML document using DOM4J parser?

A - true

B - false

Answer : A

Explaination

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

Q 8 - XML allows Validation.

A - false

B - true

Answer : B

Explaination

Using XSD, DTD and XML structure can be validated easily.

Q 9 - Can we modify an XML document using SAX parser?

A - true

B - false

Answer : A

Explaination

Yes! Using SAX parser, we can parse, modify a XML document.

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