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

Answer : D

Explaination

All of the above options are correct.

Q 2 - Which of the following method returns the root element of the document in DOM Parsing?

A - Node.getRoot()

B - Document.getDocumentElement()

C - Node.getFirstChild()

D - Node.getLastChild()

Answer : B

Explaination

Document.getDocumentElement() returns the root element of the document in DOM Parsing.

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

A - Element.getRootElement()

B - Document.getRootElement()

C - Node.getRootElement()

D - Node.getChild(Name)

Answer : B

Explaination

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

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 current node?

A - .

B - /

C - ./

D - //

Answer : A

Explaination

. selects the current node.

Answer : A

Explaination

Parsing XML refers to going through XML document to access data or to modify data in one or other way.

Q 9 - Can we create an XML document using StAX parser?

A - true

B - false

Answer : A

Explaination

Yes! Using StAX parser, we can parse, modify and create 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