Quiz
Review today’s material by taking this three-question quiz.
Questions
1. |
What does RSS stand for?
|
2. |
What method cannot be used to add text to an XML element using XOM?
|
3. |
When all the opening element tags, closing element tags, and other markup are applied consistently in a document, what adjective describes the document?
|
Answers
1. |
c. One version, RSS 2.0, claims Really Simple Syndication as its name. The other, RSS 1.0, claims RDF Site Summary. |
2. |
a. Answers b. and c. both work successfully. One adds the contents of a Text element as the element’s character data. The other adds the string. |
3. |
c. For data to be considered XML, it must be well-formed. |
Certification Practice
The following question is the kind of thing you could expect to be asked on a Java programming certification test. Answer it without looking at today’s material or using the Java compiler to test the code.
Given:
public class NameDirectory { String[] names; int nameCount; public NameDirectory() { names = new String[20]; nameCount = 0; } public void addName(String newName) { if (nameCount < 20) // answer goes here } }
The NameDirectory class must be able to hold 20 different names. What statement should replace // answer goes here for the class to function correctly?
- names[nameCount] = newName;
- names[nameCount] == newName;
- names[nameCount++] = newName;
- names[++nameCount] = newName;
The answer is available on the book’s website at http://www.java21days.com. Visit the Day 19 page and click the Certification Practice link.