You are on page 1of 17

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. 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
2. 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
3. In a physical data model, an attribute becomes a _____________.

Mark for
Review
(1) Points

Table
Foreign Key
Constraint
Column (*)
Correct
4. The transformation from an ER diagram to a physical design involves
changing terminology. Secondary Unique Identifiers become

Mark for

Review
(1) Points
Columns
Tables
Unique Constraints (*)
Primary Key Constraints
Correct
5. The text below is an example of what constraint type?
The value in the manager_id column of the EMPLOYEES table must match a
value in the employee_id column in the EMPLOYEES table.

Mark for
Review
(1) Points

Entity integrity
User-defined integrity
Column integrity
Referential integrity (*)
Correct
6. Foreign keys must be null. True or False?

Mark for
Review
(1) Points

True
False (*)
Correct
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

Mark for
Review
(1) Points

8. 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
9. 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.

Mark for
Review
(1) Points

Entity integrity
User-defined integrity (*)
Column integrity
Referential integrity
Correct
10. 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
11. In a conceptual
model, many-tomany
relationships are
resolved via a
structure called
a/an:
________________

Mark for Review


(1) Points

Supertype
Intersection Table
Intersection Entity (*)
Subtype

Correct

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?

Mark for
Review
(1) Points

True
False (*)
Correct.
13. Systems are always just rolled out as soon as the
programming phase is finished. No further work is required
once the development is finished. True or False?

Mark for
Review
(1) Points

True
False (*)
Correct.
14. The f_customers table contains the following data:

Mark for

ID Name

Address

City

State Zip

Cole Bee

123 Main Street

Orlando

FL

32838

Zoe Twee

1009 Oliver Avenue

Boston

MA

02116

Sandra Lee

22 Main Street

Tampa

FL

32444

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.

Review
(1) Points

15. The SQL statement ALTER TABLE EMPLOYEES DELETE


COLUMN SALARY is a valid statement. True or False?

Mark for
Review
(1) Points

True
False (*)
Correct.
16. 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.
17. The DESCRIBE command returns all rows from a table. True
or False?

Mark for
Review
(1) Points

True
False (*)
Correct.
18. 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.

Section 15
(Answer all questions in this section)
19. In a SELECT clause, what is the result of 2 + 3 * 2?

Mark for
Review
(1) Points

6
8 (*)
10
13
Correct.
20. 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 15
(Answer all questions in this section)
21. You query the database with this SQL statement:
SELECT * FROM students;
Why would you use this statement?

To insert data
To view data (*)
To display the table structure
To delete data
Correct.

Mark for
Review
(1) Points

22. The EMPLOYEES table contains these columns:


SALARY NUMBER(7,2)
BONUS NUMBER(7,2)
COMMISSION_PCT NUMBER(2,2)

Mark for
Review
(1) Points

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.


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. 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.
24. In the default order of precedence, which operator would be evaluated
first?

Mark for
Review
(1) Points

Subtractions and Additions are at the same level and would be


evaluated first based on left to right order

Multiplications and Divisions are at the same level and would be


evaluated first based on left to right order (*)
Additions and Multiplications are at the same level and would be
evaluated first based on left to right order
Divisions and Subtractions are at the same level and would be
evaluated first based on left to right order
Correct.

Section 16
(Answer all questions in this section)
25. The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)

Mark for
Review
(1) Points

You are writing a SELECT statement to retrieve the names of employees


that have an email address.
SELECT last_name||', '||first_name "Employee Name"
FROM employees;
Which WHERE clause should you use to complete this statement?

WHERE email = NULL;


WHERE email != NULL;
WHERE email IS NULL;
WHERE email IS NOT NULL; (*)
Correct.
26. 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';

Mark for
Review
(1) Points

(*)
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- AUG2000';
SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= '01-MAR-2000' and hire_date <= '30-AUG-2000';
Correct.
27. You need write a SELECT statement that should only return rows that
contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator
should you use in the WHERE clause to compare the DEPARTMENT_ID
column to this specific list of values?

Mark for
Review
(1) Points

=
!=
IN (*)
BETWEEN..AND..
Correct.
28. 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 employee 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

SELECT last_name, department_id


FROM employees
WHERE employee_id = 176;
(*)

Mark for
Review
(1) Points

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.
29. You want to retrieve a list of customers whose last names begin with the
letters 'Fr' . Which keyword should you include in the WHERE clause of your
SELECT statement to achieve the desired result?

Mark for
Review
(1) Points

AND
IN
BETWEEN
LIKE (*)
Correct.
30. 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)

Mark for
Review
(1) Points

Which SELECT statement should you use if you want to display unique
combinations of the TEAM_ID and MANAGER_ID columns?

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;
Correct.
Section 16
(Answer all questions in this section)
31. You need to display employees whose salary is in the range of 30000 and
50000. Which comparison operator should you use?

Mark for

Review
(1) Points
IN
LIKE
BETWEEN...AND... (*)
IS NULL
Correct.
32. Which of the following elements cannot be included in a WHERE clause?

Mark for
Review
(1) Points

A column alias (*)


A column name
A comparison condition
A constant
Correct.
33. Which comparison condition would you use to select rows that match a
character pattern?

Mark for
Review
(1) Points

IN
LIKE (*)
ALMOST
SIMILAR
Correct.
34. You need to display employees with salaries that are at least 30000 or
higher. Which comparison operator should you use?

Mark for
Review
(1) Points

>
"=>"
>= (*)
!=

Correct.
35. You need to combine the FIRST_NAME and LAST_NAME columns in the
EMPLOYEES table and display the columns as a combined character string.
Which operator should you use?

Mark for
Review
(1) Points

+
|
|| (*)
AND
Correct.
36. Which comparison operator searches for a specified character pattern?

Mark for
Review
(1) Points

IN
LIKE (*)
BETWEEN...AND...
IS NULL
Correct.

Section 17
(Answer all questions in this section)
37. 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.)

(Choose all correct answers)


1
50

Mark for
Review
(1) Points

25 (*)
10
250 (*)
Correct.
38. 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;

Mark for
Review
(1) Points

Which clause contains an error?

SELECT employee_id, last_name, first_name, salary Yearly Salary' (*)


FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Correct.
39. Evaluate this SELECT statement:
SELECT last_name, first_name, email
FROM employees
ORDER BY email;

Mark for
Review
(1) Points

If the EMAIL column contains null values, which statement is true?

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.
40. 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
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.
Section 17
(Answer all questions in this section)
41. Evaluate this SELECT statement:
SELECT first_name, last_name, email
FROM employees
ORDER BY last_name;

Mark for
Review
(1) Points

Which statement is true?

The rows will not be sorted.


The rows will be sorted alphabetically by the LAST_NAME values. (*)
The rows will be sorted in reverse alphabetical order by the LAST_NAME
values.
The rows will be sorted alphabetically by the FIRST_NAME and then the
LAST_NAME values
Correct.
42. 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?

One of the statements will return a syntax error.


One of the statements will eliminate all duplicate DEPARTMENT_ID
values.

Mark for
Review
(1) Points

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

Mark for
Review
(1) Points

This statement fails when executed. Which change will correct the problem?

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

Mark for
Review
(1) Points

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.
45. Which clause would you include in a SELECT statement to sort the rows
returned by the LAST_NAME column?

Mark for
Review
(1) Points

ORDER BY (*)
WHERE
FROM
HAVING
Correct.
46. Which logical operator returns TRUE if either condition is true?

Mark for
Review
(1) Points

OR (*)
AND
NOT
BOTH
Correct.
47. 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
Correct.

48. Which of the following best describes the meaning of the LIKE operator?

Mark for
Review
(1) Points

Display rows based on a range of values.


To test for values in a list.
Match a character pattern. (*)
To find Null values.
Correct.
49. Which comparison condition means "Less Than or Equal To"?

Mark for
Review
(1) Points

"=)"
"+<"
">="
"<=" (*)
Correct.
50. Which statement about the default sort order is true?

Mark for
Review
(1) Points

The lowest numeric values are displayed last.


The earliest date values are displayed first. (*)
Null values are displayed first.
Character values are displayed in reverse alphabetical order.
Correct.

You might also like