SAMPLE QUESTIONS FOR THE XML LECTURES Is it possible to validate an XML document that is not well-structured? Is it possible to validate an XML document that does not specify a DTD? Is it possible for a well-structured XML document not to specify a DTD? Can an element in XML have two sub-elements with the same name (tag)? Can an element in XML have two attributes with the same name? You are given a relational database with a single table: EMP(ID[32 bit integer], Name[String with length uniformly distributed 0-30 characters], Dept[String with length exactly 8 characters]) If this table has 1000 tuples, estimate its size. Estimate the size of an (uncompressed) XML representation of this table. Consider an XML database structured as a complete 16-ary tree with 4 levels. (If you draw this tree correctly, you should have 1 + 16 + 256 + 4096 nodes in all). Let each node require 256 bytes of storage. Assume 4K as page size. Consider a query that asks for all (immediate) children of a specified node (which is already in memory through some previous operation). If nodes are stored in pre-order (depth-first), how many pages must be fetched in response to this query? Can you think of an order in which to store the nodes so that exactly one page is fetched in response to this query? You should be able to work out what the result would be for an XQuery expression similar to those considered in class applied to a small data set. Consider a directory of law firms expressed as a single XML document, as follows: eagle eagle beagle
123 Main Ann Arbor
vulture eagle 1-800-SUE-THEM
999 Main Ann Arbor
a. Suppose the element "vulture" has been assigned an interval of (26, 29). What can you say about the start and end positions of the interval corresponding to each firm, and for each "Ann Arbor" city element? b. Evaluate the query, where the above data is in "ex.xml" FOR $c in doc("ex.xml")//city LET $f = doc("ex.xml")//firm[city=$c] RETURN {Count($f/partner)} c. Compare with the output of: FOR $f in doc("ex.xml")//firm RETURN {Count($f/partner)}