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.

Q 2 - Can we create an XML document using DOM parser?

A - true

B - false

Answer : A

Explaination

Yes! Using DOM parser, we can parse, modify or create a XML document.

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 provide iterator of events which can be used to iterate over events as they occur while parsing the XML document?

A - XMLEventReader

B - XMLEventWriter

C - Both of the above.

D - None of the above.

Answer : A

Explaination

XMLEventReader provide iterator of events which can be used to iterate over events as they occur while parsing the XML document.

Answer : C

Explaination

XPath is an official recommendation of the World Wide Web Consortium (W3C).It defines a language to find information in an XML file.

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

A - .

B - /

C - ./

D - //

Answer : A

Explaination

. selects the current node.

Q 7 - Which of the following method of DOM4J Parser gets all the attributes of an element?

A - Document.valueOf(@Name)

B - Element.valueOf(@Name)

C - Node.valueOf(@Name)

D - Dom4j.valueOf(@Name)

Answer : C

Explaination

Node.valueOf(@Name) gets all the attributes of an element.

Q 8 - XML is Extensible.

A - false

B - true

Answer : B

Explaination

In XML, custom tags can be created and used very easily.

Answer : C

Explaination

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

Answer : C

Explaination

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

java_xml_questions_answers.htm
Advertisements