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 on event based triggers and does not load the complete document into the memory?

A - Dom Parser

B - SAX Parser

C - JDOM Parser

D - StAX Parser

Answer : B

Explaination

SAX Parser parses the document on event based triggers and does not load the complete document into the memory.

Answer : C

Explaination

DOM stands for Document Object Model.

Q 3 - Which component of JDOM Parser represents DOM tree?

A - Document

B - Element

C - Attribute

D - Text

Answer : A

Explaination

Document represents the entire XML document. A Document object is often referred to as a DOM tree.

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 8 - Is SAX parser a PUSH API?

A - true

B - false

Answer : A

Explaination

SAX Parser is PUSH API Parser so that client application is required to get information when SAX parser notifies the client application that information is available.

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.

Q 10 - Which of the following predicate selects the first student element that is the child of the class element?

A - /class/student[1]

B - /class/student[last()]

C - /class/student[first()-1]

D - None of the above.

Answer : A

Explaination

/class/student[1] predicate selects the first student element that is the child of the class element.

java_xml_questions_answers.htm
Advertisements