Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Quiz 1 – Web Tools for Technical Writers

1. State one reason people attending a Web Tools for Content Providers class should
care about XML.
Answer:
Nearly all web tools use an xml vocabulary, like HTML which is an XML vocabulary.
2. Create a well-formed XML document according to the following instructions
(remember, XML is case-sensitive)

Root element named MyPSU

Document has an attribute named id

The value of id is M1

Document has one child element named Section

Section has one child element named Body

Body contains a sentence.

Enter a sentence in Body (any sentence you'd like)


Answer:

<MyPSU id=”M1”>
<Section>
<Body> This body contains a sentence. </Body>
</Section>
</MyPSU>

3. Create a DTD that defines the following elements (remember, XML is case-
sensitive):

BIOGRAPHY contains exactly one INTRODUCTION followed by one or more


CONCLUSION

INTRODUCTION contains zero or more PARAGRAPH

CONCLUSION contains zero or more PARAGRAPH

PARAGRAPH contains text (parsed character data)


Answer:
<?xml version=”1.0” encoding=”utf-8”?>
<!DOCTYPE Biography [
<!ELEMENT Biography (Introduction,Conclusion+)>
<!ELEMENT Introduction (p*)>
<!ELEMENT Conclusion (p*)>
<!ELEMENT p (#PCDATA)>
]>
4. Create a valid XML file that is valid against the DTD you created in question 3
(remember, XML is case-sensitive).

You may add an internal DTD declaration, or an external declaration.


Answer:
<?xml version=”1.0” encoding=”utf-8”?>
<!DOCTYPE Biography [
<!ELEMENT Biography (Introduction,Conclusion+)>
<!ELEMENT Introduction (p*)>
<!ELEMENT Conclusion (p*)>
<!ELEMENT p (#PCDATA)>
]>
<Biography>
<Introduction>
<p>My name is Patty Hubbert.</p>
</Introduction>
<Conclusion>
<p>I am a student at PSU.</p>
<p>Learning computer programming is tricky.</p>
</Conclusion>
</Biography>

5. What does XML stand for?


Answer:
Extensible Markup Language

6. What does DTD stand for?


Answer:

Document Type Definitions


7. Is the following well-formed XML? If not, why not?

<?xml version="1.0" encoding="utf-8"?>


<class>
<p>The students go to &university; to learn about Web Tools.</p>
</class>
Answer:

8. Is the following well-formed XML? If not, why not?

<?xml version="1.0" encoding="utf-8"?>


<class>
<p>The students go to PSU to learn about Web Tools.</p>
</class>
Answer:
Yes

9. Is the following well-formed XML? If not, why not?


<?xml version="1.0" encoding="utf-8"?>
<class>
<p>The students go to PSU to learn about Web Tools.
<br /> First they must learn about XML.
</p>
</class>
Answer:

Yes
10. Is the following well-formed XML? If not, why not?

<?xml version="1.0" encoding="utf-8"?>


<class>
<p>The students go to PSU to learn about Web Tools & XML.</p>
</class>
Answer:
No because the ampersand should be written as &amp;

11. Which of this following is a true statement (pick one)?

A. All XML documents must have a DTD.


B. All XML documents must be well-formed.
C. XML elements may start with a letter or a number.
D. DITA is not an XML vocabulary.
E. All of the above are true.
Answer:
B: All XML docs must be well formed.

12. Which of the following elements has a malformed (not well-formed) attribute?

A. <paragraph style="light">Hello.</paragraph>
B. <paragraph style=light>Hello.</paragraph>
C. <paragraph style='light'>Hello.</paragraph>
D. <paragraph style="light &amp; final">Hello.</paragraph>
Answer:

B: Because light should be in quotes.


13. What is the DTD cardinality indicator that indicates
"The element may appear zero or one time"?
Answer:
The answer is ?

14. What is the DTD cardinality indicator that indicates


"The element may appear one or more times"?
Answer:

The answer is +
15. What is the DTD cardinality indicator that indicates
"The element may appear zero or more times"?
Answer:
The answer is *
16. What does XSL stand for?
Answer:
Extensible Stylesheet Language

17. State one reason people attending a Web Tools for Content Providers class should
care about XSL.
Answer:

XSL allows for transforming XML.


18. Which XML element is not named correctly?

A. <p></p>
B. <h2></h2>
C. <2below></2below>
D. <_punt></_punt>
Answer:
C: You cannot start an element name with a number.
19. Which in the XML family of standards is used to transform XML from one format
to another?

A. XSLT
B. DTD
C. XML Schema
D. JAVA
Answer:
A: XSLT
20. Which standards body curates XML?

A. OASIS (Organization for the Advancement of Structured Information Standards)


B. ISO (International Organization for Standardization)
C. ITU (International Telecommunication Union)
D. W3C (World Wide Web Consortium)
Answer:
D: W3C
21. An XML Prolog is required

A. True
B. False
Answer:

A: True
22. Which of the following XML declarations is incorrect?

A. <?xml version="1.0" encoding="utf-8" standalone="yes"?>


B. <?xml version="1.0" encoding="utf-8"?>
C. <?xml version="1.0"?>
D. <xml version="1.0">
Answer:
D: It should have the ? after the < and before xml.
23. Given the following DTD (doc.dtd):

<!ELEMENT doc (start,middle+,conclude)>


<!ATTLIST doc
number CDATA #IMPLIED >

<!ELEMENT start (#PCDATA|p)*>


<!ATTLIST start
version CDATA #REQUIRED
number CDATA #IMPLIED >

<!ELEMENT middle (#PCDATA|p)*>

<!ELEMENT conclude (p)>

<!ELEMENT p (#PCDATA)>

Is the following valid XML? If not, state 1 reason?

<?xml version="1.0" encoding="utf-8"?>


<!DOCTYPE doc SYSTEM "doc.dtd">
<doc number="1">
<start version="2"><p>This is 1st start.</p></start>
<start number="2"><p>This is 2nd start.</p></start>
<middle>This is the 1st<p>middle.</p></middle>
<middle>This is the 2nd<p>middle.</p></middle>
<conclude><p>This is the conclusion.</p></conclude>
</doc>
Answer:
It is not valid because the DTD allows only one start element.
24. Given the same DTD as in question 23, is the following valid XML? If not, state 1
reason?

<?xml version="1.0" encoding="utf-8"?>


<!DOCTYPE doc SYSTEM "doc.dtd">
<doc number="1">
<start version="2">
<p>This is the start.</p>
</start>
<middle>This is the 1st<p>middle.</p>
</middle>
<middle>This is the 2nd<p>middle.</p>
</middle>
<conclude>
<p>This is the conclusion.</p>
</conclude>
</doc>
Answer: Not valid because the two middle elements are not followed by the opening
paragraph elements <p>,
25. Assume you have a directory with three files:

saxon9.jar
class.xml
class.xsl

Given the following command-line:

java -jar saxon9.jar -o class.html class.xml class.xsl

Which of this following is a true statement (pick one)?

A. class.xsl is the XSLT script.


B. saxon9.jar is the XSL processor.
C. class.html is the desired output.
D. class.xml is the source XML file.
E. All of the above are true.
Answer:
B: Saxon9.jar is the XSL processor.

You might also like