IT Certification Exam Preparation
McAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
 View-Cart   
 Certification Exams

Certification Primer for XML and Related Technologies

Certification Primer for XML and Related Technologies: Sample Questions
Return to article

Try your hand at the sample questions below for a preview of what to expect from the IBM XML certification exam. These questions and answers are provided, courtesy Whizlabs Software, a company specializing in IT certification training software. See the article Resources to learn more about Whizlabs and other organizations that offer IT certification training.

You can also access the pre-assessment/sample test offered by IBM by visiting IBM's site.
Question 1

An e-business company plans to redesign its XML data model to allow support for more data types. It also proposes to change the XML data model by replacing some attributes with elements, allowing multiple values.

Which of the following statements regarding the changing of an attribute to an element are true?

Choices
A. The XML parser that parses the XML documents has to be rewritten
B. The XSL processor that parses the product information has to be rewritten
C. The XSL template that processes the product information has to be modified
D. The application logic that generates the XML conforming to the XML data model has to be modified

Correct choices
C and D

Explanation
Choices C and D are the correct answers.

Choice C is correct because any change to the XML document structure will require a corresponding change to the XSL style sheet. If an attribute is changed to an element, the XSL style sheet will have to be changed to select an element instead of an attribute.

Choice D is correct because the application, which generates the XML, will need to generate an element instead of an attribute in order to ensure that the XML document remains valid according to the new data model.

Choice A is incorrect because the XML parser is independent of the XML document that it parses. Changes to the XML document that needs to be parsed will not necessitate changes to the XML parser model.

Choice B is incorrect because the XSL processor itself does not change if the structure of an XML document is altered.
 Top  
Question 2

A manufacturing company wants to redesign a legacy system. XML is chosen as the data exchange format between the different processes in the system, which run on various platforms to ensure that the data transmitted is platform independent.

It is proposed to have an XML-based application in the system to generate XML data from the database and send it to any process that might need it. Also, the same XML document generated will contain the data for different database tables, all of which have different keys.

Which of the following DTD or Schema constructs is most likely to be used in the system?

Choices
A. ID/IDREF
B. xsl:key
C. unique
D. key / keyref
E. generate-id()

Correct choice
D

Explanation
Choice D is the correct answer.

'key' and 'keyref' constructs can be used to limit the scope of keys in an XML document. So, it is possible to create a key that is only unique to a certain level of the markup (allowing a key to be unique for a chosen table, if the table is represented as an element). Hence, choice D is correct.

Choice A is incorrect because 'ID/IDREF' cannot be used to limit the scope of keys in an XML document. So, in the given scenario, it will not be possible to have the XML data for several tables in a single XML document, since the tables have different keys.

Choice B is incorrect because 'xsl:key' is used in style sheets and not for XML data modeling.

Choice C is incorrect because 'unique' is an invalid construct.

Choice E is incorrect because 'generate-id()' is an XSLT function and is not meant for use in XML data modeling.

 Top  
Question 3

Which of the following DTDs will successfully validate the XML document below?

<root> <root1/> <root2> root2 data </root2> <root3> root3 data </root3> <root3/> </root>

(Assume that the XML document references the file that contains the DTD with the element root defined as the root element.)

Choices
<!ELEMENT root (root1,root2?,root3*,root4*)*>
<!ELEMENT root1 (#PCDATA)>
<!ELEMENT root2 (#PCDATA)>
<!ELEMENT root3 (#PCDATA)>
<!ELEMENT root4 (#PCDATA)>

<!ELEMENT root1 (#PCDATA)>
<!ELEMENT root2 (#PCDATA)>
<!ELEMENT root3 (#PCDATA)>
<!ELEMENT root4 (#PCDATA)>
<!ELEMENT root (root1+,root2+,root3?)+>

<!ELEMENT root1 (#PCDATA)>
<!ELEMENT root2 (#PCDATA)>
<!ELEMENT root3 (#PCDATA)>
<!ELEMENT root (root1+,root2+,root3?)+>

<!ELEMENT root1 EMPTY>
<!ELEMENT root2 ANY>
<!ELEMENT root3 (#PCDATA)>

Correct choice
A

Explanation
Choice A is the correct answer.

Choice A is correct since, as per the DTD, all the elements can contain parsed character data and the specified XML document contains root1, root2, and root3 in that sequence; root4 is optional since the * cardinality operator is used for root4.

Choice B is incorrect since root4 is not a part of the given XML document, and as per the DTD, at least one instance of the root4 element must be present in any XML document that conforms to the DTD.

Choices C and D are incorrect since the root3 element is defined with the cardinality operator ? to indicate that only zero or one instance of the root3 element can occur in any XML document that conforms to the specified DTD. In the given XML document, there are 2 root3 elements, thereby making the XML document invalid as per the DTD.

 Top  
Question 4

An XML-based application is written to parse an input XML file, verify that it conforms to a particular schema, and update the database with the data from the XML file. The schema requires that an element with name 'partName' should still appear in the input XML file, even if it has no content, so that the database can be updated with null values for that particular field. This restriction in the XML schema can be enforced by adding which of the following lines in the schema?

Choices
A. <element name="partName" nullable="true"/>
B. <element name="partName" nillable="true"/>
C. <element name="partName" nill="true"/>
D. <element name="partName" default="null"/>
E. <element name="partName" default="nill"/>
F. None of the above

Correct choice
B

Explanation
Choice B is the correct answer.

Choice A is incorrect since nullable is not a valid attribute of element.

Choice C is incorrect since nill is not a valid attribute of element.

Choices D and E are incorrect since default is not a valid attribute of element.
 Top  
Question 5

What is the output of the code given below?

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="MyTest.xsl"?>
<test:MyNode xmlns:test="http://www.whizlabs.com">
<test:foo>Some Element Text</test:foo>
</test:MyNode>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0"
xmlns:whiz="http://www.whizlabs.com">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
<body>
</html>
<xsl:template>
<xsl:template match="whiz:MyNode">
<xsl:apply-templates/>
<xsl:template>
<xsl:template match="whiz:foo">
<h1>FOUND</h1>
<xsl:template>
<xsl:stylesheet>

Choices
A. The parser issues a test.xsl:13: undefined prefix error message
B. <h1>FOUND</h1> is inserted into the new XML document
C. The page renders the URI for www.whizlabs.com
D. A table of elements is inserted into the document
E. Nothing is inserted into the new XML document

Correct choice
B

Explanation
Choice B is the correct answer.

While processing XML documents, the namespace prefix is replaced with the namespace URI. In this question, the namespace prefixes are different in the XML document and the XSL document, but the namespace URI is the same, so there won't be any problem in matching the elements. When the processing starts, the first template matches the root node and the tags <html> and <body> are written out, then the xsl:apply-templates instruction causes the processing of child nodes. The test:MyNode matches whiz:MyNode and then again the xsl:apply-templates instruction causes processing of it's child nodes. Now test:foo matches whiz:foo and <h1>FOUND<h1> is inserted into the document, and the processing is completed.

 Top  
Question 6

A Web-based company wants to improve the performance of its website. It is very important to the company that the site be accessible on various kinds of browsers, handheld devices, etc. The website runs an XML-based application, which reads data from the database in XML format and parses it using DOM. Due to budget constraints, the company cannot upgrade the hardware to improve performance. It is proposed to improve the performance of the website by making changes to the XML-based Web application to enhance performance.

What changes to the XML-based Web application are most likely to be considered by a developer who is assigned the job of improving the application's performance?

Choices
A. Convert the XML documents from the database into static HTML pages for hosting on the server, thereby reducing the time it takes to perform the conversion at request time.
B. Pass XML directly to the Web browser.
C. Use SAX instead of DOM to parse the XML document.
D. Use attributes instead of elements to reduce XML document size.

Correct choice
C

Explanation
Choice C is the correct answer.

Choice C is correct since SAX is significantly faster than DOM and requires less memory. The main advantage of DOM is that it allows the XML document to be modified in memory. However, it has not been mentioned that the document needs to be modified in memory by the Web application, SAX is a better choice, as it parses faster.

Choice A is incorrect because by generating static HTML pages, handheld devices cannot be serviced, as they cannot read HTML pages.

Choice B is incorrect because the Web application needs to be accessible from various kinds of browsers, some of which may not be able to understand XML. Also, a user of a Web application expects to get well-formatted pages rather than straight XML.

Choice D is incorrect because changing attributes to elements will not significantly reduce the XML document size. Also, it may not be feasible to replace elements with attributes, since there cannot be two attributes with the same name for a particular element.

 Top  
Question 7

A C2C (client-to-client) company wants to bring together buyers and sellers to perform a transaction on its website. Visitors to this auction site who want to sell something can search and discover sellers and interact with them. The discovery and interaction process changes often and is very dynamic in nature.

Which of the following can most logically be assumed to be a part of the application architecture?

Choices
A. Validation of the XML data
B. WSDL for the search and discovery
C. UDDI for the search and discovery
D. SOAP for communication between buyers and sellers

Correct choice
C

Explanation
Choice C is the correct answer.

With UDDI (Universal Description, Discovery, and Integration) registry, a business (which could be an individual buyer or seller) can be registered once but published everywhere. Since the main task in the above scenario is to search the sellers or buyers, UDDI is the most logical solution to the problem. Hence, choice C is correct.

Choice A is incorrect because buyers and sellers do not exchange XML documents between themselves directly.

Choice B is incorrect because WSDL is not used for search and discovery.

Choice D is incorrect because even though SOAP messages may be used in the architecture, the scenario does not imply it and different types of messages could be exchanged.

Return to article

 Top  
   
Java Certification: SCJA, SCJP, SCWCD, SCBCD, SCEA, SCMAD, SCDJWS | SCJP 5.0 Online Training
Project Management Institute: PMI, PMP: PMP Certification | ITIL: ITIL
Articles & Tutorials

  Home | About Us | Feedback | Contact Us | Site Map

Privacy Policy | Copyrights & Trademarks 

Copyright © Whizlabs Software Pvt. Ltd. 2000-2008