Elance XML Test Answers 2015



What does "XML" stand for?
Hypertext Markup Language
Hypertext Transfer Markup Language
Extensible Markup Language
Standard General Markup Language


DTD includes the specifications about the markup that can be used within the document, the specifications consists of all EXCEPT:
Entity declarations
Element declarations
The browser name
The size of element name


What is XML used for?
Data exchange and representation
For design purposes
For replacing HTML as a new standard
For structuring documents


How can you render XML in a browser with styling, without changing the original document?
By saving it as a XML document and opening it with a web browser
By saving it as a HTML document in a texeditor and opening it with a web browser
By linking the document to an external CSS/XSL document, then opening it in a browser
By adding HTML and CSS into XML


What are the basic constructs of an XML document?
Tagged elements that may or may not be matched, attributes and text
Tagged elements that can overlap, attributes, and the content in strings
Tagged elements that can be nested, a fixed number of attributes per element and text
Tagged elements that can be nested, attributes for elements, and the text


<!DOCTYPE message SYSTEM "newxml.dtd"> in an XML document does what?
Indicates where the XSD is.
Indicates where to find a validating parser.
Points you to a CSS styling sheet.
Indicates where the DTD is.


True or False? In its current state, XML is meant to be a replacement for HTML.
True
False


What does an XML document have?
A graph like structure, fixed schema, implied order, and no easy way to query
A hierarchical structure, no ordering, and easy querying using SQL and relational algebra
A table-like structure, a self-describing schema, and an implied ordering
A tree structure, a flexible schema, an implied ordering, and a way to query data called XPath


<!-- is the start of...
A CDATA space
A PCDATA space
A comment
Javascript instructions


Generally speaking, how is an XML document structured?
As a bitstream
As plaintext
As a hierarchical tree of nodes
As a binary file


What is XHTML's primary intended use?
To make websites look better in Internet Explorer
To challenge the dominance of HTML5
To make HTML more extensible and produce web documents that can be read by an XML parser
To standardize the mobile web


Which of the following appears first in a DTD?
public indentifier
root element
system identifier
DOCTYPE


XSD is written in:
SQL
JSON
html
XML


In a DTD, what is the difference between CDATA and PCDATA?
PCDATA will be treated as general XML input, CDATA will be treated as a string
CDATA works on any computer, PCDATA only works on PC's
You can only use CDATA for attributes
You can't use characters like < and & in CDATA


Which of the following is an XML query language?
XPath
relational algebra
JSON
SQL


Which of the following is true about the XML schema data type xs:anyURI
(All of these choices.)
It may contain an absolute URI.
It can contain an absolute or relative URI with an optional fragment identifier.
It may contain a relative URI.


What is "xmllint"?
A command line XML tool for Linux/UNIX
A valid XML document
A well formed XML document
A content specific specification


What kind of file does SVG represent?
An image
A database
A form
A webpage


XML parsers check if the XML document is:
Validating
Well-formed
Non-validating
Well-formed and validating


How does XPath view a XML document?
As a schema
As a fixed structure
As a graph
As a tree


In a DTD, how does one say that an attribute must exist in the XML document?
add comment to DTD
add #REQUIRED to DTD
add #PCDATA to DTD
add #IMPLIED to DTD


Which of the following is well-formed?
<cat> <octopus type=octocat">funny joke</octopus> </cat>
<cat type='maine coon"> <octopus type="octocat">funny joke</octopus> </cat>
<cat> <octopus type="octocat">funny joke</octopus>
<cat> <octopus type="octocat">funny joke</octopus> </cat>


I have a person element, with gender, address, and GPA specified as children in the DTD. What is the code that specifies that the contents of the gender element should be treated as an unparsed string?
<!ATTLIST>
#PCDATA
<!ELEMENT>
#CDATA


How do you reference '>' in an XML document without using it as an XML character? (e.g., how do you escape '>' in XML?)
&gt;
&gt
&amp;
&lt;


What does '&nbsp;' stand for, and why is it used?
Non-browser space': It tells browsers to ignore the character, if they're reading any *ML document
Non-browser space': It tells browsers to ignore the character, if they're reading an XML document
Non-breaking space': It tells the parser that this particular piece of whitespace is worth rendering
Non-breaking space': It tells the parser that it should not render this piece of whitespace


If one wants a value of the 'Age' attribute for an element to conform to the integer format, and wants the 'Age' attribute to be required, which of the following is the XML code in an XSD file that defines this?
<xsd:element name="Age" type="xsd:string use="required"/>
<attribute name="Age" type="integer" use="required"/>
<xsd:attribute name="age" type="xsd:integer" use="required"/>
<xsd:attribute name="Age" type="xsd:integer" use="required"/>


What is a document type definition, also known as a DTD?
A parser for XML
Rules for an XML document
A debugger for XML document
A validator for XML


Which of the following is a positive reason to use a schema?
Your data is irregular
If you don't need your XML structure to be specific, it's easier to manipulate
Programs, CSS, XSL, etc. can assume a certain structure, therefore making them simpler
You need flexibility in the data


All attributes must be separated by:
Whitespace.
Another attribute.
An element.
Quotes.


At the minimum, what must an attribute for an element contain?
A unique name (within the document), an equal sign, and a set of quotes.
An equal sign, a nonunique name, and a set of quotes.
A unique name (within the element), an equal sign, and a set of quotes.
A value, an equal sign, and a unique name.


If I have a person element with a single gender, a single address, and a single gpa as children, which of the following would you put in the DTD to specify that gpa is optional?
(gpa?)
(gpa +)
(gpa*)
(gpa # REQUIRED)


Which of the following is the major difference between an HTML document and an XML document?
XML tags can be nested but HTML tags can't be nested
You do not need to close the tags in a XML document but you have to for the HTML document
HTML documents have predefined elements, whereas XML documents do not
HTML tags describe both the structure and the styling of the document whereas XML tags only describe the content


In a DTD, how would you describe the spec, "The element 'a' contains one 'b' element, one or more 'c' elements, and optionally a 'd' element, in that order."
<!ELEMENT a (b? c+, d?) >
<!ELEMENT a (b, c, d) >
<!ELEMENT a (b, c*, d?) >
<!ELEMENT a (b, c+, d?) >


Which of these is the proper syntax for setting multiple values on an attribute?
Attributes cannot have multiple values
<myElement myAttribute="value1" myAttribute="value2"/>
<myElement myAttribute="value1 value2"/>
<myElement myAttribute="value1, value2"/>


Which of the following is the least flexible of the schema languages?
XSD
RELAX-NG
DTD
Schematron


The number of attributes for an element in a XML Document does NOT matter if:
More than one element has the same attribute
There are more than one attribute for each element
Each attribute is unique
Its a valid XML document


If I have an element named 'student' and I set the XML code to maxOccurs="unbounded" in the XSD schema to this subelement, what will this do?
It means there must be multiple students as children and there is a limit to how many student children there can be.
It means if there are too many student children, the validating parser will give you an error
It means there must be more than one student element as a child and there is no limit to how many student children there can be.
It means there must be at least one student element and there is no limit to how many student elements there can be.


XML document by default preserves white-space characters in element content.
False
True


Which of the following is a similarity between XSLT, XQuery, XLink and XPointer?
Path expressions
Full-featured
XPath as component
Output formatting


Which of the following metaphors most accurately describes an element contained by another element?
The second element is a descendant of the first
The second element is the child of the first
The first element is an attribute of the second
They are sibling elements


An XML declaration must consist of which of the following?
Encoding
Encoding and standalone
Version and standalone
Version


What does the XML declaration have to consist of?
XML version, encoding, and standalone
<XML> ... </xml>
<body> ... </body>
XML version
<?xml-stylesheet href="xml.css" type="text/css"?>


Why is this XHTML wrong? <div class="div1" style="color: blue;" class="bodyText"></div>
An element's attributes must each be unique within the element
The @style attribute must come at the end of the element
An element cannot belong to multiple classes
div' is not part of the XHTML namespace


maxOccurs and minOccurs can be considered as:
min and max values constraints
attribute constraints
occurence constraints
element constraints


What does XSL most accurately do?
Make sure your XML is valid
Turn an image (such as a JPG) into an SVG
Traverse XML documents and output XPath queries
Traverse XML documents and output other documents


In a DTD, how would you describe the spec, "The element 'doc' contains one 'body' element, preceded by an optional 'front' element and followed by an optional, repeatable 'appendix' element."
<!ELEMENT doc (body, front?, appendix*) >
<!ELEMENT doc (body, appendix*) >
<!ELEMENT doc (front?, body, appendix*) >
<!ELEMENT doc (front, body, appendix*) >


Which of the following is NOT a benefit of using XML?
Ability to read and edit documents on almost any system
Ability to work easily with irregular data
Unicode support
Ability to define document structures via schemas


<Shirt brand="American Eagle price="30" > The attributes in the element are NOT correct because:
The brand and the price attributes aren't separated properly.
Neither the @brand attribute nor the element itself are closed properly.
The shirt has a value of american eagle but the attribute name is missing.
The brand attribute is missing a value.


Which of these characters is illegal in XML?
"
^
&
'


Which of these is the correct syntax of the XML declaration?
<?xml version="1.0"?>
<xml version="1.0" />
<?xml version="1.0" />
None of the above


If the validating parser outputs "not valid" during the validating process, what does this mean?
You forgot to specify where the DTD is.
The XML document does not adhere to the specified schema.
The XML document is not well formed.
The XML document doesn't have basic structures that an XML document should have.


In an XSD, how would you describe the spec, "The element 'a' must contain one 'b' element, one or more 'c' elements, and optionally a 'd' element, in that order."
<xs:element name="a"> <xs:complexType> <xs:group> <xs:element name="b"/> <xs:element name="c" minOccurs="1" maxOccurs="unbounded"/> <xs:element name="d" minOccurs="0" maxOccurs="1"/> </xs:group> </xs:complexType> </xs:element>
<xs:element name="a"> <xs:complexType> <xs:sequence> <xs:element name="b"/> <xs:element name="c" maxOccurs="unbounded"/> <xs:element name="d"/> </xs:sequence> </xs:complexType> </xs:element>
<xs:element name="a"> <xs:simpleType> <xs:sequence> <xs:element name="b"/> <xs:element name="c" minOccurs="1" maxOccurs="unbounded"/> <xs:element name="d" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:simpleType> </xs:element>
<xs:element name="a"> <xs:complexType> <xs:sequence> <xs:element name="b"/> <xs:element name="c" minOccurs="1" maxOccurs="unbounded"/> <xs:element name="d" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element>


Which of the following is an empty element tag?
<Jeans Brand="Abercrombie" Price"40" Store="Copley"></Jeans>
<Jeans Brand="Guess" Price="25" Store="South Shore Plaza">
<Jeans>
<Jeans Brand="American Eagle" Price="35" Store="Prudential"/>


True or False: You can refine an external XSD schema inside of an XML file, as you can with a DTD.
TRUE
False


XML Namespaces provide a method to avoid element name conflicts. Which of the following is a correct way to declare namespaces in a valid XML document.
<n1:element namespace:n1="http://www.w3.org/TR/html4/">
<?xml version="1.0" namespace="n1=http://www.w3.org/TR/html4/;n2="http://www.w3schools.com/furniture"?>
<n1:element xmlns:n1="http://www.w3.org/TR/html4/">
<n1:element n1="http://www.w3.org/TR/html4/">
<namespaces n1="http://www.w3.org/TR/html4/" n2="http://www.w3schools.com/furniture"></namespaces>


In an XML schema, to limit a user-defined type to a set of pre-defined options, you would use:
An xs:pattern inside an xs:restriction
An xs:enumeration inside an xs:restriction
An xs:length inside an xs:restriction
Any of the above


Which of the following is NOT a schema language?
XSD
RELAX NG
XLink
Schematron


What is the error that a validating XML parser outputs if the XML document does NOT adhere to the content specific specification?
Exception error
Not well formed
Not valid
Parsing error


Which of the following can you NOT control with a DTD?
Where text is and is not allowed
Order of elements
Length of attributes
How many instances of an element are present


What rules are present in XSDs but NOT in DTDs?
Constraints on element values, key decorations, full namespace support
tree structure, parent elements, CSS, key decorations
Occurrences of elements, attributes names, number of tags nested
Pointers, IRefs, type values


If I have an element named 'students' and the XSD schema specifies minOccurs="0" but not maxOccurs for it, how will it be parsed?
The student subelement will be optional and the maximum occurence of the student subelement will be one
The student subelement will be required and the maximum occurence of the student subelement will be unlimited
The student subelement will be implied and the maximum occurence of the student subelement will be unlimited
The student subelement will be optional and the maximum occurence of the student subelement will be unlimited


Which of the following is NOT a demonstrable benefit of using XML Schemas instead of DTDs?
Use of built-in and user-defined data types.
XML Schemas provide an object-oriented approach to structuring data.
XML Schemas are easier to write.
You can transform an XML Schema with XSLT.


What does it mean to say that an XML document has an 'implied order'?
It's actually unordered because of XML's fixed schema
Even without a schema, all text-based files have an implied order
None of these
XML documents do not have an implied order


Which of the following is NOT a built-in XML schema data type?
xs:object
xs:boolean
xs:gMonthDay
xs:base64binary


In a DTD, what does "<!ELEMENT a ANY >" most precisely mean?
Element 'a' may contain anything, or nothing.
Element 'a' may have any attributes.
Element 'a' may contain anything.
Element 'a' may contain anything in the schema.


What does the following XPath 2.0 select? //body//w[following-sibling::c]
Nothing; it is invalid XPath
Any element w that is a child of any element body, of which the next sibling element is element c
Any element w that is a descendant of any element body, of which the next sibling element is element c
Any element w that is a descendant of the root body element, of which any sibling element is element c


Which of the following best describes the difference between a valid XML document and a well formed XML document?
Both a valid XML document and a well formed XML document must adhere to the same basic constructs of a XML document.
A valid XML document must adhere to the same basic constructs of an XML document as well as adhering to a schema.
A well formed XML document has to adhere to a schema and a valid XML document only has to adhere to the basic constructs of an XML document.
A well formed XML document has a DTD that specifies its structure, while a valid XML document has an XSD that specify the structure.


Ampersand sign "&" and less than "<" are allowed in
None of above
Attribute value
Comment
Element content
All of above


Which of the following is not a kind of node in the XML DOM?
A comment node
An element node
A processing instructions node
A child node

No comments:

Post a Comment