midsample1 - 1 UCLA Computer Science Department Fall x...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 UCLA Instr: C. Zaniolo Computer Science Department TAs: Fall x Your Name and ID: CS143 MIDTERM EXAM: Closed Book, 100 minutes. Please Read: Attach extra pages as needed. Write your name and ID on the extra pages. If you need to make any assumptions to solve a problem, please write you assumptions clearly in your answer. Simplicity and clarity of your solutions will count. You may get as few as 0 point for a problem if your solution is far more complicated than necessary, or if we cannot understand your solution. Please write neatly. Problem Score 1 (28%) 2 (20%) 3 (24%) 4 (28%) Total (100%) Extra Credit: Midterm Score:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS143 Midterm, Fall 2006 — Page: 2 Problem 1: 28 points Given a relation describing the courses taken by each student during the last four years: Student ( StudentID , Course , Quarter , Grade ) Write an SQL query to find the ID of all students who (i) have a GPA > 3 . 5 (the GPA is computed from the courses listed in the relation), and (ii) never received the worst grade in any of the classes they took. Assume that students never repeat classes and Grade is in numeric form. (e.g., 3.0 for B). Answer: Several solutions are possible. Here is one: select StudentID from Student where StudentID not in (select StudentID, from Student where (Course, Quarter, Grade) in (select Course, Quarter, min(grade) from Student group by Course, Quarter)) having avg(Grade) > 3.5 group by StudentID Here is Another : select StudentID from Student having avg(Grade) > 3.5 group by StudentID EXCEPT select StudentID, from Student where (Course, Quarter, Grade) in (select Course, Quarter, min(grade) from Student group by Course, Quarter))
Background image of page 2
CS143 Midterm, Fall 2006 — Page: 3 Problem 2: 20 points An extendible hash table, with hash function h(n) = n mod 256 holds the following entries:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/28/2010 for the course CMPSC 101 taught by Professor Wang during the Fall '13 term at ITT Tech San Dimas.

Page1 / 6

midsample1 - 1 UCLA Computer Science Department Fall x...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online