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 1 - Which of the following component represent base datatype of the DOM in DOM Parsing?

A - Node

B - Element

C - Attr

D - Document

Answer : A

Explaination

Node represents the base datatype of the DOM.

Answer : C

Explaination

JDOM Parser is of low memory footprint and is nearly as fast as SAX.

Q 4 - Which of the following class of StAX parser specifies methods for creating an event?

A - XMLEventReader

B - XMLEventWriter

C - Both of the above.

D - None of the above.

Answer : B

Explaination

XMLEventWriter specifies methods for creating an event.

Q 5 - XPath defines the parts of an XML document like element, attribute, text, namespace, processing-instruction, comment, and document nodes.

A - true

B - false

Answer : A

Explaination

XPath defines the parts of an XML document like element, attribute, text, namespace, processing-instruction, comment, and document nodes.

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.

Answer : C

Explaination

JDOM gives java developers flexibility and easy maintainablity of xml parsing code. It is light weight and quick API.

Q 10 - Which method of the following of StAX Parser can be used to obtain characters such a CDATA, whitespace etc?

A - StartElement asStartElement()

B - EndElement asEndElement()

C - Characters asCharacters()

D - None of the above.

Answer : C

Explaination

Characters asCharacters() of XMLEventReader class can be used to obtain characters such a CDATA, whitespace etc.

java_xml_questions_answers.htm
Advertisements