Final Exam Semester 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

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

An asterisk (*) indicates a correct answer. Section 11 (Answer all questions in this section) 1. One-to-One relationships are transformed into Check Constraints in the tables created at either end of that relationship. True or False? True False (*) Correct 2. The Oracle Database can implement a many-to-many relationship. You simply create two foreign keys between the two tables. True or False? True False (*) Correct 3. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two Unique Key Constraints to ensure the Arc is implemented correctly. True or False? True False (*) Correct 4. The transformation from an ER diagram to a physical design involves changing terminology. Secondary Unique Identifiers become Columns Tables Unique Constraints (*) Primary Key Constraints Incorrect. Refer to Section 11 Lesson 2. 5. In a physical data model, an attribute becomes a _____________. Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

Table Foreign Key Constraint Column (*) Correct

6. In an Oracle database, why would 1_TABLE not work as a table name?

Mark for Review (1) Points

The database does not understand all capital letters. There is no problem here. You can create a table called 1_TABLE. Object names must not start with a number. They must begin with a letter. (*) TABLE is a reserved word. Incorrect. Refer to Section 11 Lesson 2. 7. The explanation below is a column integrity constraint. True or False? A column must contain only values consistent with the defined data format of the column. True (*) False Correct 8. Foreign keys must be null. True or False? Mark for Review (1) Points Mark for Review (1) Points

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

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

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 11

(Answer all questions in this section) 11. The text below is an example of what constraint type? If the number of BOOKS lent to a BORROWER in the LIBRARY exceeds 5, then we must send him a letter requesting the return of the BOOKS; this will require extra programming to enforce. Entity integrity User-defined integrity (*) Column integrity Referential integrity Incorrect. Refer to Section 11 Lesson 1. Section 12 (Answer all questions in this section) 12. System Documentation is developed right at the end once the system has gone live and users have been using it for a little while. You are more likely to get it correct that way. True or False? True False (*) Incorrect. Refer to Section 12 Lesson 4. 13. In the Analysis phase, the tables are created and populated with test data. True or False? True False (*) Correct. 14. Once you have created a table, it is not possible to alter the definition of it. If you need to add a new column you must delete the table definition and create a new, correct table. True or False? True False (*) Incorrect. Refer to Section 12 Lesson 2. 15. The f_customers table contains the following data: Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

ID Name 1 2 3 Cole Bee

Address 123 Main Street

City

State Zip 32838 32444

Orlando FL Tampa FL

Zoe Twee 1009 Oliver Avenue Boston MA 02116 Sandra Lee 22 Main Street

If you run the following statement: DELETE FROM F_CUSTOMERS WHERE ID <= 2;

How many rows will be left in the table? 0 3 1 (*) 2 Correct. 16. The DESCRIBE command returns all rows from a table. True or False? Mark for Review (1) Points

True False (*) Correct. 17. The _______ clause can be added to a SELECT statement to return a subset of the data. ANYWHERE WHICH WHERE (*) EVERY Correct. 18. What command will return data from the database to you? Mark for Review (1) Points Mark for Review (1) Points

FETCH GET SELECT (*) RETURN Correct. Section 15 (Answer all questions in this section) 19. When you use the SELECT clause to list one or two columns only from a table and no WHERE clause, which SQL capability is used? Joining only Selection only Projection only (*) Projection and Selection Correct. Mark for Review (1) Points

20. If a SQL statement returns data from two or more tables, which SQL capability is being used? Selection Projection Joining (*) Insertion Incorrect. See Section 15 Lesson 1.

Mark for Review (1) Points

Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 15 (Answer all questions in this section) 21. 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. 22. 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? Statement 1 will return a higher value than statement 2. Mark for Review (1) Points

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. Correct. 23. 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? 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. 24. The SELECT statement retrieves information from the database. In a SELECT statement, you can do all of the following EXCEPT: Projection Manipulation (*) Joining Selection Incorrect. See Section 15 Lesson 1. Section 16 (Answer all questions in this section) 25. The Concatenation Operator does which of the following? Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

Links rows of data together inside the database. Links two or more columns or literals to form a single output column (*) Is represented by the asterisk (*) symbol Separates columns. Correct.

26. Which symbol represents the not equal to condition?

Mark for Review (1) Points

# +' != (*) ~ Correct. 27. You need to display employees whose salary is in the range of 10000 through 25000 for employees in department 50 . What does the WHERE clause look like? WHERE department_id < 50 <br> AND salary BETWEEN 10000 AND 25000 WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000 WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001 WHERE department_id = 50 AND salary BETWEEN 10000 AND 25000 (*) Incorrect. See Section 16 Lesson 1. 28. Which statement best describes how column headings are displayed by default in Oracle Application Express: Column headings are displayed left-justified and in lowercase. Column headings are displayed left-justified and in uppercase. Column headings are displayed centered and in uppercase. (*) Column headings are displayed centered and in mixed case. Correct. 29. You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use? > "=>" >= (*) != Correct. 30. Which of the following elements cannot be included in a WHERE clause? Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

A column alias (*) A column name

A comparison condition A constant Incorrect. See Section 16 Lesson 1. Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 16 (Answer all questions in this section) 31. You want to determine the orders that have been placed by customers who reside in the city of Chicago. You write this partial SELECT statement: SELECT orderid, orderdate, total FROM orders; What should you include in your SELECT statement to achieve the desired results? AND city = Chicago; AND city = 'Chicago'; WHERE city = 'Chicago'; (*) WHERE city = Chicago; Correct. 32. What will be the result of the SELECT statement and what will display? SELECT last_name, salary, salary + 300 FROM employees; Display the last name, salary, and the results of adding 300 to each salary for all the employees (*) Display the last name and salary of all employees who have a salary greater than 300. Modify the salary column by adding 300 and only display the last name and the new salary. Display the last name, salary, and the results of adding 300 to the salary of the first employee row Correct. 33. 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? SELECT * FROM players; Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

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; Correct. 34. 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"? 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; Incorrect. See Section 16 Lesson 2. 35. If you write queries using the BETWEEN operator, it does not matter in what order you enter the values, i.e. BETWEEN low value AND high value will give the same result as BETWEEN high value and low value. True or False? True False (*) Incorrect. See Section 16 Lesson 3. 36. 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 last names, first 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? SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-2000' AND '30-AUG-2000'; (*) SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-2000' AND '01-MAR-2000'; SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-2000' and hire_date <= '30- AUG-2000'; SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-2000' and hire_date <= '30-AUG-2000'; Correct. Mark for Review (1) Points Mark for Review (1) Points Mark for Review (1) Points

Section 17 (Answer all questions in this section) 37. 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? DESC (*) ASC SORT CHANGE Correct. 38. From left to right, what is the correct order of Precedence? Mark for Review (1) Points Mark for Review (1) Points

Arithmetic, Concatenation, Comparison, OR (*) NOT, AND, OR, Arithmetic Arithmetic, NOT, Logical, Comparison Arithmetic, NOT, Concatenation, Logical Correct. 39. Which comparison condition means "Less Than or Equal To"? Mark for Review (1) Points

"=)" "+<" ">=" "<=" (*) Correct. 40. The ORDER BY clause always comes last. True or False? Mark for Review (1) Points

True (*) False Correct. Test: Final Exam Semester 1 Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 17 (Answer all questions in this section) 41. 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. 42. Which statement about the logical operators is true? Mark for Review (1) Points

The order of operator precedence is AND, OR, and NOT. The order of operator precedence is AND, NOT, and OR. The order of operator precedence is NOT, OR, and AND. The order of operator precedence is NOT, AND, and OR. (*) Correct. 43. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id = 34 OR department_id = 45 OR department_id = 67; Which operator is the equivalent of the OR conditions used in this SELECT statement? IN (*) AND LIKE BETWEEN ... AND ... Correct. 44. Evaluate this SELECT statement: SELECT last_name, first_name, salary FROM employees; How will the results of this query be sorted? The database will display the rows in whatever order it finds it in the database, so no particular order. (*) The results will be sorted ascending by the LAST_NAME column only. The results will be sorted ascending by LAST_NAME and FIRST_NAME only. The results will be sorted ascending by LAST_NAME, FIRST_NAME, and SALARY. Correct. 45. You need to create a report to display all employees that were hired on or before January 1, 1996. The data should display in this format: Mark for Review Mark for Review (1) Points Mark for Review (1) Points

Employee 14837 - Smith

Start Date and Salary 10-MAY-1992 / 5000

(1) Points

Which SELECT statement could you use? SELECT employee_id || - || last_name "Employee", hire_date || / || salary "Start Date and Salary FROM employees WHERE hire_date <= '01-JAN-1996'; SELECT employee_id ||' '|| last_name "Employee", hire_date ||' '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= 01-JAN-1996'; SELECT employee_id ||'"- "|| last_name "Employee", hire_date ||" / "|| salary Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996'; SELECT employee_id ||' - '|| last_name 'Employee', hire_date ||' / '|| salary 'Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996'; SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-1996'; (*) Correct. 46. Evaluate this SQL statement: SELECT product_id, product_name, price FROM products ORDER BY product_name, price; What occurs when the statement is executed? 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. 47. What value will the following SQL statement return? SELECT employee_id FROM employees WHERE employee_id BETWEEN 100 AND 150 OR employee_id IN(119, 175, 205) AND (employee_id BETWEEN 150 AND 200); 19 No rows will be returned Mark for Review (1) Points Mark for Review (1) Points

100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*) 200, 201, 202, 203, 204, 205, 206 Correct. 48. The PLAYERS table contains these columns: PLAYERS TABLE: LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) SALARY NUMBER(8,2) TEAM_ID NUMBER(4) MANAGER_ID NUMBER(9) POSITION_ID NUMBER(4) You must display the player name, team id, and salary for players whose salary is in the range from 25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be sorted by team id from lowest to highest and then further sorted by salary from highest to lowest. Which statement should you use to display the desired result? SELECT last_name, first_name, team_id, salary FROM players WHERE (salary > 25000 OR salary < 100000) AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id, salary; SELECT last_name, first_name, team_id, salary FROM players WHERE salary BETWEEN 25000 AND 100000 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id, salary DESC; (*) SELECT last_name, first_name, team_id, salary FROM players WHERE salary > 24999.99 AND salary < 100000 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id ASC, salary DESC; SELECT last_name, first_name, team_id, salary FROM players WHERE salary BETWEEN 24999.99 AND 100000.01 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id DESC, salary DESC; Correct. 49. 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 Mark for Review (1) Points Mark for Review (1) Points

ORDER BY department_id; 2. SELECT department_id DEPT, last_name, first_name FROM employees ORDER BY DEPT; How will the results differ? 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 17 Lesson 3. 50. The PLAYERS table contains these columns: PLAYERS TABLE: LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) SALARY NUMBER(8,2) TEAM_ID NUMBER(4) MANAGER_ID NUMBER(9) POSITION_ID NUMBER(4) You want to display all players' names with position 6900 or greater. You want the players names to be displayed alphabetically by last name and then by first name. Which statement should you use to achieve the required results? SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name, first_name; (*) SELECT last_name, first_name FROM players WHERE position_id > 6900 ORDER BY last_name, first_name; SELECT last_name, first_name FROM players WHERE position_id <= 6900 ORDER BY last_name, first_name; SELECT last_name, first_name FROM players WHERE position_id >= 6900 ORDER BY last_name DESC, first_name; Correct. Mark for Review (1) Points

You might also like