Quiz

To see whether you took a big enough byte from the tree of knowledge during this hour, answer the following questions about input and output streams in Java.

Questions

1:

Which of the following terms should not be used to complement XML data that is properly formatted?

  1. This data is well-formed.
  2. This data is valid.
  3. This data is dy-no-mite!
2:

What method reads all of the elements that are enclosed within a parent element?

  1. get()
  2. getChildElements()
  3. getFirstChildElement()
3:

What method of the Elements class can be used to determine the number of elements that it contains?

  1. count()
  2. length()
  3. size()

Answers

A1:

c. Well-formed data has properly structured start and end tags, a single root element containing all child elements, and an ?XML declaration at the top. Valid data follows the rules of a particular XML dialect. "Dy-no-mite!" is the catchphrase of the comedian Jimmie "J.J." Walker.

A2:

b. The getChildElements() method returns an Elements object holding all of the elements.

A3:

c. Just like vectors, Elements uses a size() method that provides a count of the items it holds.

      
Comments