18. XML Quiz

Test yourself

Choose an answer for each question. You get feedback straight away, and your best score is saved on this device.

What does XML stand for?

  • eXtra Markup Language
  • eXtensible Markup Language
  • Executable Markup Logic
  • eXchange Machine Language

How many root elements must a well-formed XML document have?

  • None
  • As many as you like
  • Exactly one
  • At least two

Which of these is NOT allowed in well-formed XML?

  • <a><b>text</a></b>
  • <item id="1"/>
  • <note date='2026-03-15'>Hi</note>
  • <empty></empty>

How do you write an ampersand inside XML text?

  • & on its own
  • \&
  • &and;
  • &amp;

Are the tags <Name> and <name> the same in XML?

  • Yes, XML ignores capital letters
  • No, XML is case sensitive
  • Only inside attributes
  • Only in the root element

As a general guide, what should attributes be used for?

  • The main data of the document
  • Lists of several values
  • Metadata about the data, such as an ID or a unit
  • Comments

What problem do XML namespaces solve?

  • Name clashes between different vocabularies
  • Slow parsing
  • Missing closing tags
  • Large file sizes

What is the difference between well-formed and valid?

  • They mean the same thing
  • Valid files need no closing tags
  • Well-formed files must use a schema
  • Well-formed follows the XML syntax rules, and valid also follows a DTD or schema

Which is an advantage of XML Schema (XSD) over a DTD?

  • It is not written in XML
  • It has real data types, such as numbers and dates
  • Browsers validate it automatically
  • It cannot restrict values

In XPath, what does //book[price > 20]/title select?

  • The price of every title
  • Only the first book
  • The title of every book that costs more than 20
  • All books with no title

What is XSLT used for?

  • Transforming XML into another document, such as HTML
  • Storing images
  • Encrypting XML files
  • Running database queries

After DOMParser.parseFromString() reads bad XML, what happens?

  • It always throws an exception
  • It returns a document containing a parsererror element, so you must check for it
  • It silently repairs the XML
  • It returns null

Which is a good reason to choose XML over JSON?

  • XML is always shorter
  • XML has built-in number and boolean types
  • You are marking up documents with mixed text and tags, or following an XML standard such as RSS or SVG
  • XML needs no parser

What should you do when your program reads XML that came from an outside source?

  • Treat it as untrusted: validate it, disable external entities, and escape it before showing it
  • Trust it, because XML is strict
  • Insert it into the page with innerHTML
  • Enable every parser option for full features

What next?

You have finished the XML course, and with it all five courses on BeingXpert. Use what you have learned to build real projects, and keep the Resources page handy for the official documentation.

Scroll to Top