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 XML based on expression and is used extensively in conjuction with XSLT?

A - XPath Parser

B - SAX Parser

C - JDOM Parser

D - StAX Parser

Answer : A

Explaination

XPath Parser parses the XML based on expression and is used extensively in conjuction with XSLT.

Answer : B

Explaination

SAX stands for Simple API for XML.

Q 3 - Which component of JDOM Parser represents XML Element?

A - Document

B - Element

C - Attribute

D - Text

Answer : B

Explaination

Element represents an XML element. Element object has methods to manipulate its child elements,its text, attributes and namespaces.

Q 4 - Which method of JDOM Parser builds the JDOM document from the xml source?

A - SAXBuilder.build(xmlSource)

B - Document.getRootElement()

C - Node.getRootElement()

D - Node.getChild(Name)

Answer : A

Explaination

SAXBuilder.build(xmlSource) builds the JDOM document from the xml source.

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.

Q 6 - Can we create an XML document using XPath parser?

A - true

B - false

Answer : B

Explaination

No! XPath parser is used to to navigate XML Document only. It is better to use DOM parser for creating XML.

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.

Answer : C

Explaination

The DOM is a common interface for manipulating document structures. One of its design goals is that Java code written for one DOM-compliant parser should run on any other DOM-compliant parser without changes.

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.

Answer : C

Explaination

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


java_xml_questions_answers.htm

Advertisements