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.

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.

Q 3 - Which of the following method is used to read contents in SAX parsing?

A - startDocument()

B - characters()

C - startElement()

D - endElement()

Answer : B

Explaination

characters() method is called when character data is encountered and can be used to read contents.

Q 4 - Which component of JDOM Parser represents text of XML tag?

A - Document

B - Element

C - Attribute

D - Text

Answer : D

Explaination

Text represents the text of XML tag.

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 selects the current node?

A - .

B - /

C - ./

D - //

Answer : A

Explaination

. selects the current node.

Q 9 - Can we create an XML document using StAX parser?

A - true

B - false

Answer : A

Explaination

Yes! Using StAX parser, we can parse, modify and create a XML document.

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