Section 13
(Answer all questions in this section)
1. Which command would you use to see if your triggers are enabled or disabled? Mark for Review
(1) Points
SELECT trigger_name, trigger_type
FROM USER_TRIGGERS;
DESCRIBE TRIGGER
SELECT object_name, status
FROM USER_OBJECTS
WHERE object_type = 'TRIGGER';
SELECT trigger_name, status
FROM USER_TRIGGERS;
(*)
Correct
2. You need to disable all triggers that are associated with DML statements on the Mark for Review
DEPARTMENTS table. Which of the following commands should you use?
(1) Points
ALTER TABLE departments DROP ALL TRIGGERS;
DISABLE ALL TRIGGERS ON departments;
ALTER TABLE departments DISABLE ALL TRIGGERS; (*)
ALTER TABLE departments DISABLE TRIGGERS;
ALTER TRIGGER DISABLE ALL ON departments;
Correct
3. By default, any user can create a DML trigger on a table in his/her schema. True or Mark for Review
False?
(1) Points
True
False (*)
Correct
4. What is the purpose of using the CALL statement in a trigger? Mark for Review
(1) Points
It allows the trigger body code to be placed in a separate trigger.
It allows both DML events and DDL events to be handled using a single trigger.
It allows an INSTEAD OF trigger to be a statement trigger.
It prevents cascading triggers.
It allows the trigger body code to be placed in a separate procedure. (*)
Correct
5. You have been granted CREATE TRIGGER privilege. You can now create an AFTER Mark for Review
LOGOFF ON SCHEMA trigger. True or False?
(1) Points
True
False (*)
Correct
Section 13
(Answer all questions in this section)
1. Which command would you use to see if your triggers are enabled or disabled? Mark for Review
(1) Points
SELECT trigger_name, trigger_type
FROM USER_TRIGGERS;
DESCRIBE TRIGGER
SELECT object_name, status
FROM USER_OBJECTS
WHERE object_type = 'TRIGGER';
SELECT trigger_name, status
FROM USER_TRIGGERS;
(*)
Correct
2. You need to disable all triggers that are associated with DML statements on the Mark for Review
DEPARTMENTS table. Which of the following commands should you use?
(1) Points
ALTER TABLE departments DROP ALL TRIGGERS;
DISABLE ALL TRIGGERS ON departments;
ALTER TABLE departments DISABLE ALL TRIGGERS; (*)
ALTER TABLE departments DISABLE TRIGGERS;
ALTER TRIGGER DISABLE ALL ON departments;
Correct
3. By default, any user can create a DML trigger on a table in his/her schema. True or Mark for Review
False?
(1) Points
True
False (*)
Correct
4. What is the purpose of using the CALL statement in a trigger? Mark for Review
(1) Points
It allows the trigger body code to be placed in a separate trigger.
It allows both DML events and DDL events to be handled using a single trigger.
It allows an INSTEAD OF trigger to be a statement trigger.
It prevents cascading triggers.
It allows the trigger body code to be placed in a separate procedure. (*)
Correct
5. You have been granted CREATE TRIGGER privilege. You can now create an AFTER Mark for Review
LOGOFF ON SCHEMA trigger. True or False?
(1) Points
True
False (*)
Correct
Section 13
(Answer all questions in this section)
11. Which of the following best describes a database trigger?
Mark for Review
(1) Points
A PL/SQL subprogram that always returns exactly one value
A PL/SQL subprogram that inserts rows into a logging table
A subprogram that is invoked explicitly by the calling application
A PL/SQL subprogram that executes automatically whenever an associated
database event occurs (*)
A subprogram that checks whether a user has typed the correct password to
log on to the database
Correct
12. A trigger can be created in the database or within an application. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
13. The following objects have been created in a user's schema:
- A function FUNC1 Mark for Review
- A package PACK1 which contains a public procedure PACKPROC and a private (1) Points
function PACKFUNC
- A trigger TRIGG1.
The procedure and functions each accept a single IN parameter of type NUMBER,
and the functions return BOOLEANs. Which of the following calls to these objects
(from an anonymous block) are correct? (Choose two.)
(Choose all correct answers)
trigg1;
pack1.packproc(25); (*)
SELECT func1(100) FROM dual;
IF pack1.packfunc(40) THEN ...
IF func1(75) THEN ... (*)
Correct
14. Which of the following could NOT be done by a database trigger?
Mark for Review
(1) Points
Keeping a log of how many rows have been inserted into a table
Recalculating the total salary bill for a department whenever an employee's
salary is changed
Ensuring that a student never arrives late for a class (*)
Enforcing a complex business rule
Enforcing a complex database security check
Correct
15. What are the timing events for a compound trigger?
Mark for Review
(1) Points
Before the triggering statement; After the triggering statement; Instead of the
triggering statement
Before the triggering statement; After the triggering statement; After each
row
Before the triggering statement; Before each row; After each row; After the
triggering statement (*)
Before the triggering statement; Before each row; After the triggering
statement
Correct
Section 13
(Answer all questions in this section)
16. What is wrong with this compound trigger example?
Mark for Review
CREATE OR REPLACE TRIGGER compound_trigger (1) Points
FOR UPDATE OF salary
COMPOUND TRIGGER
threshold CONSTANT SIMPLE_INTEGER := 200;
BEFORE EACH ROW IS
BEGIN
-- some action
END BEFORE EACH ROW;
AFTER EACH ROW IS
BEGIN
-- some action
END AFTER EACH ROW;
AFTER STATEMENT IS
BEGIN
-- some action
END AFTER STATEMENT;
END compound_trigger;
Missing BEFORE timing statement
Missing the BEFORE and INSTEAD OF timing sections
Missing name of table on which the trigger fires (*)
Missing the INSTEAD OF timing section
Missing the EXCEPTION section
Incorrect. Refer to Section 13 Lesson 3.
17. In the following code:
Mark for Review
CREATE TRIGGER mytrigg (1) Points
INSTEAD OF INSERT OR UPDATE ON my_object_name
FOR EACH ROW
BEGIN ...
my_object_name can be the name of a table. True or False?
True
False (*)
Correct
18. Examine the following code. To create a row trigger, what code should be included
at Line A? Mark for Review
(1) Points
CREATE TRIGGER dept_trigg
AFTER UPDATE OR DELETE ON departments
-- Line A
BEGIN ...
FOR EVERY ROW
AFTER EACH ROW
ON EACH ROW
ON EVERY ROW
FOR EACH ROW (*)
Correct
19. What are the components of a compound trigger?
Mark for Review
(1) Points
Declaration section and at least one timing section. (*)
Declaration section and at least two timing sections.
Declaration section and all four timing sections.
Declaration section, referencing section, and timing sections.
Declaration section, timing sections, and exception section.
Correct
20. You decide to create the following trigger:
Mark for Review
CREATE OR REPLACE TRIGGER empl_trigg (1) Points
BEFORE UPDATE ON employees
BEGIN
-- Line A
RAISE_APPLICATION_ERROR('Cannot update salary');
ELSE
INSERT INTO log_table values (USER, SYSDATE);
END IF;
END;
You want the trigger to prevent updates to the SALARY column, but allow updates
to all other columns. What should you code at Line A?
IF UPDATING('SALARY') THEN (*)
IF UPDATING(SALARY) THEN
IF UPDATE(SALARY) THEN
IF UPDATE('SALARY') THEN
IF UPDATING SALARY THEN
Correct
Section 13
(Answer all questions in this section)
21. Examine the following code:
Mark for Review
CREATE TRIGGER emp_trigg (1) Points
-- Line A
BEGIN
INSERT INTO log_table VALUES (USER, SYSDATE);
END;
Which of the following can NOT be coded at Line A?
BEFORE UPDATE ON employees
AFTER INSERT OR DELETE ON employees
BEFORE DELETE ON employees
AFTER UPDATE OF last_name ON employees
AFTER SELECT ON employees (*)
Correct
22. We want to create a log record automatically every time any DML operation is
executed on either or both of the EMPLOYEES and DEPARTMENTS tables. What is Mark for Review
the smallest number of triggers that must be create to do this? (1) Points
One
Two (*)
Three
Six
Eight
Correct
23. A DML statement trigger fires only once for each triggering DML statement, while a
Mark for Review
row trigger fires once for each row processed by the triggering statement. True or
False? (1) Points
True (*)
False
Correct
24. You need to create a trigger that will fire whenever an employee's salary or job_id
is updated, but not when any other column of the EMPLOYEES table is updated. Mark for Review
Which of the following is the correct syntax to do this? (1) Points
CREATE TRIGGER emp_upd_trigg
AFTER UPDATE ON employees (salary, job_id)
BEGIN ...
CREATE TRIGGER emp_upd_trigg
AFTER UPDATE OF salary OR job_id ON employees
BEGIN ...
CREATE TRIGGER emp_upd_trigg
AFTER UPDATE OF salary, job_id ON employees
BEGIN ...
(*)
CREATE TRIGGER emp_upd_trigg
AFTER UPDATE OF (salary, job_id) ON employees
BEGIN ...
Correct
25. Which of the following is the correct syntax for creating a DML trigger associated
Mark for Review
with the EMPLOYEES table? The trigger must fire whenever an employee's JOB_ID
is updated, but not if a different column is updated. (1) Points
CREATE TRIGGER job_upd_trigg
AFTER UPDATE OF job_id ON employees
BEGIN ...
(*)
CREATE TRIGGER job_upd_trigg
WHENEVER UPDATE OF job_id IN employees
BEGIN ...
CREATE TRIGGER job_upd_trigg
AFTER UPDATE ON employees(job_id)
BEGIN ...
CREATE TRIGGER job_upd_trigg
AFTER UPDATE ON employees.job_id
BEGIN ...
Correct
Section 14
(Answer all questions in this section)
26. View dept_view is based on a select from table departments. Procedure
Mark for Review
show_dept contains code which selects from dept_view. Which of the following
statements are true? (Choose three.) (1) Points
(Choose all correct answers)
show_dept is indirectly dependent on departments (*)
dept_view is directly dependent on departments (*)
departments is indirectly dependent on show_dept
emp_view is directly dependent on show_dept
show_dept is directly dependent on dept_view (*)
Correct
27. Which of the following will display only the number of invalid package bodies in
Mark for Review
your schema?
(1) Points
SELECT COUNT(*) FROM user_dependencies
WHERE type = 'PACKAGE BODY'
AND status = 'INVALID';
SELECT COUNT(*) FROM user_packages
WHERE status = 'INVALID';
SELECT COUNT(*) FROM user_objects
WHERE object_type = 'PACKAGE BODY'
AND status = 'INVALID';
(*)
SELECT COUNT(*) FROM user_objects
WHERE object_type LIKE 'PACKAGE%'
AND status = 'INVALID';
Correct
28. Which data dictionary view shows information about references and dependencies?
Mark for Review
(1) Points
USER_LOCAL_DEPENDENCIES
DEPTREE
USER_DEPENDENCIES (*)
USER_REFERENCES
Correct
29. A SELECT from the DEPTREE table displays table LOCATIONS at nested level 0 and
Mark for Review
procedure LOCPROC at nested level 2. This shows that LOCPROC is directly
dependent on LOCATIONS. True or False? (1) Points
True
False (*)
Correct
30. PL/SQL procedure A invokes procedure B, which in turn invokes procedure C,
which references table T. If table T is dropped, which of the following statements Mark for Review
is true? (1) Points
C is invalid but A and B are still valid
A, B and C are all still valid
A, B and C are all invalid (*)
None of these.
B and C are invalid but A is still valid
Correct
Section 14
(Answer all questions in this section)
31. Which of the following is NOT created when the utldtree.sql script is run?
Mark for Review
(1) Points
The USER_DEPENDENCIES view (*)
The DEPTREE_FILL procedure
The DEPTREE_TEMPTAB table
The DEPTREE view
Correct
32. Which of the following statements will show whether procedure myproc is valid or
invalid? Mark for Review
(1) Points
SELECT * FROM deptree;
SELECT status FROM USER_OBJECTS
WHERE object_type = 'PROCEDURE'
AND object_name = 'MYPROC';
(*)
SELECT valid FROM USER_OBJECTS
WHERE object_type = 'PROCEDURE'
AND object_name = 'MYPROC';
SELECT status FROM USER_PROCEDURES
WHERE procedure_name = 'MYPROC';
Correct
33. A procedure show_emps contains the following declaration:
Mark for Review
CURSOR emp_curs IS SELECT last_name, salary FROM employees;
(1) Points
What will happen to the procedure if a new column is added to the employees
table?
The procedure will automatically be dropped and must be recreated.
The procedure will be marked invalid and must be recompiled before it can be
reexecuted. (*)
Users' privileges to execute the procedure will automatically be revoked.
The procedure will still be valid and execute correctly because it does not
reference the added column.
Correct
34. Which is not a mode that can be used to determine the dependency status of
schema objects when dealing with remote dependencies? Mark for Review
(1) Points
Time Mode (*)
Signature Mode
Time Stamp Mode
All of these are valid.
Incorrect. Refer to Section 14 Lesson 2.
35. In Signature Mode, a compiled procedure would be invalidated if its dependent
procedure has a parameter data type change from NUMBER to Mark for Review
_________________. (1) Points
VARCHAR2 (*)
DECIMAL
BINARY_INTEGER
INTEGER
Correct
Section 14
(Answer all questions in this section)
36. In this scenario, the following status is given for each procedure:
Mark for Review
- Procedure A is local and has a time stamp of 10 AM (1) Points
- Procedure B is remote and has a local time stamp of 5 AM and has a remote time
stamp of 4 AM
In Timestamp Mode, Procedure A will execute successfully at 11 AM. True or
False?
True
False (*)
Correct
37. Which Data Dictionary table stores information about a procedure's timestamp?
Mark for Review
(1) Points
USER_PROCEDURES
USER_MODE
USER_OBJECTS (*)
USER_TIMESTAMP
Incorrect. Refer to Section 14 Lesson 2.
38. Which statement for setting a database parameter is the default for remote
Mark for Review
dependency checking?
(1) Points
ALTER SESSION SET REMOTE_DEPENDENCIES_MODE = SIGNATURE
ALTER SESSION SET REMOTE_DEPENDENCIES_MODE = TIMESTAMP (*)
ALTER SESSION REMOTE_DEPENDENCIES_MODE = SIGNATURE
ALTER SESSION REMOTE_DEPENDENCIES_MODE = TIMESTAMP
Correct
Section 15
(Answer all questions in this section)
39. What is the name of the column used to identify the PLSQL_OPTIMIZE_LEVEL in
the data dictionary? Mark for Review
(1) Points
PLSQL_OPTIMIZE_LEVEL (*)
PLSQL_CODE_TYPE
USER_PLSQL_OPTIMIZE
PLSQL_LEVEL
OPTIMIZE_LEVEL
Correct
40. When setting PLSQL_OPTIMIZE_LEVEL = 3, the compiled code will run more
Mark for Review
slowly, but it will work with older versions of the Oracle software. True or False?
(1) Points
True
False (*)
Incorrect. Refer to Section 15 Lesson 1.
Section 15
(Answer all questions in this section)
41. To determine the current setting for PLSQL_OPTIMIZE_LEVEL, query the data
Mark for Review
dictionary view USER_PLSQL_OBJECTS_SETTINGS. True or False?
(1) Points
True (*)
False
Incorrect. Refer to Section 15 Lesson 1.
42. When wrapping subprograms, the entire PL/SQL code must be included as an IN
Mark for Review
argument with data type VARCHAR2 up to 32,767 characters. True or False?
(1) Points
True (*)
False
Incorrect. Refer to Section 15 Lesson 4.
43. You created a package named pkg1. The code is approximately 90,000 characters.
Mark for Review
What is the statement that you use to obfuscate this package in the database?
(1) Points
DBMS_DML.CREATE_WRAPPED (pkg1);
DBMS_DML.CREATE_WRAP (pkg1);
WRAP INAME=pkg1.sql
WRAP pkg1.sql
DBMS_DML.CREATE_WRAPPED ('CREATE OR REPLACE PACKAGE BODY
pkg1...); (*)
Incorrect. Refer to Section 15 Lesson 4.
44. When wrapping subprograms, the entire PL/SQL code must be included as an IN
argument with data type CLOB to allow for any size program. True or False? Mark for Review
(1) Points
True
False (*)
Correct
45. Identify the selection directives used in conditional compilation.
Mark for Review
(1) Points
$IF
$THEN
$ELSE
$END
$CCFLAG
$$IF
$$THEN
$$ELSE
$$END
$$DEBUG
$$IF
$$THEN
$$ELSE
$$ELSIF
$$END
$IF
$THEN
$ELSE $ELSIF
$ENDIF
$IF
$THEN
$ELSE
$ELSIF
$END
(*)
Correct
Section 15
(Answer all questions in this section)
46.In order to use the deterministic functions in Oracle version 11, you can use the
Mark for
following sample code to test for the Oracle version before compiling that section.
True or False? Review
(1) Points
CREATE OR REPLACE FUNCTION myfunc
RETURN NUMBER
$IF DBMS_DB_VERSION.VERSION >= 11 $THEN
DETERMINISTIC
$END
IS BEGIN
-- body of function
END myfunc;
True (*)
False
Correct
47.To include selections of code for compilation based on user-defined values, use the
PLSQL_CCFLAGS parameters. True or False? Mark for
Review
(1) Points
True (*)
False
Correct
48.Which pair of DBMS_WARNING commands would allow you to obtain the current
Mark for
settings and change and restore those settings in a PL/SQL subprogram? (Choose
two) Review
(1) Points
(Choose all correct answers)
DBMS_WARNING.ADD_WARNING_SETTING_CAT
DBMS_WARNING.GET_WARNING_STRING
DBMS_WARNING.GET_WARNING_SETTING_STRING (*)
DBMS_WARNING.SET_WARNING_SETTING_STRING (*)
Correct
49.What does the following statement do?
Mark for
DBMS_WARNING.ADD_WARNING_SETTING_CAT('PERFORMANCE','ENABLE','SESSI Review
ON'); (1) Points
Enables the PERFORMANCE warning category, leaving other category settings
unchanged, for the current session. (*)
Enables the PERFORMANCE warning category, setting other category settings
to disabled.
Disables all warning categories, then enables the PERFORMANCE category.
Add the PERFORMANCE warning category into a PL/SQL variable.
Enables the PERFORMANCE warning category, leaving other category settings
unchanged.
Correct
50.In the USER_ERRORS data dictionary view, if an error is prefixed with "Warning,"
Mark for
the command completes but has a side effect the user needs to know about. For all
other errors, the command terminates abnormally. True or False? Review
(1) Points
True (*)
False
Correct