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

Answer : B

Explaination

XML stands for Extensible Markup Language.

Answer : D

Explaination

DOM is an official recommendation of the World Wide Web Consortium (W3C). It defines an interface that enables programs to access and update the style, structure,and contents of XML documents. XML parsers that support the DOM implement that interface.

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

A - .

B - /

C - ./

D - //

Answer : B

Explaination

/ ensures that selection starts from the root node.

Answer : C

Explaination

XML Parser provides way how to access or modify data present in an XML document.

Answer : C

Explaination

StAX is a JAVA based PULL API to parse XML document. It is very quick API and uses streams.

Q 10 - Which method of the following of StAX Parser can be used to add end element of given name?

A - writeStartElement(String localName)

B - writeEndElement(String localName)

C - writeAttribute(String localName, String value)

D - None of the above.

Answer : B

Explaination

writeEndElement(String localName) of XMLStreamWriter class can be used to add end element of given name.

java_xml_questions_answers.htm
Advertisements