You are on page 1of 21

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below.

An asterisk (*) indicates a correct answer. Semester 1 Final Term Exam covers Sections 11-18 of Database Design.

Section 12 1. A table must have at least one candidate key, as well as its primary key. True or False? Mark for Review (1) Points True False (*)

Correct

2. A table must have a primary key. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 12

3. Entity integrity refers to Mark for Review (1) Points Tables always containing text data Tables always containing numeric data Columns having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. (*)

Correct

4. The explanation below is a User Defined integrity rule and must therefore be manually coded, the Database cannot enforce this rule automatically: A primary key must be unique, and no part of the primary key can be null. True or False? Mark for Review (1) Points

True False (*)

Incorrect. Refer to Section 12

5. Which of the following are reasons why you should consider using a Subtype Implementation? Mark for Review (1) Points The resulting table will reside in a single database and be used by just ONE user. When the common access paths for the supertypes are different. Business functionality and business rules, access paths and frequency of access are all very different between subtypes. (*) Most of the relationships are at the supertype level

Correct

6. An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False? Mark for Review (1) Points True False (*)

Correct

7. One-to-One relationships are transformed into Check Constraints in the tables created at either end of that relationship. True or False? Mark for Review (1) Points True False (*)

Correct

8. What do you create when you transform a many to many relationship from your ER diagram into a physical design? Mark for Review (1) Points

Unique key constraints Intersection entity Intersection table (*) Two tables with Foreign key constraints between them

Correct

9. In a physical data model, a relationship is represented as a combination of: (Choose Two) Mark for Review (1) Points (Choose all correct answers) Column Primary Key or Unique Key (*) Check Constraint or Unique Key Foreign Key (*)

Correct

10. Attributes become tables in a database. True or False? Mark for Review (1) Points True False (*)

Correct Page 1 of 5

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 1 Final Term Exam covers Sections 11-18 of Database Design.

Section 12 11. In a physical data model, an attribute becomes a _____________. Mark for Review (1) Points Table Foreign Key Constraint Column (*)

Correct

Section 13 12. What command will return data from the database to you? Mark for Review (1) Points FETCH GET SELECT (*) RETURN

Correct.

13. The DESCRIBE command returns all rows from a table. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 13

Section 16

14. Any Non-UID must be dependant on the entire UID. True or False? Mark for Review (1) Points True (*) False

Correct

15. Would it be a good idea to model age as an attribute of STUDENT? Mark for Review (1) Points Yes Maybe it could stop us having to calculate someone's age every time we need it Sometimes No - it breaks the Normalization rules (*)

Incorrect. Refer to Section 6

16. Which statement best describes how arithmetic expressions are handled? Mark for Review (1) Points Addition operations are handled before any other operations. Multiplication and subtraction operations are handled before any other operations. Multiplication and addition operations are handled before subtraction and division operations. Division and multiplication operations are handled before subtraction and addition operations. (*)

Correct.

17. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review (1) Points 6 8 (*) 10 13

Correct.

18. The EMPLOYEES table contains these columns: SALARY NUMBER(7,2) BONUS NUMBER(7,2) COMMISSION_PCT NUMBER(2,2) All three columns contain values greater than zero. There is one row of data in the table and the values are as follows: Salary = 500, Bonus = 50, Commission_pct = .5 Evaluate these two SQL statements: 1. SELECT salary + bonus + commission_pct * salary - bonus AS income FROM employees; 2. SELECT (salary + bonus ) + commission_pct * (salary - bonus) income FROM employees; What will be the result? Mark for Review (1) Points Statement 1 will return a higher value than statement 2. Statement 2 will return a higher value than statement 1. (*) Statement 1 will display a different column heading. One of the statements will NOT execute.

Incorrect. See Section 16

19. In the default order of precedence, which operator would be evaluated first? Mark for Review (1) Points Subtractions Multiplications (*) Additions Divisions

Correct.

20. You want to create a list of all albums that have been produced by the company. The list should include the title of the album, the artist's name, and the date the album was released. The ALBUMS table includes the following columns: ALB_TITLE VARCHAR2(150) NOT NULL ALB_ARTIST VARCHAR2(150) NOT NULL ALB_DATE DATE NOT NULL Which statement can you use to retrieve the necessary information? Mark for Review (1) Points SELECT * FROM albums; (*)

SELECT alb_title, alb_artist, alb_dates FROM album;

SELECT alb_title, alb_artist, alb_dates FROM albums;

SELECT alb_title; alb_artist; alb_date FROM albums;

Correct. Page 2 of 5

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 1 Final Term Exam covers Sections 11-18 of Database Design.

Section 16 21. You query the database with this SQL statement: SELECT * FROM transaction WHERE product_id = 4569;

Which SQL SELECT statement capabilities are achieved when this statement is executed? Mark for Review (1) Points Selection only (*) Projection only Selection and projection only Projection, selection and joining

Incorrect. See Section 16

22. If a SQL statement returns data from two or more tables, which SQL capability is being used? Mark for Review (1) Points Selection Projection Joining (*) Insertion

Correct.

Section 17 23. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task? Mark for Review (1) Points SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00'; (*)

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00';

SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

Correct.

24. You want to create a report that displays all employees who were hired before January 1, 2000 and whose annual salaries are greater than 50000. The EMPLOYEES table contains these columns: EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY LAST_NAME VARCHAR2(35) HIREDATE DATE DEPARTMENT_ID NUMBER(4) The SALARY table contains these columns: SALARYID VARCHAR2(5) PRIMARY KEY SALARY NUMBER(5, 2) EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY Which query should you issue? Mark for Review (1) Points SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary USING employee_id WHERE hiredate < 01-jan-00 AND salary > 50000;

SELECT last_name, hiredate, salary FROM employees JOIN salary ON employee_id = employee_id WHERE hiredate < '01-jan-00' AND salary > 50000;

SELECT last_name, hiredate, salary

FROM employees NATURAL JOIN salary WHERE hiredate < '01-jan-00' AND salary > 50000; (*)

SELECT last_name, hiredate, salary FROM employees (+) salary WHERE hiredate < '01-jan-00' AND salary > 50000;

Correct

25. The PRODUCT table contains these columns: PRODUCT_ID NUMBER(9) DESCRIPTION VARCHAR2(20) COST NUMBER(5,2) LOCATION_ID VARCHAR2(10) You want to display product costs with these desired results: 1. The cost displayed for each product is increased by 10 percent. 2. The product location id must be 4859, 9789, or 9898. 3. Ten percent of the original cost is less than $10. Which statement should you issue? Mark for Review (1) Points SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 < 10.00 AND location_id IN (4859, 9789, 9898); (*)

SELECT product_id, cost * .10 FROM product WHERE cost * 1.10 > 10.00 AND location_id IN (4859, 9789, 9898);

SELECT product_id, cost * 1.10 FROM product WHERE cost * 1.10 < 10.00 AND location_id = (4859, 9789, 9898);

SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 > 10.00 AND location_id = (4859, 9789, 9898);

Correct. See Section 17

26. Which operator is used to combine columns of character strings to other columns? Mark for Review (1) Points * / + || (*)

Correct. See Section 17

27. You need to display only unique combinations of the LAST_NAME and MANAGER_ID columns in the EMPLOYEES table. Which keyword should you include in the SELECT clause? Mark for Review (1) Points ONLY UNIQUE DISTINCT (*) DISTINCTROW

Correct. See Section 17

28. You need to display all the rows in the EMPLOYEES table that contain a null value in the DEPARTMENT_ID column. Which comparison operator should you use? Mark for Review (1) Points "= NULL" NULL! ISNULL IS NULL (*)

Correct.

29. What does the DISTINCT keyword do when it is used in a SELECT clause? Mark for Review (1) Points

Hides NULL values Eliminates all unique values and compares values Eliminates duplicate rows in the result (*) Eliminates only unique rows in the result

Correct. See Section 17

30. When using the LIKE condition, which symbol represents any sequence of none, one or more characters? Mark for Review (1) Points _ % (*) # &

Correct. Page 3 of 5

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 1 Final Term Exam covers Sections 11-18 of Database Design.

Section 17 31. Which comparison condition would you use to select rows that match a character pattern? Mark for Review (1) Points IN LIKE (*) ALMOST

SIMILAR

Correct.

32. The PLAYERS table contains these columns: PLAYER_ID NUMBER(9) LAST_NAME VARCHAR2(20) FIRST_NAME VARCHAR2 (20) TEAM_ID NUMBER (4) MANAGER_ID NUMBER (9) POSITION_ID NUMBER (4) Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns? Mark for Review (1) Points SELECT * FROM players; SELECT team_id, manager_id FROM players; SELECT DISTINCT team_id, manager_id FROM players; (*) SELECT team_id, DISTINCT manager_id FROM players; SELECT team_id, manager_id DISTINCT FROM players;

Incorrect. See Section 17.

33. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"? Mark for Review (1) Points SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees; SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*) SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp; SELECT last_name||","|| job_id "Employee and Title" FROM employees;

Correct. See Section 17

34. Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? Mark for Review

(1) Points SELECT manager_id, department_id DISTINCT FROM employees; SELECT manager_id, department_id FROM employees; (*) SELECT DISTINCT manager_id, department_id FROM employees; SELECT manager_id, DISTINCT department_id FROM employees;

Incorrect. See Section 17.

35. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000; Which values would cause the logical condition to return TRUE? Mark for Review (1) Points DEPARTMENT_ID = 10 and SALARY = 20000 DEPARTMENT_ID = 20 and SALARY = 20000 DEPARTMENT_ID = null and SALARY = 20001 DEPARTMENT_ID = 10 and SALARY = 20001 (*)

Correct. See Section 17

36. You need to display all the employees whose last name starts with the letters Sm . Which WHERE clause should you use? Mark for Review (1) Points WHERE last_name LIKE 'Sm%' (*) WHERE last_name LIKE '%Sm' WHERE last_name LIKE '_Sm' WHERE last_name LIKE 'Sm_'

Correct. See Section 17

Section 18 37. Which comparison condition means "Less Than or Equal To?" Mark for Review (1) Points "=)" "+<" ">=" "<=" (*)

Correct.

38. Which statement about the ORDER BY clause is true? Mark for Review (1) Points You can use a column alias in the ORDER BY clause. (*) The default sort order of the ORDER BY clause is descending. The ORDER BY clause can only contain columns that are included in the SELECT list. The ORDER BY clause should immediately precede the FROM clause in a SELECT statement

Correct.

39. From left to right, what is the correct order of Precedence? Mark for Review (1) Points Arithmetic, Concatenation, Comparison, OR (*) NOT, AND, OR, Arithmetic Arithmetic, NOT, Logical, Comparison Arithmetic, NOT, Concatenation, Logical

Correct.

40. Which of the following is TRUE regarding the logical AND operator? Mark for Review (1) Points

TRUE AND TRUE return FALSE TRUE AND FALSE return TRUE FALSE AND TRUE return NULL TRUE AND FALSE return FALSE (*)

Correct. Page 4 of 5 Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Semester 1 Final Term Exam covers Sections 11-18 of Database Design.

Section 18 41. Which logical operator returns TRUE if either condition is true? Mark for Review (1) Points OR (*) AND NOT BOTH

Incorrect. See Section 18

42. You need to change the default sort order of the ORDER BY clause so that the data is displayed in reverse alphabetical order. Which keyword should you include in the ORDER BY clause? Mark for Review (1) Points DESC (*) ASC SORT CHANGE

Incorrect. See Section 18

43. Evaluate this SQL statement: SELECT e.employee_id, e.last_name, e.first_name, m.manager_id FROM employees e, employees m ORDER BY e.last_name, e.first_name WHERE e.employee_id = m.manager_id; This statement fails when executed. Which change will correct the problem? Mark for Review (1) Points Reorder the clauses in the query. (*) Remove the table aliases in the WHERE clause. Remove the table aliases in the ORDER BY clause. Include a HAVING clause.

Correct.

44. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(9) PK LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) Compare these two SQL statements: 1. SELECT DISTINCT department_id DEPT, last_name, first_name FROM employees ORDER BY department_id; 2. SELECT department_id DEPT, last_name, first_name FROM employees ORDER BY DEPT; How will the results differ? Mark for Review (1) Points One of the statements will return a syntax error. One of the statements will eliminate all duplicate DEPARTMENT_ID values. There is no difference in the result between the two statements. (*) The statements will sort on different column values.

Incorrect! See Section 18.

45. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees; You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use? Mark for Review (1) Points ORDER BY department_id, last_name ORDER BY manager_id, last_name, first_name (*) ORDER BY last_name, first_name, manager_id ORDER BY manager_id, first_name, last_name

Correct.

46. You need to create a report to display all employees that were hired on or after January 1, 1996. The data should display in this format: Employee Start Date and Salary 14837 - Smith 10-MAY-92 / 5000

Which SELECT statement could you use? Mark for Review (1) Points SELECT employee_id || - || last_name "Employee", hire_date || / || salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' '|| last_name "Employee", hire_date ||' '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||'"- "|| last_name "Employee", hire_date ||" / "|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name 'Employee', hire_date ||' / '|| salary 'Start Date and Salary' FROM employees WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96'; (*)

Incorrect! See Section 18.

47. You query the database with this SQL statement: SELECT price FROM products WHERE price IN(1, 25, 50, 250) AND (price BETWEEN 25 AND 40 OR price > 50); Which two values could the statement return? (Choose two.) Mark for Review (1) Points (Choose all correct answers) 1 50 25 (*) 10 250 (*) 100

Correct.

48. Evaluate this SELECT statement: SELECT last_name, first_name, email FROM employees ORDER BY email; If the EMAIL column contains null values, which statement is true?

Mark for Review (1) Points Null email values will be displayed first in the result. Null email values will be displayed last in the result. (*) Null email values will not be displayed in the result. The result will not be sorted.

Correct.

49. Evaluate this SELECT statement: SELECT employee_id, last_name, first_name, salary 'Yearly Salary' FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; Which clause contains an error? Mark for Review (1) Points SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*) FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3;

Correct.

50. Evaluate this SQL statement: SELECT product_id, product_name, price FROM products ORDER BY product_name, price; What occurs when the statement is executed? Mark for Review (1) Points The results are sorted numerically only. The results are sorted alphabetically only. The results are sorted numerically and then alphabetically.

The results are sorted alphabetically and then numerically. (*)

Correct. Page 5 of 5

You might also like