Consider the following XML DTD describing course information in a university:…
2006
Consider the following XML DTD describing course information in a university:
XML
<!ELEMENT Univ (Course+, Prof+)>
<!ELEMENT Course (Title, Eval*)>
<!ATTLIST Course Number ID #REQUIRED Instructor IDREF #IMPLIED>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Eval (#PCDATA)>
<!ATTLIST Eval Score CDATA #REQUIRED>
<!ELEMENT Prof EMPTY>
<!ATTLIST Prof Name ID #REQUIRED Teaches IDREF #IMPLIED>
What is returned by the following XQuery? let $as := / /@Score
for $c in /Univ/Course[Eval]
let $cs := $c/Eval?@Score
where min($cs) > avg($as)
return $c
- A.
The professor with the lowest course evaluation
- B.
Professors who have all their course evaluations above the university average
- C.
The course with the lowest evaluation
- D.
Courses with all evaluations above the university average
Attempted by 49 students.
Show answer & explanation
Correct answer: D
The query calculates the average score of all evaluations in the university. For each course with evaluations, it checks if the minimum evaluation score within that course is greater than the overall university average. If min($cs) > avg($as), it means every evaluation in that course is above the average, so those courses are returned.