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