JAVA XML Mock Test



This section presents you various set of Mock Tests related to JAVA XML Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

JAVA XML Mock Test I

Answer : B

Explaination

XML stands for Extensible Markup Language.

Answer : D

Explaination

All of the above options are correct.

Q 4 - 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 5 - 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.

Q 6 - 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.

Q 7 - Which of the following parses the document in similar fashion to SAX parser but in more efficient way?

A - Dom Parser

B - SAX Parser

C - JDOM Parser

D - StAX Parser

Answer : D

Explaination

StAX Parser parses the document in similar fashion to SAX parser but in more efficient way.

Q 8 - 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.

Q 9 - Which of the following provides options to parse XML, XPath and XSLT using Java Collections Framework and provides support for DOM, SAX and JAXP?

A - XPath Parser

B - DOM4J Parser

C - JDOM Parser

D - StAX Parser

Answer : B

Explaination

DOM4J Parser is a java library to parse XML, XPath and XSLT using Java Collections Framework , provides support for DOM, SAX and JAXP.

Q 10 - Which of the following component represent base datatype of the DOM in DOM Parsing?

A - Node

B - Element

C - Attr

D - Document

Answer : A

Explaination

Node represents the base datatype of the DOM.

Q 11 - Which of the following component represent actual content of an element or attribute in DOM Parsing?

A - Text

B - Element

C - Attr

D - Document

Answer : A

Explaination

Text represents the actual content of an Element or Attr.

Q 12 - Which of the following method returns the root element of the document in DOM Parsing?

A - Node.getRoot()

B - Document.getDocumentElement()

C - Node.getFirstChild()

D - Node.getLastChild()

Answer : B

Explaination

Document.getDocumentElement() returns the root element of the document in DOM Parsing.

Q 13 - Which of the following method returns the first child of a given Node in DOM Parsing?

A - Node.getChild()

B - Document.getFirstChild()

C - Node.getFirstChild()

D - Node.getLastChild()

Answer : C

Explaination

Node.getFirstChild() returns the first child of a given Node in DOM Parsing.

Answer : C

Explaination

DOM stands for Document Object Model.

Answer : D

Explaination

DOM is an official recommendation of the World Wide Web Consortium (W3C). It defines an interface that enables programs to access and update the style, structure,and contents of XML documents. XML parsers that support the DOM implement that interface.

Answer : C

Explaination

When you parse an XML document with a DOM parser, you get back a tree structure that contains all of the elements of your document. The DOM provides a variety of functions you can use to examine the contents and structure of the document.

Q 17 - 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 : B

Explaination

SAX stands for Simple API for XML.

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.

Q 21 - Can we create an XML document using SAX parser?

A - true

B - false

Answer : B

Explaination

No! Using SAX parser, we can only parse or modify a XML document.

Q 22 - Which of the following method get called when document begins in SAX parsing?

A - startDocument()

B - endDocument()

C - startElement()

D - endElement()

Answer : A

Explaination

startDocument() method is called at the beginning of a document.

Q 23 - Which of the following method get called when document ends in SAX parsing?

A - startDocument()

B - endDocument()

C - startElement()

D - endElement()

Answer : B

Explaination

endDocument() method is called at the end of a document.

Q 24 - Which of the following method get called when element starts in SAX parsing?

A - startDocument()

B - endDocument()

C - startElement()

D - endElement()

Answer : C

Explaination

startElement() method is called at the start of an element.

Q 25 - Which of the following method get called when element ends in SAX parsing?

A - startDocument()

B - endDocument()

C - startElement()

D - endElement()

Answer : D

Explaination

endElement() method is called at the end of an element.

Answer Sheet

Question Number Answer Key
1 B
2 D
3 D
4 A
5 B
6 C
7 D
8 A
9 B
10 A
11 A
12 B
13 C
14 C
15 D
16 C
17 A
18 B
19 C
20 D
21 B
22 A
23 B
24 C
25 D
java_xml_questions_answers.htm
Advertisements