Вы находитесь на странице: 1из 17

TEST 2

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. 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
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. A table must have a primary key. True or False?

Mark for
Review
(1) Points

True
False (*)
Incorrect. Refer to Section 11 Lesson 1.

4. Foreign keys must be null. True or False?

Mark for
Review
(1) Points

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

Mark for
Review
(1) Points

True (*)
False
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. To resolve a many to many relationship in a physical model you create a/an
___________________?

Mark for
Review
(1) Points

Unique key constraints


Intersection entity

Intersection table (*)


Two tables with Foreign key constraints between them
Correct
9. The transformation from an ER diagram to a physical design involves
changing terminology. Primary Unique Identifiers in the ER diagram become
__________ and relationships become ____________.

Mark for
Review
(1) Points

Foreign keys, Primary keys


Primary keys, Foreign keys (*)
Foreign keys, mandatory business rules
Unique Keys, Primary keys
Correct
10. 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

Section 11
(Answer all questions in this section)
11. 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 (*)
Incorrect. Refer to Section 11 Lesson 2.

Section 12
(Answer all questions in this section)
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 (*)
Correct.
14. 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.
15. During which phases of the System Development Life Cycle would you test
the system before rolling it out to the users?

Mark for
Review
(1) Points

Build and Transition


Strategy and Analysis
Design and Production
Transition and Production (*)
Correct.
16. 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.
17. 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.
18. 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

Review
(1) Points

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.

Section 15
(Answer all questions in this section)
19. 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:

Mark for
Review
(1) Points

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.
20. 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.
Section 15
(Answer all questions in this section)
21. What would you use in the SELECT clause to return all the columns in the
table?

Mark for
Review
(1) Points

An asterisk (*) (*)


A minus sign (-)
A plus sign (+)
The ALL keyword
Correct.
22. In which clause of a SELECT statement would you specify the name of the
table or tables being queried?

Mark for
Review
(1) Points

The FROM clause (*)


The SELECT clause
The WHERE clause
Any of the above options; you can list tables wherever you want in a
SELECT statement.
Correct.
23. You query the database with this SQL statement:
SELECT *
FROM transaction
WHERE product_id = 4569;

Mark for
Review
(1) Points

Which SQL SELECT statement capabilities are achieved when this statement
is executed?

Selection only
Projection only
Selection and projection only (*)
Projection, selection and joining
Correct.

24. In a SQL statement, which clause specifies one or more columns to be


returned 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 SELECT statement.
Correct.

Section 16
(Answer all questions in this section)
25. 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.
26. 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;
Correct.
27. The PLAYERS table contains these columns:

Mark for

PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER (4)
MANAGER_ID NUMBER (9)

Review
(1) Points

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;


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.
28. Evaluate this SELECT statement:

Mark for

SELECT *
FROM employees
WHERE department_id IN(10, 20, 30)
AND salary > 20000;

Review
(1) Points

Which values would cause the logical condition to return TRUE?

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.
29. Which symbol represents the not equal to condition?

Mark for
Review
(1) Points

#
+'
!= (*)
~
Correct.
30. Which comparison operator searches for a specified character pattern?

Mark for
Review
(1) Points

IN
LIKE (*)
BETWEEN...AND...
IS NULL
Correct.
Section 16
(Answer all questions in this section)
31. Which clause would you include in a SELECT statement to restrict the data
returned to only the employees in department 10?

Mark for
Review
(1) Points

WHERE (*)
FROM
SELECT
IS
Correct.
32. The Concatenation Operator does which of the following?

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

10

34. 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.
35. 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.
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

Mark for
Review
(1) Points

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';
(*)

11

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.

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

12

The order of operator precedence is NOT, AND, and OR. (*)


Correct.
40. Which logical operator returns TRUE if either condition is true?

Mark for
Review
(1) Points

OR (*)
AND
NOT
BOTH
Correct.
Section 17
(Answer all questions in this section)
41. 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.
42. Which comparison condition means "Less Than or Equal To"?

Mark for
Review
(1) Points

"=)"
"+<"
">="
"<=" (*)
Correct.
43. The PLAYERS table contains these columns:

Mark for

PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)

Review
(1) Points

13

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

Mark for
Review
(1) Points

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?

14

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.
45. Evaluate this SQL statement:

Mark for

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;

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.
46. Evaluate this SELECT statement:

Mark for

SELECT last_name, first_name, email


FROM employees
ORDER BY email;

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.
47. Evaluate this SELECT statement:

Mark for

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?

15

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.
48. 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:

Employee
14837 - Smith

Start Date and Salary


10-MAY-1992 / 5000

Mark for
Review
(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.
49. Evaluate this SELECT statement:

Mark for

SELECT last_name, first_name, salary


FROM employees;

Review
(1) Points

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.

16

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

17

Mark for
Review
(1) Points

Вам также может понравиться