Sei sulla pagina 1di 18

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.

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

Incorrect. Refer to Section 11 Lesson 1.

2. 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

3. Identify all of the incorrect statements that complete this sentence: A pr


imary key is: (Choose three) Mark for Review
(1) Points
(Choose all correct answers)
A single column that uniquely identifies each column in a table (*)
One or more columns in a table that uniquely identifies each row in that tab
le
A set of columns in one table that uniquely identifies each row in another t
able (*)
Only one column that must be null (*)

Correct
4. If a primary key is a set of columns then one column must be null. True or
False? Mark for Review
(1) Points
True
False (*)

Correct

5. 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/her a letter requesting the return of the BOOKS, which will require ex
tra programming to enforce.
Mark for Review
(1) Points
Entity integrity
User-defined integrity (*)

Column integrity
Referential integrity

Correct

6. Why would this table name NOT work in an Oracle database? this_year_end+ne
xt_year Mark for Review
(1) Points
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above

Correct

7. In an Oracle database, why would 1_TABLE not work as a table name? Mark f
or 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


Correct

8. Attributes become tables in a database. True or False? Mark for Review


(1) Points
True
False (*)

Correct

9. What do you create when you transform a many to many relationship from you
r 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

10. Many to many relationships are implemented via a structure called a: ____
____________ Mark for Review
(1) Points
Supertype
Intersection Table (*)
Intersection Entity
Subtype

Incorrect. Refer to Section 12

Page 1 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.

Section 11
11. When translating an arc relationship to a physical design, you must turn
the arc relationships into foreign keys. Assuming you are implementing an Exclus
ive Design, you must also create two Unique Key Constraints to ensure the Arc is
implemented correctly. True or False? Mark for Review
(1) Points
True
False (*)

Correct

Section 12
12. What command can be used to create a new row in a table in the database?
Mark for Review
(1) Points
CREATE
NEW
ADD
INSERT (*)

Correct.

13. The _______ clause can be added to a SELECT statement to return a subset
of the data. Mark for Review
(1) Points

ANYWHERE
WHICH
WHERE (*)
EVERY

Correct.

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

Correct.

15. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid s
tatement. True or False? Mark for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 12 Lesson 2.

16. 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? Mark for Review
(1) Points
True
False (*)

Correct.

Section 13
17. Systems are always just rolled out as soon as the programming phase is fi
nished. No further work is required once the development is finished. True or Fa
lse? Mark for Review
(1) Points
True
False (*)

Correct.

18. In the analysis phase the tables are created and populated with test data
. True or False? Mark for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 13 Lesson 1.

Section 15
19. 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 exec
uted?
Mark for Review
(1) Points
Selection only (*)

Projection only
Selection and projection only
Projection, selection and joining

Incorrect. See Section 15 Lesson 1.

20. In a SQL statement, which clause specifies one or more columns to be retu
rned by the query? Mark for Review
(1) Points
SELECT (*)
FROM
WHERE
Any of the above options, you can list columns wherever you want to in a SEL
ECT statement.

Correct.

Page 2 of 5

Test: Final Exam Semester 1


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.

Section 15
21. In the default order of precedence, which operator would be evaluated fir
st? Mark for Review
(1) Points
Subtractions and Addition are at the same level and would be evaluated first
based on left to right order
Multiplications and Division are at the same level and would be evaluated fi
rst based on left to right order (*)
Additions and Multiplications are at the same level and would be evaluated f
irst based on left to right order
Divisions and Subtractions are at the same level and would be evaluated firs
t based on left to right order

Correct.

22. When you use the SELECT clause to list one or two columns only from a tab
le and no WHERE clause, which SQL capability is used? Mark for Review
(1) Points
Joining only
Selection only
Projection only (*)
Projection and Selection

Correct.

23. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review


(1) Points
6
8 (*)
10
13

Correct.
24. When listing columns in the SELECT list, what should you use to separate
the columns? Mark for Review
(1) Points
Commas (*)
Semicolons
Dashes
Underscores

Correct.

Section 16
25. You need to display employees whose salary is in the range of 30000 and 5
0000. Which comparison operator should you use? Mark for Review
(1) Points
IN
LIKE
BETWEEN...AND... (*)
IS NULL

Correct.

26. You need to display employees with salaries that are at least 30000 or hi
gher. Which comparison operator should you use? Mark for Review
(1) Points
>
"=>"

>= (*)
!=

Correct.

27. Which comparison condition would you use to select rows that match a char
acter pattern? Mark for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR

Correct.

28. You need to display employees whose salary is in the range of 10000 throu
gh 25000 for employees in department 50 . What does the WHERE clause look like?
Mark for Review
(1) Points
WHERE department_id < 50
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 25000 AND 10000
(*)

Correct.

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

IS NULL (*)

Correct.

30. When using the LIKE condition to search for _ symbols, which character ca
n you use as the default ESCAPE option? 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 (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.

Section 16
31. You need to display all the values in the EMAIL column that contains the
underscore (_) character as part of that email address. The WHERE clause in your
SELECT statement contains the LIKE operator. What must you include in the LIKE
operator? Mark for Review
(1) Points
The ESCAPE option (\) and one or more percent signs (%)
The (+) operator
A percent sign (%)
The ESCAPE option (\) (*)

Incorrect. See Section 16 Lesson 2.

32. You want to retrieve a list of customers whose last names begin with the
letters Fr . Which symbol should you include in the WHERE clause of your SELECT
statement to achieve the desired result? Mark for Review
(1) Points
% (*)
~
#
*

Correct.
33. You need to display all the employees whose last name starts with the let
ters 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.

34. If the EMPLOYEES table has the following columns, and you want to write a
SELECT statement to return the employee last name and department number for emp
loyee number 176, which of the following SQL statements should you use?
Name Type Length
EMPLOYEE_ID NUMBER 22
FIRST_NAME VARCHAR2 20
LAST_NAME VARCHAR2 25
EMAIL VARCHAR2 25
PHONE_NUMBER VARCHAR2 20
SALARY NUMBER 22
COMMISSION_PCT NUMBER 22
MANAGER_ID NUMBER 22
DEPARTMENT_ID NUMBER 22

Mark for Review


(1) Points
SELECT last_name, department_id
FROM employees
WHERE employee_id = 176;
(*)

SELECT last_name, department_id


FROM employees
WHERE employee_id equals 176;

SELECT first_name, employee_id


FROM employees
WHERE employee_id = 176;

SELECT last_name, employee_id


FROM employees
WHERE employee_id equals 176;

Correct.
35. When is an entity in 2nd Normal Form? Mark for Review
(1) Points
When all non-UID attributes are dependent upon the entire UID. (*)
When no attritibutes are mutually independant and fully independent on the p
rimary key.
When no attritibutes are mutually independent and all are fully dependent on
the primary key.
None of the Above.

Correct

36. Would it be a good idea to model age as an attribute of STUDENT? Mark fo


r 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 (*)

Correct

Section 17
37. Which logical operator returns TRUE if either condition is true? Mark fo
r Review
(1) Points
OR (*)

AND
NOT
BOTH

Correct.

38. The ORDER BY clause always comes last. True or False? Mark for Review
(1) Points
True (*)
False
Correct.

39. Which comparison condition means "Less Than or Equal To"? Mark for Revie
w
(1) Points
"=)"
"+<"
">="
"<=" (*)

Correct.

40. Which clause would you include in a SELECT statement to sort the rows ret
urned by the LAST_NAME column? Mark for Review
(1) Points
ORDER BY (*)
WHERE
FROM
HAVING

Correct.

Page 4 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.

Section 17
41. Which of the following are 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.

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 in
clude in the ORDER BY clause? Mark for Review
(1) Points
DESC (*)
ASC

SORT
CHANGE

Correct.

43. Which SELECT statement should you use to limit the display of product inf
ormation to those products with a price of less than 50? Mark for Review
(1) Points
SELECT product_id, product_name
FROM products
WHERE price < 50;
(*)

SELECT product_id, product_name


FROM products
HAVING price < 50;

SELECT product_id, product_name


FROM products
WHERE price <= 50;

SELECT product_id, product_name


FROM products
GROUP BY price < 50;

SELECT product_id, product_name


FROM products
WHERE price < 50.00
GROUP BY price;
Correct.

44. You need to create a report to display all employees that were hired on o
r 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';
(*)

Correct.

45. Evaluate this SELECT statement:


SELECT last_name, first_name, salary
FROM employees;
How will the results of this query be sorted?
Mark for Review
(1) Points
The database will display the rows in whatever order it finds it in the data
base, 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.

46. 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 (*)

Correct.

47. You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
WHERE "Category" = 5570
ORDER BY "Product Number";
This statement fails when executed. Which clause contains a syntax error?
Mark for Review
(1) Points
SELECT product_id "Product Number", category_id "Category", price "price"
ORDER BY "Product Number";
FROM products
WHERE "Category" = 5570 (*)

Correct.

48. 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 17 Lesson 3.

49. 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.

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 t
he players names to be displayed alphabetically by last name and then by first n
ame. Which statement should you use to achieve the required results?
Mark for Review
(1) Points
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.

Page 5 of 5

Potrebbero piacerti anche