oDesk XML Schema Test Answers 2015
ยท
1. Analyze the following example:
<xs:element
name="letter">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:pattern value="([a-z][A-Z])+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Which of the following are acceptable
values for the <letter> element in the above defined XML schema?
Answers:
โข Done
โข done
โข DONE
โข dOnE
2. Analyze the following URI of an XML
schema:
http://www.w3.org/XML/XMLSchema/vX.Y/Ne
What does the component Ne in the
above URI identify?
Answers:
โข It identifies the
XML Schema Definition Language in general.
โข It identifies
the language described in the N-th version of the XSD specification.
โข It identifies
the language described in the N-th edition of the XSD specification.
โข None of the
above
3. Which of the following are the
correct ways to define an empty complex element in an XML schema?
Answers:
โข <xs:element
name="product"> <xs:complexType> <xs:complexContent>
<xs:restriction base="xs:integer"> <xs:attribute
name="prodid" type="xs:positiveInteger"/>
</xs:restriction> </xs:complexContent> </xs:complexType>
</xs:element>
โข <xs:element
name="product"> <xs:complexType> <xs:attribute
name="prodid" type="xs:positiveInteger"/>
</xs:complexType> </xs:element>
โข <xs:element
name="product"/> <xs:complexType> <xs:attribute
name="prodid" type="xs:positiveInteger"/>
</xs:complexType>
โข <xs:element
name="product"/> <xs:complexType> <xs:sequence>
<xs:element name="prodname" type="xs:string"/>
</xs:sequence> </xs:complexType>
4. Which of the following is the
correct format for specifying the date in UTC?
Answers:
โข
<start>09-24-2009Z</start>
โข
<start>2002-09-24Z</start>
โข
<start>2002-09-24</start>
โข
<start>09-24-2009</start>
5. Which of the following validation
rules must be true of an element information item E to be locally valid(Simple
Type) with respect to an element declaration D?
Answers:
โข
D{abstract}=false
โข
D{nillable}=true
โข If E has an
xsi:nil=true.
โข D is not absent
and E and D have the same expanded name.
6. The elements of an XML schema
containing only text and attributes are declared using the________ element.
Answers:
โข
<xs:contentType>
โข
<xs:simpleContent>
โข
<xs:complexContent>
โข <xs:type>
7. Analyze the following example:
<xs:element
name="password">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:pattern value="[a-zA-Z]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Which of the following are acceptable
values for the password element in the above defined XML schema?
Answers:
โข ab12
โข abcd4
โข xyZ4
โข abc
8. Which of the following statements
is true about an XML representation of Attribute declarations in an XML schema?
Answers:
โข If the
targetNamespace attribute is present, the name attribute should be present.
โข If the
targetNamespace attribute is present, the form attribute should be present.
โข If an item's
parent is not <schema>, both ref and name must be present.
โข If both fixed
and use are present, use must have the optional value as prohibited.
9. Which of the following constraints
can be used by a boolean data type?
Answers:
โข enumeration
โข pattern
โข minInclusive
โข length
10. Which of the following whiteSpace
constraint values makes an XML processor reduce multiple spaces into a single
space?
Answers:
โข preserve
โข replace
โข collapse
โข remove
11. Which of the following
restrictions cannot be used with the ENTITIES String data type?
Answers:
โข length
โข enumeration
โข pattern
โข whiteSpace
12. Which of the following are primary
schema components?
Answers:
โข Attribute
declarations
โข Assertions
โข Particles
โข Complex type
definitions
13. Which of the following attributes
is used to specify that a schema attribute is required?
Answers:
โข variable
โข fixed
โข use
โข default
14. Analyze the following example:
<xs:element
name="letter">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:pattern value="([a-z])*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Which of the following are acceptable
values for letter?
Answers:
โข ab123
โข Abcd
โข abcd
โข ABCD
15. Which of the following are
declaration components in an XML schema?
Answers:
โข Element
โข Datatype
โข Model
โข Notation
16. Which of the following elements
can only be included in the <annotation> element in an XML schema?
Answers:
โข <appInfo>
โข <notation>
โข
<documentation>
โข <choice>
17. Which of the following elements is
used to allow documents to contain additional elements that are not declared in
the main XML schema?
Answers:
โข <any>
โข <all>
โข <choice>
โข
<sequence>
18. In which of the following model groups
of an XML schema do the element information items match one or more of the
particles?
Answers:
โข Sequence
โข Disjunction
โข Conjunction
19. Which of the following data types
are derived from the decimal data type?
Answers:
โข float
โข int
โข int32
โข double
20. Which of the following attributes
is defined inside the <xs:extension> element of an XML schema?
Answers:
โข value
โข type
โข name
โข base
21. Which of the following is a
secondary schema component?
Answers:
โข Attribute
declarations
โข Assertions
โข Annotations
โข Particles
22. Analyze the following schema file
"family.xsd":
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element
name="persons">
<xs:complexType>
<xs:sequence>
<xs:element name="person" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string"
maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Which of the following statements are
true about the above schema file?
Answers:
โข Each person
element must contain a full_name element.
โข Each persons
element must contain a full_name element.
โข Each person
element can contain a maximum of 5 child_name elements.
โข The persons
root element can contain an unlimited number of persons element.
23. Suppose you want to limit the
content of an XML element called "car" to a set of acceptable values
like BMW, Audi etc. Which of the following constraints will you use in the
above situation?
Answers:
โข enumeration
โข pattern
โข length
โข fractionDigits
24. Analyze the following XML schema
fragment:
<xs:element name="name"
type="xs:string" block="substitution"/>
<xs:element name="navn"
substitutionGroup="name"/>
<xs:complexType
name="custinfo">
<xs:sequence>
<xs:element
ref="name"/>
</xs:sequence>
</xs:complexType>
<xs:element
name="customer" type="custinfo"
block="substitution"/>
<xs:element name="kunde"
substitutionGroup="customer"/>
Which of the following is a valid XML
document according to the schema above?
Answers:
โข
<customer> <name>John Smith</name> </customer>
โข <navn>
<kunde>John Smith</kunde> </navn>
โข
<customer> <navn>John Smith</navn> </customer>
โข <kunde>
<name>John Smith</name> </kunde>
25. Which of the following
restrictions can be used with the date data types?
Answers:
โข enumeration
โข fractionDigits
โข totalDigits
โข pattern
26. Which of the following type
definitions forms the root of the Type Definition Hierarchy?
Answers:
โข xs:error
โข xs:anyType
โข xs:nil
โข xs:location
27. Which of the following attributes
must be set to true to enable character data to appear between the
child-elements of an element in an XML schema?
Answers:
โข mixed
โข type
โข base
โข value
28. Which of the following is the
correct format for specifying the time interval using the XSD duration data
type?
Answers:
โข PYnMnDnTHnMnSn
โข PMnDnYnTHnMnSn
โข PnMnDnYTnHnMnS
โข PnYnMnDTnHnMnS
29. Which of the following statements
is true if default and use both are present in an XML representation of an
Attribute declaration?
Answers:
โข The actual
value of use must be prohibited.
โข The actual
value of use must be optional.
โข The actual
value of use must be required.
โข The actual
value of use must be default.
30. Which of the following are
built-in data types of an XML schema?
Answers:
โข xs:string
โข xs:number
โข xs:boolean
โข xs:float
โข xs:date
31. Analyze the following XML document
having a reference to an XML schema:
<?xml version="1.0"?>
<note
xmlns="http://www.expertrating.com"
xsi:schemaLocation="http://www.expertrating.com note.xsd">
<to>Tove</to>
<body>Don't forget me this
weekend!</body>
</note>
Which of the following statements is
true?
Answers:
โข The value
assigned to the schemaLocation attribute is in the wrong format.
โข The XML Schema
Instance Namespace is not specified.
โข A <head>
tag must be present.
โข There is no
problem with this XML document.
32. Analyze the following schema
declaration:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.expertrating.com"
xmlns="http://www.expertrating.com"
elementFormDefault="qualified">
...
...
</xs:schema>
Which of the following fragments of
the schema declaration defines the namespace being used by the elements and
data types in the schema?
Answers:
โข
xmlns:xs="http://www.w3.org/2001/XMLSchema"
โข
targetNamespace="http://www.expertrating.com"
โข
xmlns="http://www.expertrating.com"
โข
elementFormDefault="qualified"
33. Which of the following is the
correct syntax for defining restrictions on an XML element value in an XML
schema?
Answers:
โข
<xs:restriction type="xs:integer">
โข
<xs:restriction value="xs:integer">
โข
<xs:restriction base="xs:integer">
โข
<xs:restriction data="xs:integer">
34. Which of the following are binary
data types in an XML schema?
Answers:
โข binary
โข hexBinary
โข base32Binary
โข base64Binary
35. Which of the following is the
correct format for specifying the date in an XML schema?
Answers:
โข YYYY-MM-DD
โข DD-MM-YYYY
โข DD-MM-YY
โข MM-DD-YYYY
36. What value of <maxOccurs>
indicator can you set when using the <all> indicator in an XML schema?
Answers:
โข 0
โข 1
โข unbound
โข No limit
37. Which of the following elements is
used to add multiple schemas with the same target namespace to a document?
Answers:
โข
<annotation>
โข <import>
โข
<extension>
โข <include>
38. Following is an example of an
element in an XML document using a time declaration in its schema definition:
<start>03:05:10.5</start>
Which of the following does the
component 10.5 specify?
Answers:
โข Hours
โข Minutes
โข Seconds
39. Which of the following attributes
can be specified in the <xs:complexType> element of an XML schema so as
to allow several elements to refer to the same complex type?
Answers:
โข type
โข value
โข name
โข base
40. Which of the following is used to
replace spaces in a URI while using anyURI data type in an XML schema?
Answers:
โข
"%20%"
โข %20%
โข %20
โข 20%
41. Which of the following data types
are derived from the String data type?
Answers:
โข boolean
โข ID
โข NCname
โข anyURI
โข Qname
42. The maximum number of decimal
digits that you can specify using the decimal data type in an XML schema is
________.
Answers:
โข 10
โข 15
โข 16
โข 18
โข 20
43. Analyze the following schema
declaration:
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.expertrating.com"
xmlns="http://www.expertrating.com"
elementFormDefault="qualified">
...
...
</xs:schema>
Which of the following fragments of
the schema declaration indicates the default namespace of the XML schema?
Answers:
โข
xmlns:xs="http://www.w3.org/2001/XMLSchema"
โข
targetNamespace="http://www.expertrating.com"
โข
xmlns="http://www.expertrating.com"
โข
elementFormDefault="qualified"
44. What is the default value of the
<minOccurs> indicator for Order and Group indicators?
Answers:
โข No default
value
โข 0
โข 1
โข unbound
45. Which of the following is a helper
schema component?
Answers:
โข Notation declarations
โข Simple type
definitions
โข Type
alternatives
โข Wildcards