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 parses the document by loading the complete contents of the document and creating its complete hiearchical tree in memory?

A - Dom Parser

B - SAX Parser

C - JDOM Parser

D - StAX Parser

Answer : A

Explaination

Dom Parser parses the document by loading the complete contents of the document and creating its complete hiearchical tree in memory.

Answer : C

Explaination

DOM stands for Document Object Model.

Q 3 - Can we create an XML document using SAX parser?

A - true

B - false

Answer : B

Explaination

No! Using SAX parser, we can only parse or modify a XML document.

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 - Predicate in XPath are used to find specific node or a node containing specific value and are defined using [...] .

A - false

B - true

Answer : B

Explaination

Predicate in XPath are used to find specific node or a node containing specific value and are defined using [...] .

Q 6 - Which of the following XPath expression ensures that selection starts from the current node that match the selection?

A - .

B - /

C - ./

D - //

Answer : D

Explaination

// ensures that selection starts from the current node that match the selection.

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 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.

Answer : C

Explaination

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

java_xml_questions_answers.htm
Advertisements