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

Q 1 - Which of the following parses the document in similar fashion to DOM parser but in more easier way?

A - Dom Parser

B - SAX Parser

C - JDOM Parser

D - StAX Parser

Answer : C

Explaination

JDOM Parser parses the document in similar fashion to DOM parser but in more easier way.

Answer : C

Explaination

SAX (the Simple API for XML) is an event-based parser for xml documents.Unlike a DOM parser, a SAX parser creates no parse tree.

Answer : C

Explaination

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

Q 4 - Which component of JDOM Parser represents XML attribute?

A - Document

B - Element

C - Attribute

D - Text

Answer : C

Explaination

Element represents an attribute of an element. Attribute has method to get and set the value of attribute. It has parent and attribute type.

Q 5 - XPath provides a rich library of standard functions for manipulation of string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values etc.

A - true

B - false

Answer : A

Explaination

XPath provides a rich library of standard functions for manipulation of string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values etc.

Answer : C

Explaination

DOM4J is an open source, java based library to parse XML document. It is highly flexible, high-performance, and memory-efficient API.

Q 9 - Is StAX parser a PULL API?

A - true

B - false

Answer : A

Explaination

StAX parser is a PULL API. It means in case of StAX parser, client application need to ask StAX parser to get information from XML whenever it needs.

Q 10 - Which method of the following of StAX Parser can be used to retrieve value and attributes of element?

A - StartElement asStartElement()

B - EndElement asEndElement()

C - Characters asCharacters()

D - None of the above.

Answer : A

Explaination

StartElement asStartElement() of XMLEventReader class can be used to retrieve value and attributes of element.


java_xml_questions_answers.htm

Advertisements