Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clarification for mock test Shashanks

 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain the answers for these IBM Mock questions.

5. In a B2B organization, it is required to exchange XML messages conforming to a single vocabulary
with other companies in real time. The messages arrive via different media including email. Since the messaging
is done over the internet,it is important that the messages be validated at both ends when they arrive.
What factors are likely to be considered by a developer, when designing such a system.
(Select 3 correct choices)
a)
Is the parser at the receiving end a validating parser?

b)
Does the parser handle XML Schemas or DTDs?

c)
Is the parser validation lenient?

d)
Does the document instance override the internal DTD subset?

e)
Is the same parser being used at both ends?


Please explain the logic to arrive at this answer . ?

Answer : a b d


14.Which of the following schema fragments is the same as the DTD fragment below ?
<!ELEMENT myElement EMPTY>
a)<xsd:element name="myElement"/>
b)<xsd:element name="myElement" type ="xsd:anyType"/>
c)<xsd:element name="myElement" type="xsd:empty"/>
d)None of the above

How is empty identifed in a schema ?
Answers: d


21. Which of the following Document type definitions will validate the below XML document successfully ?
<? xml version="1.0" ?>
<root/>
(Select 3 correct choices)

a) <!ELEMENT root (#PCDATA)>
<!ATTLIST root rootattr CDATA #IMPLIED "value">
b) <!ELEMENT root EMPTY>
<!ATTLIST root rootattr CDATA #FIXED "value">
c) <!ELEMENT root (#PCDATA)>
d) <!ELEMENT root ANY>
<!ATTLIST root rootattr CDATA "value">
e) <!ELEMENT root (CDATA) >

Answers: b c d


40. Which of the following XML documents are NOT well formed ?
(Select 2 correct choices)
a) <?xml version="1.0"?>
<root attr1="val1" attr2="" attr1="test">
<root/>
</root>
</root>
b) <?xml version="1.0"?>
<root attr1="1value" attr2="2value">
<root/>
</root>
c) <?xml version="1.0"?>
<root attr1="1value" attr2="">
<root> 5 is < than 4 </root>
</root>
d) <?xml version="1.0"?>
<root attr1="1value" attr2="">
<root> 5 is > than 4 </root>
</root>


Answer: a c


Thanks
Dhiren
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dhiren

5. a b d
a is right as the requirement explicitly states "XML messages conforming to a single vocabulary". So I think the parser must be must be a validating parser to make sure document is validated properly.
b is opted maybe because if the recieving parser though is a validating parser and does not handle shcemas then this developer has to stick in accordance with receiving parser qualities like supports or does not support Schemas or DTD's.
I am not sure of d, maybe somone can help here. But the other two options c, e in my opinion however are not correct. I am not sure if parer can be lenient? And it does not matter whether parsers are same at both end or not as long as they both are validating parsers.

14. How is empty identifed in a schema ?
This is the example given in Pro. XML 2nd edition for an empty element using schema

I changed some code..but this is how to specify an empty element using schema. From Pro. XML "In order to define an empty element in XML schema we first have to define a complex type, and then have to restrict if from the anyType so that it can only carry attributes."

21. b c d
a is not correct as #IMPLIED does not take a default "value". For #FIXED only you should specify an attribute. e is not correct as content model to define elements allows either child elements or #PCDATA. b is correct as it defines an empty elment with fixed attribute value. Attribute is optional and hence b is correct. c is correct as it says element can contain #PCDATA which is any text including empty. d is correct as content category says ANY and attribute has already provided a default value.

40. a c
a is not well formed as the tags are not properly closed/nested. c is wrong as it contains < symbol which is not allowed in CDATA section(Here root is CDATA and so < is not allowed and if it must appear it must use entity reference). b is well formed and d is also well formed as > is allowed in CDATA section.

Dhiren, I tried to answer. I am not sure if I am right.

Guys, please correct me if I'm wrong.

Thanks.
Satish.
 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Satish for all the explainations.

Still not clear about the first (5) how the answer is coming out to be "d" .

Anyone ...

Thanks
Dhiren
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic