Sei sulla pagina 1di 51

IBM 000-142

IBM 000-142 Test 142,XML 1.1 and Related Technologies

Practice Test
Version 1.0

IBM 000-142: Practice Exam QUESTION NO: 1 Given the sample XML document below, assume that the "empnum" attribute of the "employee" element is defined as an ID attribute in the DTD. Which of the following restructuring proposals is the best solution? <employees> <employee empnum="e1"><name>Bob Smith</name></employee> <employee empnum="e2"><name>Carol Jones</name><manager>Bob Smith</manager></employee> <employee empnum="e3"><name>Keith Martin</name><manager>Carol Jones</manager></employee> <employee empnum="e4"><name>Monica Williams</name><manager>Carol Jones</manager></employee> </employees> A. Delete manager elements. Change DTD to add IDREF attribute named manager to employee element. Set value of manager attribute to match the empnum value of the employee's manager. B. Change DTD to add mgrnum ID attribute to manager element, whose value is set to match the empnum value of the employee's manager. Define manager element as "#EMPTY" and remove child values. C. Move each employee element to a child of the employee's manager, thus properly representing the hierarchical nature of the relationships. The ID attributes will enable simple selection using XPath. D. Delete manager elements. Change DTD making the empnum attribute an IDREF. Add ID attribute called mgrnum and set value to match the empnum value of the employee's manager. Answer: A

QUESTION NO: 2

A developer wishes to make an XSLT template more robust by checking a parameter passed to it for errors and boundary conditions. The template accepts a parameter of type number. What condition will NOT have to be checked? A. type of the parameter value B. Integer numbers C. value of 0 D. number greater than allowed range Answer: A

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam QUESTION NO: 3 Implementing XSLTC in Java SE Version 5 and above requires what specific actions, if any? A. Download and place the TrAX for Java jar file into the classpath. B. Nothing, XSLTC is now the default XSL processor for JAXP. C. Download and place the XALAN-J jar file into the classpath. D. Remove the default JAXP jar file from the JDK's ext directory and install any compatible XSLTC jar file somewhere in the classpath. Answer: B

QUESTION NO: 4

What is the result of the following XSLT template if the value of k is the string 'foo'? <xsl:template name="Do"> <xsl:param name="j" select="3"/> <xsl:param name="k"/> <xsl:if test="$j"> <xsl:value-of select="$k"/> <xsl:call-template name="Do"> <xsl:with-param name="j" select="$j - 1"/> <xsl:with-param name="k" select="$k"/> </xsl:call-template> </xsl:if> </xsl:template> A. 'foo' (repeated until stack overflow) B. 'foo foo foo' C. 'foo' D. 'foofoofoo' Answer: D

QUESTION NO: 5 A DTD, as opposed to an XML schema, often provides a sufficient level of validation for which of the following? A. A CSS stylesheet. B. An application record. "Pass Any Exam. Any Time." - www.FreeExamKing.com 3

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam C. An XSLT stylesheet. D. A narrative document. Answer: D

QUESTION NO: 6 XML documents of the same schema design are received from many unknown sources. The documents will be stored as native XML, and accessed randomly, but frequently from many different Web Service methods. What is the best processing path to manage these documents? A. Received documents should be parsed, validated, and transformed into each defined target format, which are then persisted. When requested the proper pre-formatted document is retrieved. B. Persist received documents, when requested, parse, validate, and transform the document to the proper format. C. Received documents are persisted. When requested, the document is transformed to the proper format. D. Received document should be parsed and validated, then persisted. When requested, the document is transformed to the proper format with no further parsing or validation.

A. xs:restriction B. xs:import C. xs:include D. xs:extension Answer: A

QUESTION NO: 8 A Java-based application receives manually-written XML documents in different formats. Each different format is well documented using XML Schema. Upon receiving a document, the application: - Transforms the document into a common format - Parses the document with a validating parser "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Which of the following elements will directly express a logical subset of an existing type declared in an XML schema document?

Ex

QUESTION NO: 7

am

Answer: D

Ki

ng

.co m

IBM 000-142: Practice Exam - Verifies the structure of the document - Transforms the document into a legacy format and sends to a separate legacy system for further processing Which of the following steps is LEAST necessary? A. Transforming the document to a common format. B. Transforming the document into the legacy system's format. C. Verifying the structure of the document. D. Validating the document. Answer: C

QUESTION NO: 9

Answer: D

QUESTION NO: 10 How should a CSS stylesheet be applied to an XML document? A. Embed a <style type="text/css"> ... </style> element within the XML document that contains CSS rendering instructions. B. Use XSLTC to apply the CSS to the XML DOM, and return the results as an XHTML document to the browser. C. Insert a <?xml-stylesheet href="XXX.css" type="text/css"?> instruction referencing an external CSS file. "Pass Any Exam. Any Time." - www.FreeExamKing.com 5

Fr

A. When browsers request and customers order hard copies, transform the XML data with XSLFO and then convert the file into PDF for viewing and printing. B. When browsers request and customers order hard copies, render the XML data with CSS and then use the file for viewing and printing. C. When browsers request, render the XML data with XSL-FO and then convert the file into PDF for viewing. When customers order hard copies, transform the XML data with CSS and then use the file for printing. D. When browsers request, render the XML data with CSS. When customers order hard copies, transform the XML data with XSL-FO and then convert the file into PDF for printing.

ee

Ex

am

Ki

An online bookstore offers services that enables customers to view the online eBooks with a variety of Web browsers and order high quality hard copies on demand. If the bookstore stores all the book contents with XML format, which of the following rendering approaches is the most suitable?

ng

.co m

IBM 000-142: Practice Exam D. Preprocess the XML using an XSLT stylesheet to transform the document to valid XHTML first. Then send the XHTML document to the browser. Answer: C

QUESTION NO: 11 A schema written in W3C Schema Language defines a person's full name as a complex type composed of three child elements: first name, middle name, and last name. How should the schema author specify the middle name element as optional?

QUESTION NO: 12

BusinessCard> <Name sex="Male">Thomas</Name> <Title>Account</Title> <Phone>555-654345</Phone> <Email>xxx@acompany.com</Email> </BusinessCard> A. BusinessCard Thomas Account 555-654345 xxx@ibm.com BusinessCard B. BusinessCard Name Title Phone

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

An XML developer extends the DefaultHandler and overwrites its characters method. In the characters method, the application prints each chunk of character data passed in to the screen. If the XML developer uses this XML application to process the following XML fragment, what will the XML developer view on the screen?

am

Ki

ng

Answer: C

.co m
6

A. Set the minimum length of the element's string type to zero. B. Set attribute maxOccurs="-1" on the element. C. Set attribute minOccurs="0" on the element. D. Use the ? operator in the element declaration.

IBM 000-142: Practice Exam Email BusinessCard C. Thomas Account 555-654345 xxx@acompany.com D. Male Thomas Account 555-654345 xxx@acompany.com Answer: C

QUESTION NO: 13

Which of the following statements regarding CSS transformation of XML is valid? A. It can merge multiple XML documents into a single XHTML for browser rendering. B. It may only be applied to well formed XHTML documents. C. It can be used to render XML into PDF. D. It can render XML into a format appropriate for printing.

QUESTION NO: 14

A. The structure of the document should be defined using XML Schema. B. The document should use attributes instead of elements wherever possible. C. Namespaces should be used that clarify the meaning of each element. D. The structure of the document should be defined using DTD. Answer: D

QUESTION NO: 15 An application needs to extract many small segments from many very large XML documents. The extracted data needs to be merged into a single document for further processing. What is the best "Pass Any Exam. Any Time." - www.FreeExamKing.com 7

Fr

Two trusted applications exchange a high-volume of data as XML. The content of the elements in the XML document is unstructured text and the document must be validated. Which of the following will produce the best performance?

ee

Ex

Answer: D

am

Ki

ng

.co m

IBM 000-142: Practice Exam way to design this application? A. Parse large documents using DOM, extract segments and import them into a common DOM object. B. Use the XSL "document()" function to load and then transform all large documents, to produce a single document containing all segments, that can then be parsed as a DOM object. C. Transform each large document using XSLT to produce required segments, and then parse each segment directly into a common DOM object. D. Parse large documents using SAX, importing extracted segments into a common DOM object. Answer: D

QUESTION NO: 16

A complex XML format is to be widely shared across organizations that do not normally interact. At a minimum, what kind of information about the format should be shared? A. An XSDL document for the format. B. Formal schemas or DTDs for the format. C. A stylesheet. D. The document's ebXML grammar. Answer: B

QUESTION NO: 17

Which two of the following should a developer consider to improve the performance of Web applications that transform XML documents? A. Compress the XML from the client. B. Avoid the use of XSLTC. C. Use DOM instead of SAX. D. Use a stylesheet cache. E. Minimize the use of namespaces. Answer: D,E

QUESTION NO: 18 Assume that a W3C XML Schema Language document uses the following prefix declaration: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> "Pass Any Exam. Any Time." - www.FreeExamKing.com 8

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam Which of the following should be used to directly define a type in that schema? A. xs:type B. xs:intersection C. xs:union D. xs:sequence Answer: C

QUESTION NO: 19 Given the following XML instance document fragment:

A. Element world = document.getDocumentElement(); for (Node n = world.getFirstChild(); n != null; n = n.getNextSibling()) { Element country = (Element) n; System.out.println(country.getAttribute("name")); } B. Element world = document.getTrunkElement(); for (Node n = world.getFirstChild(); n != null; n = n.getNextSibling()) { Element country = (Element) n; System.out.println(country.getAttribute("name")); } C. Element world = document.getTrunkElement(); for (Node n = world.getFirstChild(); n != null; n = n.getNext()) { Element country = (Element) n; System.out.println(country.getAttribute("name")); } D. Element world = document.getDocumentElement(); for (Node n = world.getFirstChild(); n != null; n = n.getNextChild()) { Element country = (Element) n; System.out.println(country.getAttribute("name")); } Answer: A "Pass Any Exam. Any Time." - www.FreeExamKing.com 9

Fr

ee

Ex

am

Ki

Using DOM2, which of the following will print out the names of all the countries?

ng

<country name="Afghanistan" region="Asia" area="652000" population="25838797"/> <country name="Albania" region="Europe" area="28748" population="3490435"/> ...

.co m

IBM 000-142: Practice Exam

QUESTION NO: 20 To make XSLT templates more robust, the parameters (x,y) are checked for errors and boundary conditions. Which of the following tests is NOT necessary? A. x = y B. y does not have a value C. x != y D. x has a non-numeric value

QUESTION NO: 21

Answer: C

QUESTION NO: 22

An Intranet Web application provides news for thousands of users inside one company. The application gets XML data from a database and then transforms the data into HTML with serverside XSLT. Currently the web application performs poorly. Which of the following actions should the application developer take to address the problem? A. Supply the XML data and the stylesheet to Web browsers. B. Use well formed XHTML tags in the application. C. Use XSL-FO to make the transformation. D. Update the database to a higher version. Answer: A

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

A. XSLT stylesheets are located on a remote server. B. XML Schema documents are located on a remote server. C. Namespaces used in the documents reference a remote server. D. A DTD document is referring to external entities on remote servers.

Ki

An XML-based application is performing poorly. An analysis indicates that part of the performance problem is related to a large amount of inter-server communication. Which of the following is the LEAST likely to cause a performance problem?

ng

.co m
10

Answer: C

IBM 000-142: Practice Exam QUESTION NO: 23 Analyze the following XML and DTD fragments that implement ID, IDREF and IDREFS used to link manager and subordinate relationships. Where is the error in the implementation of this logic? employees.dtd: <!ATTLIST employee empid ID #REQUIRED> <!ATTLIST employee mgrid ID #IMPLIED> <!ATTLIST employee mgr IDREF #IMPLIED> <!ATTLIST employee subs IDREFS #IMPLIED> employees.xml: <employees> <employee empid="e1" mgrid="m1" subs="e2"><name>Bob Smith</name></employee> <employee empid="e2" mgrid="m2" mgr="m1" subs="e3 e4"><name>Carol Jones</name></employee> <employee empid="e3" mgr="m2"><name>Keith Martin</name></employee> <employee empid="e4" mgr="m2"><name>Monica Williams</name></employee> </employees> A. First two records are invalid as each employee record may have either empid or mgrid attribute, but not both. B. The mgrid must be defined as "#REQUIRED" in the DTD. C. The empid and mgrid attributes conflict as an element may only have a single ID attribute. D. The subs IDREFS is formatted improperly for the second employee record. Answer: C

A developer creates a file named sample.xhtml. Which of the following is the best example of proper XHTML file content? A. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd" > <html> <head> <title>XHTML Sample</title> </head> <body bgcolor="#ffffdd"> <form onclick="alert('Click')"> <input type="checkbox" id="id1" name="verbose" value="verbose" checked="1" /> "Pass Any Exam. Any Time." - www.FreeExamKing.com 11

Fr

QUESTION NO: 24

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam </form> </body> </html> B. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>XHTML Sample</title> </head> <body bgcolor="#ffffdd"> <form onclick="alert('Click')"> <input type="checkbox" id="id1" name="verbose" value="verbose" checked="checked" /> </form> </body> </html> C. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd" > <HTML xmlns="http://www.w3.org/1999/html"> <HEAD> <TITLE>XHTML Sample</TITLE> </HEAD> <BODY bgcolor="#ffffdd"> <FROM onclick="alert('Click')"> <input type="checkbox" id="id1" name="verbose" value="verbose" checked="checked" /> </FROM> </BODY> </HTML> D. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd" > <xhtml xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xhead> <title>XHTML Sample</title> </xhead> <xbody bgcolor="#ffffdd"> <xform onclick="alert('Click')"> <xinput type="checkbox" id="id1" name="verbose" value="verbose" checked="checked" /> </xform> </xbody> </xhtml>

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
12

IBM 000-142: Practice Exam Answer: B

QUESTION NO: 25 Which of the following two statements must be used to validate an XML instance document with SAX? A. parser.setProperty("http://xml.org/sax/features/validation", true); B. XMLReader parser = new XMLReader(); C. XMLParser parser = XMLParserFactory.createXMLParser(); D. parser.setFeature("http://xml.org/sax/features/validation", true); E. XMLReader parser = XMLReaderFactory.createXMLReader(); Answer: D,E

QUESTION NO: 26

Answer: C

QUESTION NO: 27

An auto parts supplier stores customer data as XML in a database in the following format: <customer id="2"> <name>SwellMobile</name> <address><city>Kansas City</city><state>MO</state></address> <purchase id="124" totalCost="984.30"> <item id="123" quantity="27" /> <item id="456" quantity="13" /> </purchase> </customer>

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

A. <employee empNum="abcde"/> ... <employee empNum="abcde"/> B. <employee empNum="12345"/> C. <employee empNum="abcde"/> D. <employee empNum=""/>

am

<!ATTLIST employee empNum ID #REQUIRED>

Ki

Given the following DTD line, which of the following XML documents is valid?

ng

.co m
13

IBM 000-142: Practice Exam Which of the following XQuery statements returns the names of the customers who have made purchases with a totalCost over 1000? A. for $c in XMLCOLUMN("cust.data") where $c/customer/purchase[@totalCost > 1000] return $c/name B. for $c in XMLCOLUMN("cust.data")/customer/purchase[@totalCost > 1000] return $c/name C. for $p in XMLCOLUMN("cust.data")/customer/purchase let $c := XMLCOLUMN("cust.data")/customer where $p/@totalCost > 1000 return $c/name D. for $c in XMLCOLUMN("cust.data")/customer where $c/purchase[@totalCost > 1000] return $c/name

QUESTION NO: 28

Answer: C

QUESTION NO: 29 An HR application will carry out arbitrary read-only queries across employees, managers, and departments. The data will be saved in a persistence store. Which of the following supports XML as the HR application's data medium? A. SQL supports querying the contents of XML documents stored as BLOBs. SQL does not support namespaces. B. XSLT supports transformation of SQL result sets. SQL aliases cannot be used for column names and table names. C. XQuery supports insert, update, and delete operations.

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

A. An ObjectFactory class containing an instance factory method for each Java content and element interface. B. A name, which may be derived directly from the XML namespace URI. C. A set of Java element interfaces representing element declarations occurring with the DTD. D. A Javadoc for the package.

Ex

am

Which of the following is NOT included within a generated JAXB 2.0 package?

Ki

ng

Answer: D

.co m

14

IBM 000-142: Practice Exam D. XQuery supports FLWOR join operations across three XML documents. Answer: D

QUESTION NO: 30 Given the following DTD document, which of the following XML documents is valid? ELEMENT course (name,location,student)> <!ELEMENT location (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT student (name)> <!ATTLIST course code CDATA #IMPLIED> <!ATTLIST student id CDATA #IMPLIED> A. <course code="AA123" location="Phoenix"> <name>Advanced counting techniques</name> <student><name>Bob Bobberson</name></student> </course> B. <course code="AA123"> <name>Advanced counting techniques</name> <location>Phoenix</location> <student><name>Bob Bobberson</name></student> </course> C. <course code="AA123"> <name>Advanced counting techniques</name> <location>Phoenix</location> </course> D. <course code="AA123"> <location>Phoenix</location> <name>Advanced counting techniques</name> <student><name>Bob Bobberson</name></student> </course> Answer: B

QUESTION NO: 31 An auto parts supplier stores customer data as XML in a database in the following format: <customer id="2"> <name>SwellMobile</name> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
15

IBM 000-142: Practice Exam <address><city>Kansas City</city><state>MO</state></address> <purchase id="124" totalCost="984.30"> <item id="123" quantity="27" /> <item id="456" quantity="13" /> </purchase> </customer> Assume that the function XMLCOLUMN("cust.data") returns the XML documents from the database. Which of the following XQuery statements returns the names of the customers who have purchased item 123? A. for $i in XMLCOLUMN("cust.data")/customer/purchase/item where $i/@id = 123 return XMLCOLUMN("cust.data")/customer/name B. for $c in XMLCOLUMN("cust.data")/customer/purchase/item[@id = 123] return $c/name C. for $c in XMLCOLUMN("cust.data") where $c/customer/purchase/item/@id = 123 return $c/name D. for $c in XMLCOLUMN("cust.data")/customer where $c/purchase/item/@id = 123 return $c/name Answer: D

Which of the following is NOT a core component of a JAXB implementation? A. Schema-derived classes B. XSL stylesheet processor C. Binding compiler D. XML schema Answer: B

QUESTION NO: 33 A Web application performs a query against a database and uses the results to build Java objects. Next, the system sends the data to a warehouse system which is also Java-based. The warehouse then passes the data to a COBOL-based legacy system. At which point is it necessary to convert the data to XML? "Pass Any Exam. Any Time." - www.FreeExamKing.com 16

Fr

ee

QUESTION NO: 32

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam A. As soon as it is received by the warehouse system. B. Before it is sent to the legacy system. C. Before it is passed to the warehouse. D. Immediately after retrieving it from the database. Answer: B

QUESTION NO: 34 Which of the following is a characteristic of XForms rendering?

QUESTION NO: 35

Given the following XML Schema document, which of the following XML documents is valid? <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="itinerary"><xsd:complexType><xsd:sequence> <xsd:element name="passenger" type="xsd:string" /> <xsd:element name="origin" type="xsd:string" /> <xsd:element name="destination" maxOccurs="unbounded"> <xsd:complexType><xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="transfer" fixed="true" type="xsd:string" use="optional" /> </xsd:extension> </xsd:simpleContent></xsd:complexType></xsd:element></xsd:sequence> <xsd:attribute name="type" type="xsd:string" /> </xsd:complexType> </xsd:element> </xsd:schema> A. <itinerary> <passenger>A. Traveler</passenger> <origin>Ottawa</origin> <destination transfer="true">Toronto</destination> <destination>Delhi</destination> "Pass Any Exam. Any Time." - www.FreeExamKing.com 17

Fr

ee

Ex

am

Ki

ng

Answer: A

.co m

A. Provides input intent, but not rendering specifics. B. Provides drag and drop design of form elements. C. Defines new input controls for date and time selections. D. Provides precise control over the form layout.

IBM 000-142: Practice Exam </itinerary> B. <itinerary type="business"> <passenger>A. Traveler</passenger> <origin>Ottawa</origin> <destination transfer="true">Toronto</destination> <destination>Delhi</destination> </itinerary> C. <itinerary type="business"> <passenger>A. Traveler</passenger> <departure>Ottawa</departure> <destination transfer="true">Toronto</destination> <destination>Delhi</destination> </itinerary> D. <itinerary type="business"> <passenger>A. Traveler</passenger> <origin>Ottawa</origin> <destination transfer="false">Toronto</destination> <destination>Delhi</destination> </itinerary> Answer: B

A. Add the definitions of the legacy character sets to the parser's configuration file. B. Define two XML Schema documents for each of the character sets. C. Implement a pre-processor to convert documents with unsupported characters sets to UTF-8. D. Implement a custom parser to handle the legacy character sets. Answer: C

QUESTION NO: 37 A garage door is composed of: 1) a set of four white sections, 2) a spring kit, 3) a track, and "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

An application needs to process XML documents containing data retrieved from a legacy system. Some of the documents use character sets which are not supported by the XML parser. Which of the following is the best solution to address this problem?

Ex

QUESTION NO: 36

am

Ki

ng

.co m
18

IBM 000-142: Practice Exam 4) a door opener. Which of the following XML fragments best models this door? A. <door> <sections> <section window="yes" color="white"> <section color="white"> </sections> <track radius="12" /> <spring-kit kind="torsion"> <opener model="PickerUpper"> </door> B. <door> <sections> <opener model="PickerUpper" /> <spring-kit kind="torsion" /> <track radius="12" /> <section window="yes" color="white"/> <section color="white"/> </sections> </door> C. <door> <sections> <section window="yes" color="white"/> <section color="white"/> </sections> <track radius="12" /> <spring-kit kind="torsion" /> <opener model="PickerUpper" /> </door> D. <door> <opener model="PickerUpper"> <track radius="12"> <spring-kit kind="torsion"> <section window="yes" color="white"/> <section color="white"/> </spring-kit> </track> </opener> </door>

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
19

IBM 000-142: Practice Exam Answer: C

QUESTION NO: 38 XML is being transformed using XSLT. An xsl:variable is needed later in this process to set an element color. Which of the following is the way to initialize the xsl:variable hue based upon the value of the context node's status attribute? A. <xsl:variable name="hue"> <xsl:choose> <xsl:when test="@status = 'late'">red</xsl:when> <xsl:otherwise>green</xsl:otherwise> </xsl:choose> </xsl:variable> B. <xsl:variable name="hue"> <xsl:if test="@status = 'late'">red</xsl:if> <xsl:else>green</xsl:else> </xsl:variable> C. <xsl:choose> <xsl:variable name="hue"> <xsl:when test="@status = 'late'">red</xsl:when> </xsl:variable> <xsl:variable name="hue"> <xsl:otherwise>green</xsl:otherwise> </xsl:variable> </xsl:choose> D. <xsl:choose> <xsl:when test="@status = 'late'"> <xsl:variable name="hue">red</xsl:variable> </xsl:when> <xsl:otherwise> <xsl:variable name="hue">green</xsl:variable> </xsl:otherwise> </xsl:choose> Answer: A

QUESTION NO: 39 What is the correct value for the match attribute of the xsl:template below to select all elements within an XML document? "Pass Any Exam. Any Time." - www.FreeExamKing.com 20

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam <xsl:template match=""> <xsl:value-of select="name()"/> <xsl:value-of select="@id"/> <xsl:apply-templates/> </xsl:template> A. // B. / C. node() D. */* Answer: C

QUESTION NO: 40 Given an external DTD line: <!ENTITY % residence "address, bedrooms, baths"> and an internal DTD line:

!ENTITY % residence "address, footage, bedrooms, baths, available_date"> Which of the following statements is true concerning the document that refers to these DTDs? A. Document will not validate, due to the conflicting declarations. B. The last declaration the parser encounters takes precedence. C. An available_date is optional for a residence to be valid in the document. D. An available_date must be present for a residence to be valid in the document. Answer: D

QUESTION NO: 41 What will the following XSLT snippet return, if the value of parameter i is "redivider"? <xsl:template name="Do"> <xsl:param name="i"/> <xsl:variable name="j" select="string-length($i)"/> <xsl:choose> <xsl:when test=" $j < 2 "> "Pass Any Exam. Any Time." - www.FreeExamKing.com 21

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam <xsl:value-of select="$i"/> </xsl:when> <xsl:otherwise> <xsl:variable name="k" select="floor($j div 2)"/> <xsl:call-template name="Do"> <xsl:with-param name="i" select="substring($i, 1, $k)"/> </xsl:call-template> <xsl:call-template name="Do"> <xsl:with-param name="i" select="substring($i, $k+1, $k+1)"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> A. rreeddiivviiddeerr B. rdvdr C. rediv D. redivider Answer: D

QUESTION NO: 42

A. Use XSLT to transform the XML to HTML on the client side. B. Use XML security to secure the parts of the XSLT document that transform the restricted data. C. Use XSLT on the server to remove the restricted data and transform the XML to HTML on the client side. D. Use XSLT on the server to remove the restricted data and transform the XML to HTML on the server side. Answer: D

QUESTION NO: 43 Currently, most Web front-end markup is not XML. A Web search for "car wash" yields disparate results about a movie and about cleaning automobiles. The search engine poorly distinguishes among kinds of results. What is the most likely cause of the problem?

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

Data contained in an XML document must be rendered into HTML for display in a client's Web browser. Portions of the data are restricted. Restricted data must never be sent to a user that does not have privilege to access it. Using XSLT, what is the best approach to rendering the data?

am

Ki

ng

.co m
22

IBM 000-142: Practice Exam A. Browser design trade-offs ignore semantic information. B. WSDL markup mitigates the problem, but few pages use it. C. A front-end HTML document conveys no data semantics. D. Current search engines index HTML poorly. Answer: C

QUESTION NO: 44 Consider the following XML document: <?xml version="1.0" encoding="UTF-8"?> <ns1:Company1 xmlns:ns1="http://www.acompany.com/" xmlns="http://www.bcompany.com/"> <Company2> <Company3 xmlns="http://www.ccompany.com/"> <Company4 ID="4"/> </Company3> </Company2> </ns1:Company1> Which of the following statements is true?

Answer: A

QUESTION NO: 45

Which two of the following statements are true about these lines of JavaScript? var newText = document.createTextNode(" Hello DOM!"); var para = document.getElementById("example"); para.appendChild(newText); A. If newText is currently part of the document, the append will fail. B. If there is no element with an ID attribute of "example", newText will be appended to the end of the document. C. newText will be appended as the last child of the node with an ID attribute of "example".

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

A. Namespace of Element Company4 belongs to http://www.ccompany.com/. B. Namespace of Element Company3 belongs to http://www.bcompany.com/. C. The usage of namespace is not correct, default namespace can't be changed. D. Namespace of Element Company2 belongs to http://www.acompany.com/.

am

Ki

ng

.co m

23

IBM 000-142: Practice Exam D. For the lines to work correctly, there must be an element with an ID attribute of "example". E. newText will be appended as the first child of the node with an ID attribute of "example". Answer: C,D

QUESTION NO: 46 Which of the following answers best defines the XForms design goal? A. Defines complex input controls based on assigned Schema. B. Separates the forms content from presentation. C. Utilizes external DTD for field types and value limits. D. Encapsulates all JavaScript code within data elements. Answer: B

QUESTION NO: 47

Given two unequal integers x and y, which XPath 1.0 expression is equivalent to the following XSLT? <xsl:choose> <xsl:when test="$x &gt;= $y"> <xsl:value-of select="$x"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$y"/> </xsl:otherwise> </xsl:choose>

A. ($x &lt;= $y) * $x + ($y &lt;= $x) * $y B. ($x &gt;= $y) * $x + ($y &lt;= $x) * $y C. ($x &gt;= $y) * $x + ($y &gt;= $x) * $y D. ($x &lt;= $y) * $x + ($y &gt;= $x) * $y Answer: C

QUESTION NO: 48 For the given XML fragment: <Example xmlns:namespace1="http://www.w3.org" xmlns="http://www.ibm.com"> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
24

IBM 000-142: Practice Exam <Item1 address1="US" namespace1:address2="UK"/> </Example> Which namespace does the attribute address1 belong to? A. http://www.ibm.com. B. It does not belong to any namespaces. C. http://www.w3.org. D. http://www.w3.org/namespace. Answer: B

QUESTION NO: 49

When processing an XML document, why should a developer use DOM instead of SAX? A. Validation rules are simple. B. The document structure is modified. C. Parsing speed is critical. D. Multiple documents need to be merged. E. The document size is large. Answer: B,D

QUESTION NO: 50

A. Modify the current XML schema by converting elements to attributes where possible and remap to tables in order to reduce the number of tables and therefore the number of joins required. B. Transform XML documents into canonical form before persisting. C. Store the XML data as CLOBs without decomposing them into relational tables and provide an 'id' based lookup. D. Modify the current XML schema by merging all of the XML documents into a main XML document and query using XPath. Answer: A,D

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

XML data is stored and retrieved within a relational database for a data-centric application by means of mapping XML schema elements to database tables. There are concerns that the queries and updates to this database are slow due to the number of joins required in the SQL. What is the best option for improving the storage and retrieval of this XML data?

ee

Ex

am

Ki

ng

.co m

25

IBM 000-142: Practice Exam QUESTION NO: 51 An XML application processes XML documents with SAX2. What is the correct order of the methods being called when processing the following XML document? <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="paragraph.css" type="text/css"?> <paragraph>This paragraph contains<bold>some</bold>information.</paragraph> A. startDocument startElement characters startElement characters endElement characters endElement processingInstruction endDocument B. startDocument processingInstruction startElement characters startElement characters endElement characters endElement endDocument C. startDocument processingInstruction startElement startElement endElement endElement characters characters characters endDocument D. startDocument startElement startElement characters

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
26

IBM 000-142: Practice Exam characters endElement characters endElement processingInstruction endDocument Answer: B

QUESTION NO: 52 A comma delimited list is being constructed via the XSLT fragment below. Which of the following ways is most appropriate to conditionally write a comma after each value in the list except for the last one? <xsl:for-each select="//thing"> <xsl:value-of select="@thingNo"/> <!-- Conditionally write comma here. --> </xsl:for-each> A. <xsl:if test="following-sibling::*">,</xsl:if> B. <xsl:if test="following::*">,</xsl:if> C. <xsl:if test="position() != last()">,</xsl:if> D. <xsl:if test="position() = last()">,</xsl:if> Answer: C

The link element in the following XML fragment is the context node. Its target attribute is stored within the xsl:variable linkTarget. What XPath expression will find the page element whose id attribute value is described by the value of linkTarget? <site> <page id="000"/> <page id="001"> <page id="001_000"> <link target="003_000"/> </page> <page id="001_001"/> </page> <page id="002"/> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

QUESTION NO: 53

ee

Ex

am

Ki

ng

.co m

27

IBM 000-142: Practice Exam <page id="003"> <page id="003_000"/> <page id="003_001"/> </page> </site> A. ancestor::page/ancestor::page/child::page/child::page[id = $linkTarget] B. ../../page[@id = '003']/page[@id = linkTarget] C. //page[@id = $linkTarget] D. ..//page[@id = $linkTarget] Answer: C

QUESTION NO: 54 What is the result of the following XSLT template? <xsl:template name="Do"> <xsl:param name="j" select="5"/> <xsl:param name="k" select="1"/> <xsl:choose> <xsl:when test=" $j &lt; 2 "> <xsl:value-of select="$k"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="Do"> <xsl:with-param name="j" select="$j - 1"/> <xsl:with-param name="k" select="$j * $k"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> A. 120 B. 1 2 3 4 5 C. 60 D. 15 Answer: A

QUESTION NO: 55 "Pass Any Exam. Any Time." - www.FreeExamKing.com 28

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam Given the following DTD lines, which XML document fragment would be valid? <!ELEMENT person (name, profession*)> <!ELEMENT name (first_name, last_name)> <!ELEMENT first_name (#PCDATA)> <!ELEMENT last_name (#PCDATA)> <!ELEMENT profession (#PCDATA)> A. <person> <name> <first_name>Alan</first_name> <last_name>Turing</last_name> </name> was a <profession>Computer Scientist</profession> </person> B. <person> <name> <first_name>Alan</first_name> <last_name>Turing</last_name> </name> <publication>On Computable Numbers</publication> </person> C. <person> <profession>computer scientist</profession> <name> <first_name>Alan</first_name> <last_name>Turing</last_name> </name> </person> D. <person> <name> <first_name>Alan</first_name> <last_name>Turing</last_name> </name> </person> Answer: D

QUESTION NO: 56 An application applies internal business rules to generate XML documents. XSL stylesheets can then perform complex calculations on the XML documents to produce summary reports. What is "Pass Any Exam. Any Time." - www.FreeExamKing.com 29

Fr

ee

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam the best solution to resolve the complexities of the XSLT calculations? A. Create a custom XSL extensions for each calculation and import them into each defined stylesheet. B. Create a common stylesheet to perform all the calculations appending the results to the XML, which is then input into the appropriate stylesheet for the actual rendering. C. Move the calculations into the business rules logic of the application and export the results as part of the XML content. D. Extract all the calculation logic form the XSL and put them into included functions to be shared by all the stylesheets. Answer: C

QUESTION NO: 57

A. <m:menu xmlns:menu="http://tempuri.org/index.html"> <file item="File"> <new item="New"> <file item="File" cmd="newFile" /> <file item="Folder" cmd="newFolder" /> </new> <open item="Open" cmd="openFile" /> <close item="Close" cmd="closeFile" /> </file> <edit item="Edit"> <copy item="Copy" cmd="copy" /> <paste item="Paste" cmd="paste" /> </edit> </m:menu> B. <m:menu xmlns:menu="http://tempuri.org/index.html"> <item label="File"> <item label="New"> <item label="File" cmd="newFile" /> <item label="Folder" cmd="newFolder" /> </item> <item label="Open" cmd="openFile" /> <item label="Close" cmd="closeFile" /> </item> <item label="Edit">

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

An application menu bar will contain a tree of labeled command "item" elements nested to an arbitrary depth. Which of the following XML fragments can define the menu bar?

.co m

30

IBM 000-142: Practice Exam <item label="Copy" cmd="copy" /> <item label="Paste" cmd="paste" /> </item> </m:menu> C. <m:menu xmlns:m="http://tempuri.org/index.html"> <file item="File"/> <new item="New"/> <file item="File" cmd="newFile" /> <file item="Folder" cmd="newFolder" /> </new> <open item="Open" cmd="openFile" /> <close item="Close" cmd="closeFile" /> </file> <edit item="Edit"/> <copy item="Copy" cmd="copy" /> <paste item="Paste" cmd="paste" /> </edit> </m:menu> D. <m:menu xmlns:m="http://tempuri.org/index.html"> <item label="File"> <item label="New"> <item label="File" cmd="newFile" /> <item label="Folder" cmd="newFolder" /> </item> <item label="Open" cmd="openFile" /> <item label="Close" cmd="closeFile" /> </item> <item label="Edit"> <item label="Copy" cmd="copy" /> <item label="Paste" cmd="paste" /> </item> </m:menu> Answer: D

QUESTION NO: 58 A Web application must support a variety of browser types and versions. Information is stored in the database as XML data. How and where should the XML document be processed for rendering?

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
31

IBM 000-142: Practice Exam A. Web application transforms the XML data into HTML on the server side and then sends to client browsers. B. Web application only need to supply the XML data. Browsers can handle the rendering by themselves. C. Use XSL-FO to transform XML data into PDF form so that all the contents have the same look and feel on different browsers. D. Web application supplies both the XML data and the stylesheet to browsers, and the lets the browsers make the rendering. Answer: A

QUESTION NO: 59

Several small XML documents need to be merged and transformed into a single XHTML result. Which of the following actions is best to accomplish this task? A. Use XSL "document()" function to merge all documents, and then perform a normal transformation to convert to XHTML output. B. Use XQuery to extract the entire contents of each document into a single DOM, which will then be passed into an XSLT transformer to convert to XHTML. C. Use an external utility to concatenate all the XML documents and pass the resulting XML to an XSLT transformer to convert to XHTML. D. Parse each document using DOM, and import the results into a common DOM. Pass the resulting DOM to an XSLT transformer to convert to XHTML. Answer: D

Applying a digital signature to an XML document consists of which action? A. Associating the document to a custom PGP namespace. B. Calculating a hash of the document and encrypting the hash value using a private key. C. Encrypting the document using a private key. D. Encrypting the document using a public key from a Certificate Authority (CA). Answer: B

QUESTION NO: 61 Which two of the following should a developer consider to improve the performance of web applications that transform XML documents? "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

QUESTION NO: 60

ee

Ex

am

Ki

ng

.co m

32

IBM 000-142: Practice Exam A. Use SAX instead of DOM. B. Do not validate instance documents from external sources. C. Use XSLTC. D. Use a binary search of the SAX document tree. E. Use namespaces. Answer: A,C

QUESTION NO: 62 An application parses large XML documents received via an HTTP connection. The data does not need to be modified. The volume of traffic is high and performance is an issue. Which of the following technologies should be used to parse the incoming document? A. XSLT B. SAX C. XPath D. DOM Answer: B

QUESTION NO: 63

Given the following XML instance document fragment:

Using DOM2, which of the following will retrieve the name of the last country? A. NodeList nodes = document.getElementsByTagName("country"); String lastCountryName = nodes.item(nodes.getLength()).getAttributes().getItemNamed("name"); B. NodeList nodes = document.getElementsById("country"); String lastCountryName = nodes.item(nodes.getLength()).getAttributes().getNamedItem("name"); C. NodeList nodes = document.getElementsByTagName("country"); String lastCountryName = nodes.item(nodes.getLength()-1).getAttributes().getNamedItem("name"); D. NodeList nodes = document.getElementsById("country"); String lastCountryName = nodes.item(nodes.getLength() 1).getAttributes().getNamedItem("name"); Answer: C

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

<country name="Afghanistan" region="Asia" area="652000" population="25838797"/> <country name="Albania" region="Europe" area="28748" population="3490435"/> ...

Ex

am

Ki

ng

.co m

33

IBM 000-142: Practice Exam

QUESTION NO: 64 Adding a digital signature to an XML document performs what function? A. Limits decryption of the XML document to the predefined recipient. B. Proves that document has not been altered since being signed. C. Ensures that only the signer can decrypt the document. D. Ensures only the associated private key can decrypt the document. Answer: B

QUESTION NO: 65

Given the following DTD document, which of the following XML documents is valid? <!ELEMENT departures (flight)> <!ELEMENT destination (#PCDATA)> <!ELEMENT flight (destination)> <!ATTLIST flight airline CDATA #REQUIRED> <!ATTLIST flight gate CDATA #IMPLIED> <!ATTLIST flight number CDATA #REQUIRED>

A. <departures> <flight airline="XYZ" gate="25"> <destination>YYZ</destination> </flight> </departures> B. <departures> <flight airline="XYZ" number="992"> <destination>YYZ</destination> </flight> </departures> C. <departures> <destination airline="XYZ" number="992" gate="25"> <flight>YYZ</destination> </destination> </departures> D. <departures> <flight airline="XYZ" number="992" gate="25"> <destination>YYZ</destination> <destination>YOW</destination> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

34

IBM 000-142: Practice Exam </flight> </departures> Answer: B

QUESTION NO: 66 Which two of the following may NOT be nested within a CDATA section? A. Javascript source B. The XML escape characters (<, >, &, ', and ") C. HTML documents D. XSLT that needs to be processed E. Other CDATA sections Answer: D,E

QUESTION NO: 68 An application saves and restores internal program state across invocations. The offline state resides in an XML file. Only that one application reads and writes the file. The designer wrote a constraint schema for the XML, and had the application validate the state file upon input. Which of the following indicates why? A. To detect data corruption. B. To bind the file to a set of state objects. C. To optimize parsing. D. To automatically convert string fields to numeric. "Pass Any Exam. Any Time." - www.FreeExamKing.com 35

Fr

Answer: D,E

ee

A. Documents must be merged. B. Validation rules are complex and detailed. C. The document structure is changed. D. The document size is large. E. Parsing speed is critical.

Ex

am

Which two of the following characteristics of processing XML documents will lead a developer to use SAX instead of DOM in order to achieve good performance?

Ki

QUESTION NO: 67

ng

.co m

IBM 000-142: Practice Exam Answer: A

QUESTION NO: 69 Consider the given XML fragment: <Example xmlns:namespace1="http://www.w3.org" xmlns="http://www.ibm.com"> <Item1 address1="US"/> <namespace1:Item2 address="US"/> </Example> To which of the following namespaces does the element Item1 belong? A. http://www.w3.org. B. It does not belong to any namespaces. C. http://www.ibm.com. D. http://www.w3.org/namespace. Answer: C

QUESTION NO: 70

A. For each company and data type, a custom conversion routine will transform the received data into an internal XML schema for local storage. When requested, the data will be converted to the target companys required format. B. Define custom XML Schema designs for each data type, and require that each source and target company adhere to that vocabulary when sending or receiving data. C. For each company and data type, a custom conversion routine will transform the received data into an appropriate ebXML defined XML schema that will be used to send to target companies. D. Require that each source and target company conform to an appropriate ebXML standard schema for each data type. Answer: D

QUESTION NO: 71 "Pass Any Exam. Any Time." - www.FreeExamKing.com 36

Fr

ee

An application is being written that will act as a B2B intermediary for various companies. The data will come from many sources and will be delivered to many targets. Each of the potential source companies and data types have not been defined. Given the open-ended nature of the requirements, which is the best potential design?

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam Given the following XML fragment: <Employee> <Age>35</Age> <!--Based on this years performance --> <Salary>10000</Salary> </Employee> Which SAX2 interface should the developer implement to extract the value of the XML comment? A. LexicalHandler B. ContentHandler. C. DTDHandler. D. EntityResolver. Answer: A

QUESTION NO: 72

Which of the following statements is TRUE concerning this fragment of XML Schema? <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:nonstandard:test" elementFormDefault="qualified" xmlns:ts="urn:nonstandard:test"> <complexType name="Order"> <sequence> <element name="user" type="ts:User" /> <element name="products" type="ts:Products" minOccurs="1" maxOccurs="1" /> </sequence> <attribute name="number" type="xs:decimal" /> </complexType>" A. Declaring number as type decimal requires <Order> to be a complexType. B. An <Order> must have a number. C. An <Order> may contain more than one <user>. D. An <Order> has child elements. Answer: D

QUESTION NO: 73

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
37

IBM 000-142: Practice Exam A W3C Schema Language document designer must incorporate declarations from an external Web-hosted type library schema belonging to another namespace. Which schema element can the designer use to incorporate the external schema so as to reuse its types and elements? A. xs:redefine B. xs:import C. xs:require D. xs:include Answer: B

QUESTION NO: 74

Calculating sub-totals from an XML document using XSL transformation requires special considerations. Which of the following options is the best solution to solve this problem? A. Create a special XSLT variable that contains the results of an XPath query that performs a "sum()" of the values to be totaled. B. Use XSLTC to precompile a custom Java translet that will extract the values to be totaled and returns the sum of those values. This return value is then used in an XSL variable for output. C. Create a fragment variable containing the values to total, and then use the node-set() XSLT extension and the XPath "sum()" function to calculate the value. D. Use XSLT recursion to define a variable value that calculates the "value-of" the elements to be sub-totaled. Answer: C

QUESTION NO: 75

An online trading system supports multiple clients such as Web browsers, Personal Digital Assistants (PDAs) and mobile phones. It retrieves XML data from a native XML database and then displays the information to different clients. Which approach is more suitable for rendering the data sent to different devices? A. The trading system should send both the raw XML data and devices-specific files to clients. B. The trading system should transform the XML data into the devices-specific formats on the server. C. XSL-FO should be used for different rendering targets. D. The XML data should be converted to XHTML then sent to different devices. Answer: B

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

38

IBM 000-142: Practice Exam QUESTION NO: 76 An XML document consists of one <Book> element and three <Price> elements representing different vendors' selling price. What is the best approach to define this XML document? A. When defining this XML documents schema, use different date types for element <Price>. B. Put three same Price tags into the XML document, XML processor has embedded mechanism to differentiate them. C. To differentiate vendors' prices, add a prefix before each Price tag, such as <OneVendorPrice>. D. At the beginning of the XML document, add Price namespace declarations for different vendors. Answer: D

QUESTION NO: 77

Given the following DTD fragment, which XML instance document fragment will PASS validation? <!ELEMENT planet (country*)> <!ELEMENT country EMPTY> <!ATTLIST country cc ID #REQUIRED name CDATA #REQUIRED border IDREF #IMPLIED > A. <planet> <country cc = "kn nv" name = "Saint Kitts & Nevis"/> </planet> B. <planet> <country cc = "3s" name = "5pain"/> </planet> C. <planet> <country cc = "ca" border = "us"/> </planet> D. <planet> <country cc = "au" name = "Australia" /> </planet>

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
39

IBM 000-142: Practice Exam Answer: D

QUESTION NO: 78 An application merges the contents of two XML documents from different departments to produce a single document. Each document uses its own vocabulary of elements, but both documents have elements with the same name, but different meanings. Which of the following solutions best deals with this problem? A. Define the structure of each document using DTD. B. Use unique XSLT transformation to create the merged document. C. Define each of the source documents using unique XML namespaces. D. Define the structure of each document using XML Schema. Answer: C

QUESTION NO: 79 Consider the following XML document: <?xml version="1.0" encoding="UTF-8"?> <Books> <Book ID="001"> <Title>Finding New World</Title> <Author>Jone Smith</Author> </Book> <Book ID="080"> <Title>How to Programming</Title> <Author>Tom Alston</Author> </Book> </Books>

An XML developer wants to generate a HTML document that lists the ID, title and author of a book in a HTML table. Which of the following stylesheets can achieve the desired result? A. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <table width="100%" border="1"> <xsl:for-each select="Books/Book"> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
40

IBM 000-142: Practice Exam <tr> <td><xsl:value-of select="ID"/></td> <td><xsl:value-of select="." /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> B. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <table width="100%" border="1"> <xsl:for-each select="Books/Book"> <tr> <td><xsl:value-of select="@ID"/></td> <td><xsl:value-of select="Title" /></td> <td><xsl:value-of select="Author" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> C. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Books"> <html> <body> <table width="100%" border="1"> <xsl:for-each select="/"> <tr> <td><xsl:value-of select="@ID"/></td> <td><xsl:value-of select="Title" /></td> <td><xsl:value-of select="Author" /></td> </tr> </xsl:for-each> </table> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

41

IBM 000-142: Practice Exam </body> </html> </xsl:template> </xsl:stylesheet> D. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Books"> <html> <body> <table width="100%" border="1"> <xsl:for-each select="Book"> <tr> <td><xsl:value-of select="ID"/></td> <td><xsl:value-of select="Title" /></td> <td><xsl:value-of select="Author" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> Answer: B

What is the default axis in XPath? A. descendant:: B. descendant-or-self:: C. child:: D. parent:: Answer: C

QUESTION NO: 81 For string values of i of length less than 20, the XSLT template below will output i in reverse order. What would be the output of this template if the order of the two template calls between the two comments ('START' and 'END') were reversed? "Pass Any Exam. Any Time." - www.FreeExamKing.com 42

Fr

ee

QUESTION NO: 80

Ex

am

Ki

ng

.co m

IBM 000-142: Practice Exam <xsl:template name="Do"> <xsl:param name="i"/> <xsl:variable name="j" select="string-length($i)"/> <xsl:choose> <xsl:when test=" $j < 2 "> <xsl:value-of select="$i"/> </xsl:when> <xsl:otherwise> <xsl:variable name="k" select="floor($j div 2)"/> <!-- START --> <xsl:call-template name="Do"> <xsl:with-param name="i" select="substring($i, $k+1, $k+1)"/> </xsl:call-template> <xsl:call-template name="Do"> <xsl:with-param name="i" select="substring($i, 1, $k)"/> </xsl:call-template> <!-- END --> </xsl:otherwise> </xsl:choose> </xsl:template>

QUESTION NO: 82

Which two statements are true concerning the use of Node.removeChild(Node child)? A. The child and all its children are removed. B. All pointers are automatically updated. C. If the child does not exist in the document, nothing will happen. D. The children of the child are kept in the document. E. Pointers must be updated before attempting removeChild() or an Exception will be thrown. Answer: A,B

QUESTION NO: 83 "Pass Any Exam. Any Time." - www.FreeExamKing.com 43

Fr

ee

Answer: D

Ex

A. Reverse the value of i. B. Alternate the value of i and the value of k by the number of times indicated by j. C. Do nothing because the value of j cannot be changed once assigned. D. Repeat the value of i.

am

Ki

ng

.co m

IBM 000-142: Practice Exam A form contains the following fields: 1) First name 2) Middle name 3) Last name 4) Street 5) City 6) State 7) Postal code Which of the following is the most appropriate XML representation? A. <addr:form xmlns:loc="http//tempuri.org/index.html"> <name fullname="Suggins, Elwood P"> <location address="123 Elm St., Lizard Lick, NC 27699"> </addr:form> B. <form> <name> <first>Elwood</first> <middle>P</middle> <last>Suggins</last> </name> <location> <street>123 Elm St.</street> <city>Lizard Lick</city> <state>NC</state> <postalCode>27699</postalCode> </location> </form> C. <addr:form xmlns:loc="http//tempuri.org/index.html"> <name> <first>Elwood</first> <middle>P</middle> <last>Suggins</last> </name> <location> <street>123 Elm St.</street> <city>Lizard Lick</city> <state>NC</state> <postalCode>27699</postalCode> </location> </addr:form> D. <form> <name fullname="Suggins, Elwood P"> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

44

IBM 000-142: Practice Exam <location address="123 Elm St., Lizard Lick, NC 27699"> </form> Answer: B

QUESTION NO: 84 During parsing, how many startElement messages will the ContentHandler for the following XML document receive? <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/css" href="person.css"?> <!DOCTYPE person SYSTEM "person.dtd"> < person xmlns="http://xml.mycompany.com/person"> <name:name xmlns:name="http://xml.mycompany.com/name"> <name:first>Joe</name:first> <name:last>Schmoe</name:last> </name:name> <assignment project_id="p2"/> </person> A. 9 B. 12 C. 8 D. 5 Answer: D

QUESTION NO: 85

In a museum, XML data stored on powerful servers is served to customers through Web browsers running on network-connected computers. The performance of those computers is limited. Which of the following approaches will best suit the XML transformation? A. Output XHTML via a server-side XSL transformation. B. Transform the XML data into the open format document and display. C. Use only a subset of the XHTML and use Format Objects to apply style. D. Pass both the XML data and stylesheets to web browsers. Answer: A

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m
45

IBM 000-142: Practice Exam QUESTION NO: 86 A company is developing an AJAX (Asynchronous JavaScript and XML) application which passes XML between the client and the server. After the client's Web browser receives the server response, which technology is NOT suited for rendering the XML data? A. Javascript B. XSL-FO C. XSLT D. CSS Answer: B

QUESTION NO: 87

A DTD is more convenient than an XML schema for which of the following purposes? A. Enforcing simple data types for attribute values. B. Defining general entities. C. Explicitly supporting a namespace. D. Limiting length of content. Answer: B

QUESTION NO: 88

A. XPath B. SAX C. DOM D. XDB Answer: C

QUESTION NO: 89 Given the following XML Schema document, which of the following XML documents is valid?

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

An application reads a small XML document from a customer information database. The information is presented to the user in a Web page where it can be modified. The modified XML must be written back to the database. Which of the following technologies should be used to process the document when it is read from the database?

ee

Ex

am

Ki

ng

.co m

46

IBM 000-142: Practice Exam <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="course"> <xsd:complexType><xsd:sequence> <xsd:element ref="name"/> <xsd:element name="location" type="xsd:string"/> <xsd:element maxOccurs="unbounded" minOccurs="1" ref="student"/></xsd:sequence> <xsd:attribute name="code" type="xsd:string" use="optional"/></xsd:complexType> </xsd:element> <xsd:element name="name" type="xsd:string"/> <xsd:element name="student"><xsd:complexType><xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" ref="name"/> </xsd:sequence></xsd:complexType></xsd:element> </xsd:schema> A. <course code="AA123"> <location>Phoenix</location> <name>Advanced counting techniques</name> <student><name>Bob Bobberson</name></student> </course> B. <course code="AA123"> <name>Advanced counting techniques</name> <location>Phoenix</location> </course> C. <course code="AA123"> <name>Advanced counting techniques</name> <location>Phoenix</location> <student><name>Bob Bobberson</name></student> </course> D. <course code="AA123" location="Phoenix"> <name>Advanced counting techniques</name> <student><name>Bob Bobberson</name></student> </course> Answer: C

QUESTION NO: 90 Which of the following lists contains only valid W3C XML Schema Language simple schema types? A. TOKEN, timestamp, range, char

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

47

IBM 000-142: Practice Exam B. byte, duration, ENTITY, NMTOKEN, C. anyURL, char, encoding, UTF8 D. fullname, double, long, int Answer: B

QUESTION NO: 91 Assume that a W3C XML Schema Language document designer uses the following prefix declaration: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

The designer evaluates the choice of attributes versus elements to describe a structure. Which of the following is a valid reason to avoid attributes for a complex structural representation? A. An attribute value cannot contain elements. B. An element is restricted to meta-data representation. C. An attribute value is restricted to representing string data. D. Elements are approximately twice as concise as attributes. Answer: A

QUESTION NO: 92

A. Each recursive call sets up the next sub-problem to be half as large as the current one. B. The recursive call comes at the end of the template. C. Depending upon the stylesheet processor, it may not exhaust the stack space as quickly as general recursion. D. Stylesheet processors may optimize this kind of recursion by internal transformation into an iterative solution. Answer: A

QUESTION NO: 93 Which two of the following should be considered to increase performance when using XSLT to process an XML instance document?

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Which of the following is NOT necessarily a trait of "tail recursion?"

Ex

am

Ki

ng

.co m

48

IBM 000-142: Practice Exam A. Convert US ASCII ("US-ASCII") documents to Unicode ("UTF-8" or "UTF-16") before parsing. B. Use default attributes. C. Use xsl:key elements and the key() function to retrieve node sets. D. Use "//" (descendant axes) patterns near the root of a large document. E. Where possible, use pattern matching rather than xsl:if or xsl:when statements. Answer: C,E

QUESTION NO: 94 Given the following XML fragment: <Book IFN="SG24-6369-01"> <Name>WebSphere Application Server V6 Migration Guide</Name> <Publisher>IBM</Publisher> </Book>

Answer: D

An XML document with an evolving XML Schema is being designed. The system will store a large volume of these documents. Therefore, they should be kept as small as possible. What is the best approach to handle document versioning? A. XSLT should be used to transform the different versions of the XML Schema documents. B. The version information should be included in the namespace. C. Identify the version of the document by the version attribute in the XML prologue. D. The appropriate version of XML Schema should be inlined within the document. Answer: B

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

QUESTION NO: 95

ee

Ex

A. Implement DocumentHandler and use the startElement and characters methods. B. Implement ContentHandler and use the startElement and characters methods. C. Implement DocumentHandler and use the startDocument and characters methods. D. Implement ContentHandler and use the startDocument and characters methods.

am

Ki

How can an XML developer extract the Name element and its contents in SAX2-based XML processing?

ng

.co m
49

IBM 000-142: Practice Exam QUESTION NO: 96 Consider the following XML document: <?xml version="1.0" encoding="UTF-8"?> <BankAccount> <Account ID="00023" Name="Alex Halavais" Type="Checking" Balance="10000USD"/> <Account ID="00082" Name="Alice Mckinley" Type="Saving" Balance="20000USD"/> </BankAccount> If an XML developer wants to output the above document as a colon delimited text file, which of the following stylesheets can achieve the desired result? A. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="Account"> <xsl:value-of select="@ID"/><xsl:text>:</xsl:text> <xsl:value-of select="@Name"/><xsl:text>:</xsl:text> <xsl:value-of select="@Type"/><xsl:text>:</xsl:text> <xsl:value-of select="@Balance"/> <xsl:text></xsl:text> </xsl:template> </xsl:stylesheet> B. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="BankAccount"> <xsl:value-of select="@ID"/><xsl:text>:</xsl:text> <xsl:value-of select="@Name"/><xsl:text>:</xsl:text> <xsl:value-of select="@Type"/><xsl:text>:</xsl:text> <xsl:value-of select="@Balance"/> <xsl:text></xsl:text> </xsl:template> </xsl:stylesheet> C. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match=" BankAccount "> <xsl:value-of select="@ID"/><xsl:output>:</xsl:output> <xsl:value-of select="@Name"/><xsl:output>:</xsl:output> <xsl:value-of select="@Type"/><xsl:output>:</xsl:output> <xsl:value-of select="@Balance"/> "Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

ng

.co m

50

IBM 000-142: Practice Exam <xsl:output></xsl:output> </xsl:template> </xsl:stylesheet> D. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="Account"> <xsl:value-of select="@ID"/><xsl:output>:</xsl:output> <xsl:value-of select="@Name"/><xsl:output>:</xsl:output> <xsl:value-of select="@Type"/><xsl:output>:</xsl:output> <xsl:value-of select="@Balance"/> <xsl:output></xsl:output> </xsl:template> </xsl:stylesheet> Answer: A

Which of the following is a trait that distinguishes XSLT 2.0 from XSLT 1.0? A. xsl:with-param in XSLT 2.0 does not throw an error if that parameter is not defined in the called template. B. xsl:for-each in XSLT 2.0 supports arbitrary sequences in addition to node sets. C. xsl:variable in XSLT 2.0 includes an attribute called "type" to indicate type. D. xsl:value-of in XSLT 2.0 includes an attribute called "delimiter" that allows delimited sequences. Answer: B

QUESTION NO: 98

Which XPath axis below may be described as "all nodes that contain the context node, but not the context node itself?" A. namespace:: B. ancestor:: C. preceding:: D. ancestor-or-self:: Answer: B

"Pass Any Exam. Any Time." - www.FreeExamKing.com

Fr

ee

Ex

am

Ki

QUESTION NO: 97

ng

.co m

51

Potrebbero piacerti anche