Only Click My Ads Brother, Help this Site Alive

Monday, July 18, 2016

SOLOSOLOKU: Database Programming with SQL Final Exam

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 12
(Answer all questions in this section)

1. If a default value was set for a null column, Oracle sets the column to the default value. However, if no default value was set when the column was created, Oracle inserts an empty space. True or False?
True
False (*)

2. The MERGE statement first tries to update one or more rows in a table that match the criteria; if no row matches the criteria for the update, a new row will automatically be inserted instead. True or False?  
True (*)
False

3. Assume all the column names are correct. The following SQL statement will execute which of the following?
INSERT INTO departments
(department_id, department_name, manager_id, location_id)
VALUES (70, 'Public Relations', 100, 1700);

'Public Relations' will be inserted into the manager_name column.
100 will be inserted into the department_id column.
1700 will be inserted into the manager_id column.
70 will be inserted into the department_id column. (*)

4. You need to add a row to an existing table. Which DML statement should you use?  
INSERT (*)
UPDATE
DELETE
CREATE

5. Which two commands can be used to modify existing data in a database row?
(Choose all correct answers)
UPDATE (*)
MERGE (*)
SELECT
DELETE

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 12
(Answer all questions in this section)

6. Which of the following statements best describes what will happen to the student table in this SQL statement?
UPDATE students
SET lunch_number =
    (SELECT lunch_number
     FROM student
     WHERE student_id = 17)
WHERE student_id = 19;

Inserts a new row into the students table.
The statement updates the student_table by replacing student id 19's lunch number with student id 17's lunch number. (*)
Does nothing as you cannot use subqueries in UPDATE statements.
Deletes student 17's lunch_number and inserts a new value from student 19.

7. Examine the structures of the PRODUCTS and SUPPLIERS tables:
SUPPLIERS:
SUPPLIER_ID NUMBER NOT NULL, Primary Key
SUPPLIER_NAME VARCHAR2 (25)
ADDRESS VARCHAR2 (30)
CITY VARCHAR2 (25)
REGION VARCHAR2 (10)
POSTAL_CODE VARCHAR2 (11)

PRODUCTS:
PRODUCT_ID NUMBER NOT NULL, Primary Key
PRODUCT_NAME VARCHAR2 (25)
SUPPLIER_ID NUMBER Foreign key to SUPPLIER_ID of the SUPPLIERS table
CATEGORY_ID NUMBER
QTY_PER_UNIT NUMBER
UNIT_PRICE NUMBER (7,2)
QTY_IN_STOCK NUMBER
QTY_ON_ORDER NUMBER
REORDER_LEVEL NUMBER

You want to delete any products supplied by the five suppliers located in Atlanta. Which script should you use?

DELETE FROM products
WHERE supplier_id IN
(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');
(*)

DELETE FROM products
WHERE supplier_id =
(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');

DELETE FROM suppliers
WHERE supplier_id IN
(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ALANTA');

DELETE FROM products
WHERE UPPER(city) = 'ATLANTA';

8. Examine the structures of the PLAYERS, MANAGERS, and TEAMS tables:
PLAYERS:
PLAYER_ID NUMBER Primary Key
LAST_NAME VARCHAR2 (30)
FIRST_NAME VARCHAR2 (25)
TEAM_ID NUMBER
MGR_ID NUMBER
SIGNING_BONUS NUMBER(9,2)
SALARY NUMBER(9,2)

MANAGERS:
MANAGER_ID NUMBER Primary Key
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER

TEAMS:
TEAM_ID NUMBER Primary Key
TEAM_NAME VARCHAR2 (20)
OWNER_LAST_NAME VARCHAR2 (20)
OWNER_FIRST_NAME VARCHAR2 (20)

Which situation would require a subquery to return the desired result?
To display the names of each player on the Lions team
To display the maximum and minimum player salary for each team
To display the names of the managers for all the teams owned by a given owner (*)
To display each player, their manager, and their team name for all teams with an id value greater than 5000

Section 13
(Answer all questions in this section)

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

The column named COLOR in the table named PRODUCTS will not be returned in subsequent reads of the table by Oracle, as it has been deleted logically. (*)
The column named COLOR in the table named PRODUCTS will be created.
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 deleted.

10. Which command could you use to quickly remove all data from the rows in a table without deleting the table itself?
ALTER TABLE
TRUNCATE TABLE (*)
DROP TABLE
MODIFY

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 13
(Answer all questions in this section)

11. The TEAMS table contains these columns:
TEAM_ID NUMBER(4) Primary Key
TEAM_NAME VARCHAR2(20)
MGR_ID NUMBER(9)

The TEAMS table is currently empty. You need to allow users to include text characters in the manager identification values. Which statement should you use to implement this?
ALTER TABLE teams
REPLACE (mgr_id VARCHAR2(15));

ALTER TABLE teams
MODIFY (mgr_id VARCHAR2(15));
(*)

ALTER teams TABLE
MODIFY COLUMN (mgr_id VARCHAR2(15));

ALTER teams
MODIFY (mgr_id VARCHAR2(15));

You CANNOT modify the data type of the MGR_ID column.

12. The PLAYERS table contains these columns:
PLAYER_ID NUMBER(9) PRIMARY KEY
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
TEAM_ID NUMBER(4)
SALARY NUMBER(9,2)

Which statement should you use to decrease the width of the FIRST_NAME column to 10 if the column currently contains 1500 records, but none are longer than 10 bytes or characters?

ALTER players TABLE
MODIFY COLUMN (first_name VARCHAR2(10));

ALTER players TABLE
MODIFY COLUMN first_name VARCHAR2(10);

ALTER TABLE players
RENAME first_name VARCHAR2(10);

ALTER TABLE players
MODIFY (first_name VARCHAR2(10));
(*)


13. When should you use the SET UNUSED command?
You should use it when you need a quick way of dropping a column. (*)
Never, there is no SET UNUSED command.
You should only use this command if you want the column to still be visible when you DESCRIBE the table.
You should use it if you think the column may be needed again later.

14. You need to remove all the rows from the SALES_HIST table. You want to release the storage space, but do not want to remove the table structure. Which statement should you use?

The ALTER TABLE statement
 The DELETE statement
The DROP TABLE statement
The TRUNCATE TABLE statement (*)

15. A column that will be used to store binary data up to 4 Gigabytes in size should be defined as which datatype?  

BLOB (*)
LONG
NUMBER
LONGRAW

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 13
(Answer all questions in this section)

16. Which data types stores variable-length character data? Select two.  
(Choose all correct answers)
CLOB (*)
NCHAR
CHAR
VARCHAR2 (*)

17. Which statement about table and column names is true?

Table and column names can begin with a letter or a number.
Table and column names cannot include special characters.
If any character other than letters or numbers is used in a table or column name, the name must be enclosed in double quotation marks.
Table and column names must begin with a letter. (*)

18. Once they are created, external tables are accessed with normal SQL statements. (True or False?)
True (*)
False

19. DCL, which is the acronym for Data Control Language, allows:
A Database Administrator the ability to grant privileges to users. (*)
The TRUNCATE command to be used.
The CONROL TRANSACTION statement can be used.
The ALTER command to be used.

Section 14
(Answer all questions in this section)

20. Which statement about constraints is true?
PRIMARY KEY constraints can only be specified at the column level.
UNIQUE constraints are identical to PRIMARY KEY constraints.
A single column can have only one constraint applied.
NOT NULL constraints can only be specified at the column level. (*)

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 14
(Answer all questions in this section)

21. Evaluate this CREATE TABLE statement:
CREATE TABLE customers
    (customer_id NUMBER,
     customer_name VARCHAR2(25),
     address VARCHAR2(25),
     city VARCHAR2(25),
     region VARCHAR2(25),
     postal_code VARCHAR2(11),
     CONSTRAINT customer_id_un UNIQUE(customer_id),
     CONSTRAINT customer_name_nn NOT NULL(customer_name));

Why does this statement fail when executed?

NOT NULL constraints CANNOT be defined at the table level. (*)
The CREATE TABLE statement does NOT define a PRIMARY KEY.
The NUMBER data types require precision values.
UNIQUE constraints must be defined at the column level.

22. Which of the following is not a valid Oracle constraint type?
PRIMARY KEY
EXTERNAL KEY (*)
NOT NULL
UNIQUE KEY

23. You can drop a column in a table with a simple ALTER TABLE DROP COLUMN statement, even if the column is referenced in a constraint. True or False?
True
False (*)

24. You want to disable the FOREIGN KEY constraint that is defined in the EMPLOYEES table on the DEPARTMENT_ID column. The constraint is referenced by the name FK_DEPT_ID_01. Which statement should you issue?  
ALTER TABLE employees
DISABLE fk_dept_id_01;

ALTER TABLE employees
DISABLE 'fk_dept_id_01';

ALTER TABLE employees
DISABLE CONSTRAINT 'fk_dept_id_01';

ALTER TABLE employees
DISABLE CONSTRAINT fk_dept_id_01;
(*)

25. Which of the following best describes the function of a CHECK constraint?
A CHECK constraint enforces uniqueness of the values that can be entered in a column or combination of columns.

A CHECK constraint is created automatically when a PRIMARY KEY constraint is created.

A CHECK constraint enforces referential data integrity.

A CHECK constraint defines restrictions on the values that can be entered in a column or combination of columns. (*)

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 14
(Answer all questions in this section)

26. You need to create the PROJECT_HIST table. The table must meet these requirements:
The table must contain the EMPLOYEE_ID and TASKED_HOURS columns for numeric data.
The table must contain the START_DATE and END_DATE column for date values.
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.
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?
None of the four requirements
All four of the requirements (*)
Only three of the requirements
Only two of the requirements

Section 15
(Answer all questions in this section)

27. If a database administrator wants to ensure that changes performed through a view do not violate existing constraints, which clause should he include when creating the view?

WITH CHECK OPTION (*)
FORCE
WITH CONSTRAINT CHECK
WITH READ ONLY

28. For a View created using the WITH CHECK OPTION keywords, which of the following statements are true?
Prohibits DML actions without administrator CHECK approval
Prohibits changing rows not returned by the subquery in the view definition. (*)
The view will allow the user to check it against the data dictionary
Allows for DELETES from other tables, including ones not listed in subquery

29. Given the following view, which operations would be allowed on the emp_dept view?
CREATE OR REPLACE VIEW emp_dept
AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name,
    e.salary,
    e.hire_date,
    d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id >=50;

SELECT, UPDATE of all columns
SELECT, UPDATE of some columns, DELETE (*)
SELECT, DELETE
SELECT, INSERT

30. Which of these Keywords is typically used with a Top-N Analysis?
Number
Rownum (*)
Rowid
Sequence

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 15
(Answer all questions in this section)

31. The CUSTOMER_FINANCE table contains these columns:
CUSTOMER_ID NUMBER(9)
NEW_BALANCE NUMBER(7,2)
PREV_BALANCE NUMBER(7,2)
PAYMENTS NUMBER(7,2)
FINANCE_CHARGE NUMBER(7,2)
CREDIT_LIMIT NUMBER(7)

You execute this statement:

SELECT ROWNUM "Rank", customer_id, new_balance
FROM (SELECT customer_id, new_balance FROM customer_finance)
WHERE ROWNUM <= 25
ORDER BY new_balance DESC;

What statement is true?
The statement will not necessarily return the 25 highest new balance values, as the inline view has no ORDER BY clause. (*)
The statement failed to execute because the ORDER BY clause does NOT use the Top-n column.
The statement failed to execute because an inline view was used.
The 25 greatest new balance values were displayed from the highest to the lowest.

32. Evaluate this view definition:
CREATE OR REPLACE VIEW part_name_v
AS SELECT DISTINCT part_name
FROM parts
WHERE cost >= 45;

Which of the following statements using the PART_NAME_V view will execute successfully?

SELECT *
FROM part_name_v;
(*)

DELETE FROM part_name_v
WHERE part_id = 56897;

UPDATE part_name_v
SET cost = cost * 1.23
WHERE part_id = 56990;

INSERT INTO part_name_v (part_id, part_name, product_id, cost)
VALUES (857986, ムcylinderメ, 8790, 3.45);

33. Given the following CREATE VIEW statement, what data will be returned?
CREATE OR REPLACE VIEW emp_dept
AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name,
    e.salary,
    e.hire_date,
    d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id >=50;

First character from employee first_name concatenated to the last_name, the salary, the hire_date, and department_name of all employees working in department number 50.

First character from employee first_name concatenated to the last_name, the salary, the hire_date, and department_id of all employees working in department number 50 or higher.

First character from employee first_name concatenated to the last_name, the salary, the hire_date, and department_id of all employees working in department number 50.

First character from employee first_name concatenated to the last_name, the salary, the hire_date, and the department_name of all employees working in department number 50 or higher. (*)

34. Which option would you use to modify a view rather than dropping it and recreating it?  

NOFORCE
FORCE
WITH ADMIN OPTION
CREATE OR REPLACE (*)

Section 16
(Answer all questions in this section)

35. Which dictionary view would you query to display the number most recently generated by a sequence?  
USER_OBJECTS
USER_TABLES
USER_CURRVALUES
USER_SEQUENCES (*)

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 16
(Answer all questions in this section)

36. When creating a sequence, which keyword or option specifies the minimum sequence value?
NOMAXVALUE
MAXVALUE
MINVALUE (*)
CYCLE

37. A sequence is a window through which data can be queried or changed. True or False?
True
False (*)

38. For which column would you create an index?  
A column with a large number of null values (*)
A column that is infrequently used as a query search condition
A column that is updated frequently
A column which has only 4 distinct values.

39. Unique indexes are automatically created on columns that have which two types of constraints?
UNIQUE and PRIMARY KEY (*)
PRIMARY KEY and FOREIGN KEY
NOT NULL and UNIQUE
UNIQUE and FOREIGN KEY

40. Indexes can be used to speed up queries. True or False?  
True (*)
False

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 17
(Answer all questions in this section)

41. User BOB's schema contains an EMPLOYEES table. BOB executes the following statement:
GRANT SELECT ON employees TO mary WITH GRANT OPTION;
Which of the following statements can MARY now execute successfully? (Choose two)
(Choose all correct answers)
GRANT SELECT ON bob.employees TO PUBLIC; (*)
REVOKE SELECT ON bob.employees FROM bob;
DROP TABLE bob.employees;
SELECT FROM bob.employees; (*)

42. Granting an object privilege WITH GRANT OPTION allows the recipient to grant all object privileges on the table to other users. True or False?
True
False (*)

43. Which of the following statements is true?  
Database Links are never used in the real world.
Database Links can be created by any user of a database. You do not need any special privileges to create them.
Database Links allow users to work on remote database objects without having to log into the other database. (*)
Database Links are pointers to another schema in the same database.

44. Which of these SQL functions used to manipulate strings is NOT a valid regular expression function ?

REGEXP (*)
REGEXP_LIKE
REGEXP_SUBSTR
REGEXP_REPLACE

45. Parentheses are not used to identify the sub expressions within the expression. True or False?
True
False (*)

Test: Database Programming with SQL Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 17
(Answer all questions in this section)

46. User Kate wants to create indexes on tables in her schema. What privilege must be granted to Kate so that she can do this?
CREATE INDEX
CREATE ANY INDEX
ALTER TABLE
None; users do not need extra privileges to create indexes on tables in their own schema. (*)

47. User CHANG has been granted SELECT, UPDATE, INSERT, and DELETE privileges on the EMPLOYEES table. You now want to prevent Chang from adding or deleting rows from the table, while still allowing him to read and modify existing rows. Which statement should you use to do this?
REVOKE INSERT, DELETE ON employees FROM chang; (*)
REVOKE INSERT AND DELETE ON employees FROM chang;
REVOKE ALL ON employees FROM chang;
REMOVE INSERT, DELETE ON employees FROM chang;

Section 18
(Answer all questions in this section)

48. Table MYTAB contains only one column of datatype CHAR(1). A user executes the following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;

Which rows does the table now contain?
A, B, and C
A and B (*)
C
None of the above

49. User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes:
SELECT COUNT(*) FROM bob.customers; What result will JANE see?

JANE will receive an error message because she is not allowed to query the table while BOB is updating it.
20 (*)
2
22

Section 19
(Answer all questions in this section)

50. A software verification and validation method.
Software engineering
Documentation
Unit testing (*)
Production

SOLOSOLOKU: Design Section 4 Quiz

Database Design - Student - English
Test: Section 4 Quiz
Review your answers, feedback, and question scores below.
An asterisk (*) indicates a correct answer.

Section 4 Quiz
(Answer all questions in this section)
1. A business rule such as "All accounts must be paid in full within 10 days 
of billing" is best enforced by:

Making the relationship between CUSTOMER and PAYMENT fully 
mandatory and 1:1 on both sides.
Creating a message to be printed on every bill that reminds the 
customer to pay within ten days.
Making the payment attribute mandatory.
Creating additional programming code to identify and report accounts past due. (*)
2. A business rule such as "We only ship goods after customers have completely 
paid any outstanding balances on their account" is best enforced by:
Making the payment attribute optional.
Creating additional programming code to verify no goods are 
shipped until the account has been settled in full. (*)
Making the payment attribute null.
We need to trust our customers, and we know they will pay some day.

3. Why is it important to identify and document business rules?
It allows you to create a complete data model and then check it for accuracy. (*)
It allows you to improve the client's business.
It ensures that the data model will automate all manual processes.
None of the above

4. How would you model a business rule that states that on a student's birthday, 
he does not have to attend his classes?
Use a subtype
Make the attribute Birthdate mandatory
Use a supertype
You cannot model this. You need to document it (*)

5. Business rules are important to data modelers because:
A. They capture all of the needs, processes, and required functionality of the business. (*)
B. All Business rules are easily implemented in the ERD diagram.
C. The data modeler must focus on structural rules, because they are easily represented diagrammatically and eliminate other rules that involve extra procedures or programming.
D. Both A and C are true.

Test: Section 4 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz
(Answer all questions in this section)

6. Can all constraints be modeled on an ER diagram?

No, but you just explain them to the users so they can enforce them
No, in which case you should let the database administrator handle them
No, and those that cannot be modeled should be listed on a separate document
to be handled programmatically (*)
Yes, all constraints must be modeled and shown on the ER diagram

7. Why is it important to identify and document structural rules?

Ensures we know what data to store and how that data works together. (*)
Ensures nothing. There are no benefits to be gained from 
documenting your Structural Business Rules. We need to concentrate on the Procedural Business Rules only.
Ensures we know what processes are in place and how to program them.
All of the Above.

8. A supertype can only have two subtypes and no more. True or False?

True
False (*)

Incorrect Incorrect. Refer to Section 4 Lesson 1.


9. All ER diagrams must have one of each of the following: (Choose two)
(Choose all correct answers)
One or more Entities (*)
At least one supertype and subtype
Relationships between entities (*)
Arcs

10. A subtype is drawn on an ERD as an entity inside the "softbox" of the supertype. True or False?
True (*)
False

Test: Section 4 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz
(Answer all questions in this section)

11. A subtype is shown on an ERD as an entity with a one to many relationship to the supertype. True or False?
True
False (*)

Incorrect Incorrect. Refer to Section 4 Lesson 1.


12. Which of the following is true about subtypes?  
Subtypes must be mutually exclusive. (*)
Subtypes must not be mutually exclusive.
Subtypes should not be exhaustive.
One instance of a supertype may belong to two subtypes.

Incorrect Incorrect. Refer to Section 4 Lesson 1.

13. A Supertype can have only one subtype. True or False?  
True
False (*)

Incorrect Incorrect. Refer to Section 4 Lesson 1.

14. A subtype can have a relationship not shared by the supertype. True or False?
True (*)
False

15. All instances of a subtype may be an instance of the supertype but does not have to. True or False?

True
False (*)

Saturday, July 16, 2016

SOLOSOLOKU: Section 18 Quiz



Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 18 Quiz
(Answer all questions in this section)

1. Examine the following statements:
UPDATE employees SET salary = 15000;
SAVEPOINT upd1_done;
UPDATE employees SET salary = 22000;
SAVEPOINT upd2_done;
DELETE FROM employees;

You want to retain all the employees with a salary of 15000; What statement would you execute next?
ROLLBACK;
ROLLBACK TO SAVEPOINT upd1_done; (*)
ROLLBACK TO SAVEPOINT upd2_done;
ROLLBACK TO SAVE upd1_done;
There is nothing you can do; either all changes must be rolled back, or none of them can be rolled back.

2. Which SQL statement is used to remove all the changes made by an uncommitted transaction?
ROLLBACK; (*)
REVOKE;
UNDO;
ROLLBACK TO SAVEPOINT;

3. When you logout of Oracle, your data changes are automatically rolled back. True or False?
True
False (*)

4. If Oracle crashes, your changes are automatically rolled back. True or False?
True (*)
False

5. If UserB has privileges to see the data in a table, as soon as UserA has entered data into that table, UserB can see that data. True or False?
True
False (*)

Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 18 Quiz
(Answer all questions in this section)

6. User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes:
SELECT COUNT(*) FROM bob.customers;
What result will JANE see?
2
JANE will receive an error message because she is not allowed to query the table while BOB is updating it.
20 (*)
22

7. A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this?
A database link
A sequence
An object privilege
A savepoint (*)
An update statement

8. Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
DELETE employees; -- 107 rows deleted
SAVEPOINT Del_Done;
UPDATE emps SET last_name = 'Smith';

How would you undo the last Update only?
There is nothing you can do.
COMMIT Del_Done;
ROLLBACK to SAVEPOINT Del_Done; (*)
ROLLBACK UPDATE;

9. Table MYTAB contains only one column of datatype CHAR(1). A user executes the
following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;

Which rows does the table now contain?
A, B, and C
A and B (*)
C
None of the above

10. You need not worry about controlling your transactions. Oracle does it all for you. True or False?
True
False (*)

Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 18 Quiz
(Answer all questions in this section)

11. Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
CREATE INDEX emp_lname_idx ON employees(last_name);
UPDATE emps SET last_name = 'Smith';

What happens if you issue a Rollback statement?
The update of last_name is undone, but the insert was committed by the CREATE INDEX statement. (*)
Both the UPDATE and the INSERT will be rolled back.
The INSERT is undone but the UPDATE is committed.
Nothing happens.

12. COMMIT saves all outstanding data changes? True or False?
True (*)
False

13. Which of the following best describes the term "read consistency"?
It ensures that all changes to a table are automatically committed
It prevents users from querying tables on which they have not been granted SELECT privilege
It prevents other users from seeing changes to a table until those changes have been committed (*)
It prevents other users from querying a table while updates are being executed on it

14. If a database crashes, all uncommitted changes are automatically rolled back. True or False?
True (*)
False

15. Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown:
UPDATE employees
SET salary = salary * 2
WHERE employee_id = 100;
COMMIT;

UPDATE employees
SET salary = 30000
WHERE employee_id = 100;

The user's database session now ends abnormally. What is now King's salary in the table?
78000
30000
48000 (*)
24000

SOLOSOLOKU: Section 17 Quiz


Test: Section 17 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 17 Quiz
(Answer all questions in this section)

1. Which of the following is NOT a database object?

Table
Sequence
Subquery (*)
View

2. What system privilege must be held in order to login to an Oracle database?

CREATE LOGIN
CREATE SESSION (*)
CREATE LOGON
No special privilege is needed; if your username exists in the database, you can login.

3. You create a view named EMPLOYEES_VIEW on a subset of the EMPLOYEES table. User AUDREY needs to use this view to create reports. Only you and Audrey should have access to this view. Which of the following actions should you perform?

Do nothing. As a database user, Audrey's user account has automatically been granted the SELECT privilege for all database objects.

GRANT SELECT ON employees AND employees_view TO audrey;

GRANT SELECT ON employees_view TO public;

GRANT SELECT ON employees_view TO audrey; (*)

4. Which of these is NOT a System Privilege granted by the DBA?

Create Procedure
Create Sequence
Create Index (*)
Create Session

5. A schema is:

A named group of related privileges given to a user.
Required to gain access to the database.
Required to manipulate the content of objects in the database.
A collection of objects, such as tables, views, and sequences. (*)

Test: Section 17 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 17 Quiz
(Answer all questions in this section)

6. The following table shows some of the output from one of the data dictionary views. Which view is being queried?
USERNAME PRIVILEGE ADMIN_OPTION
USCA_ORACLE_SQL01_S08 CREATE VIEW NO
USCA_ORACLE_SQL01_S08 CREATE TABLE NO
USCA_ORACLE_SQL01_S08 CREATE SYNONYM NO
USCA_ORACLE_SQL01_S08 CREATE TRIGGER NO
USCA_ORACLE_SQL01_S08 CREATE SEQUENCE NO
USCA_ORACLE_SQL01_S08 CREATE DATABASE NO

role_tab_privs (lists table privileges granted to roles)
role_sys_privs (lists system privileges granted to roles)
user_sys_privs (lists system privileges granted to the user) (*)
user_tab_privs_recd (lists object privileges granted to the user)

7. Which of the following best describes the purpose of the REFERENCES object privilege on a table?
It allows the user to create new tables which contain the same data as the referenced table.
It allows a user to refer to the table in a SELECT statement.
It allows a user to create foreign key constraints on the table. (*)
It allows a user's session to read from the table but only so that foreign key constraints can be checked.

8. You need to grant user BOB SELECT privileges on the EMPLOYEES table. You want to allow BOB to grant this privileges to other users. Which statement should you use?  

GRANT SELECT ON employees TO bob WITH ADMIN OPTION;
GRANT SELECT ON employees TO PUBLIC WITH GRANT OPTION;
GRANT SELECT ON employees TO bob;
GRANT SELECT ON employees TO bob WITH GRANT OPTION; (*)

9. When granting an object privilege, which option would you include to allow the grantee to grant the privilege to another user?  
WITH GRANT OPTION (*)
PUBLIC
FORCE
WITH ADMIN OPTION

10. Which statement would you use to grant a role to users?  
ASSIGN
CREATE USER
GRANT (*)
ALTER USER

Test: Section 17 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 17 Quiz
(Answer all questions in this section)

11. Which of the following statements about granting object privileges is false?
An object owner can grant any object privilege on the object to any other user or role of the
database.
To grant privileges on an object, the object must be in your own schema, or you must have been granted the object privileges WITH GRANT OPTION.
Object privileges can only be granted through roles. (*)
The owner of an object automatically acquires all object privileges on that object.

12. User CRAIG creates a view named INVENTORY_V, which is based on the INVENTORY table. CRAIG wants to make this view available for querying to all database users. Which of the following actions should CRAIG perform?

He should assign the SELECT privilege to all database users for INVENTORY_V view. (*)
He is not required to take any action because, by default, all database users can automatically access views.
He should assign the SELECT privilege to all database users for the INVENTORY table.
He must grant each user the SELECT privilege on both the INVENTORY table and INVENTORY_V view.


13. _________________ are special characters that have a special meaning, such as a wildcard character, a repeating character, a non-matching character, or a range of characters. You can use several of these symbols in pattern matching.  

Alphanumeric values
Meta characters (*)
Clip Art
Reference checks

14. REGULAR EXPRESSIONS can be used on CHAR, CLOB, and VARCHAR2 datatypes? (True or False)

True (*)
False

15. Which of these SQL functions used to manipulate strings is NOT a valid regular expression function ?

REGEXP_SUBSTR
REGEXP_REPLACE
REGEXP_LIKE
REGEXP (*)