sâmbătă, 8 mai 2010

Test: Final Exam Semester 2 - Part I (21-30)

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Part I of the Semester 2 Final Exam covers Sections 8-9 of Database Programming with SQL.
Section 8
21. Which statement about a column is NOT true? Mark for Review
(1) Points
You can increase the width of a CHAR column.
You can modify the data type of a column if the column contains non-null data. (*)
You can convert a CHAR data type column to the VARCHAR2 data type.
You can convert a DATE date type column to a VARCHAR2 column.
Correct Correct
22. You want to issue the following command on a database that includes your company's inventory information:
ALTER TABLE products SET UNUSED COLUMN color;

What will be the result of issuing this command?

Mark for Review
(1) Points
The column named COLOR in the table named PRODUCTS will be assigned default values.
The column named COLOR in the table named PRODUCTS will be created.
The column named COLOR in the table named PRODUCTS will be deleted.
The column named COLOR in the table named PRODUCTS will not be returned in subsequent reads of the table by Oracle, as is has been deleted logically. (*)
Correct Correct
23. You need to remove all the data in the SCHEDULE table, the structure of the table, and the indexes associated with the table. Which statement should you use? Mark for Review
(1) Points
DROP TABLE (*)
TRUNCATE TABLE
ALTER TABLE
DELETE TABLE
Correct Correct
24. Evaluate the structure of the EMPLOYEES table:

EMPLOYEE_ID NUMBER(9)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
MANAGER_ID NUMBER(9)
SALARY NUMBER(7,2)

The EMPLOYEE_ID column currently contains 500 employee identification numbers. Business requirements have changed and you need to allow users to include text characters in the identification values. Which statement should you use to change this column's data type?

Mark for Review
(1) Points
ALTER TABLE employees
MODIFY (employee_id VARCHAR2(9));
ALTER TABLE employees
REPLACE (employee_id VARCHAR2(9));
ALTER employees TABLE
MODIFY COLUMN (employee_id VARCHAR2(15));
You CANNOT modify the data type of the EMPLOYEE_ID column, as the table is not empty. (*)
CorrectCorrect
Section 9
25. When creating the EMPLOYEES table, which clause could you use to ensure that salary values are 1000.00 or more? Mark for Review
(1) Points
CONSTRAINT CHECK salary > 1000
CHECK CONSTRAINT (salary > 1000)
CONSTRAINT employee_salary_min CHECK salary > 1000
CONSTRAINT employee_salary_min CHECK (salary >= 1000) (*)
CHECK CONSTRAINT employee_salary_min (salary > 1000)
Correct Correct
26. You need to create the PROJECT_HIST table. The table must meet these requirements:

  1. The table must contain the EMPLOYEE_ID and TASKED_HOURS columns for numeric data.
  2. The table must contain the START_DATE and END_DATE column for date values.
  3. The table must contain the HOURLY_RATE and PROJECT_COST columns for numeric data with precision and scale of 5,2 and 10,2 respectively.
  4. The table must have a composite primary key on the EMPLOYEE_ID and START_DATE columns.

Evaluate this CREATE TABLE statement:

CREATE TABLE project_hist
( employee_id NUMBER,
start_date DATE,
end_date DATE,
tasked_hours NUMBER,
hourly_rate NUMBER(5,2),
project_cost NUMBER(10,2),
CONSTRAINT project_hist_pk PRIMARY KEY(employee_id, start_date));

How many of the requirements does the CREATE TABLE statement satisfy?

Mark for Review
(1) Points
None of the four requirements
All four of the requirements (*)
Only three of the requirements
Only two of the requirements
Correct Correct
27. Which type of constraint by default requires that a column be both unique and not null? Mark for Review
(1) Points
FOREIGN KEY
PRIMARY KEY (*)
UNIQUE
CHECK
Incorrect Incorrect. Refer to Section 9
28. Which of the following FOREIGN KEY Constraint keywords identifies the table and column in the parent table? Mark for Review
(1) Points
RESEMBLES
ON DELETE CASCADE
REFERENTIAL
REFERENCES (*)
Correct Correct
29. What must exist on the Parent table before Oracle will allow you to create a FOREIGN KEY constraint from a Child table? Mark for Review
(1) Points
A FOREIGN KEY constraint allows the constrained column to contain values that exist in the primary key column of the parent table.
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
An index must exist on the Parent table.
A CHECK constraint must exist on the Parent table.
Correct Correct
30. Which clause could you use to ensure that cost values are greater than 1.00? Mark for Review
(1) Points
CONSTRAINT CHECK cost > 1.00
CONSTRAINT part_cost_ck CHECK (cost > 1.00) (*)
CHECK CONSTRAINT part_cost_ck (cost > 1.00)
CONSTRAINT CHECK part_cost_ck (cost > 1.00)
Correct Correct

Niciun comentariu:

Trimiteți un comentariu