Oracle PLSQL Section 13-15 Answers
Oracle PLSQL Section 13-15 Answers
Oracle PLSQL Section 13-15 Answers
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 13 Quiz, , , ,
(Answer all questions in this section), , , ,
1. , You can see trigger information in the following Data Dictionary views except:, , Mark for Review
(1) Points
USER_TRIGGERS
USER_ERRORS
USER_SOURCE (*)
You can view trigger information in all of these Data Dictionary views.
USER_OBJECTS
True (*)
False
Correct
3. , Which of the following will remove from the database the trigger in your schema named
EMP_TRIGG?, , Mark for Review
(1) Points
4. , A trigger can be a public subprogram within a PL/SQL package. True or False?, , Mark for Review
(1) Points
True
False (*)
5. , While editing a document in Microsoft Word, you go to the FILE menu and SAVE your work. To do
this, Microsoft Word has executed an application trigger. True or False?, , Mark for Review
(1) Points
True (*)
False
Correct
(1) Points
mypack.packproc;
myproc;
mytrigg; (*)
v_number := myfunc;
7. Examine the following code. To create a row trigger, what code should be included at Line A?
---- Line A
BEGIN ...
(1) Points
BEGIN
DBMS_OUTPUT.PUT_LINE('Sample Message');
END;
Departments 50 and 80 exist but department 81 does not. A user now executes the following statement:
What happens?
(1) Points
None of these.
9. With which kind of trigger can the :OLD and :NEW qualifiers be used? Mark for Review
(1) Points
Statement triggers
AFTER triggers
DDL triggers
Correct Correct
10. We want to prevent employees from being deleted on Sundays. To do this, we create the
following trigger:
BEGIN
RAISE_APPLICATION_ERROR(-20101,'Invalid delete');
END IF;
END;
(1) Points
It should be a BEFORE trigger because if an AFTER trigger were created, the employee would already
have been deleted by the time the trigger checks the date. (*)
It should be an AFTER trigger because the Oracle Server cannot fire the trigger until it knows that the
employee has been deleted.
It should be a BEFORE trigger because you cannot use RAISE_APPLICATION_ERROR with AFTER
triggers.
Correct Correct
BEGIN
...
(1) Points
(*)
-- Line A
BEGIN
END;
(1) Points
BEGIN
CALL drop_proc;
END;
(1) Points
Correct Correct
14. Mutating table errors can be caused by DML triggers, but not by database event triggers. True
or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. User HARJIT wants to prevent any objects which he owns from being dropped. Harjit decides
to execute the following code:
---- Line A
BEGIN
RAISE_APPLICATION_ERROR(-20201,'Attempted drop');
END;
(1) Points
1. What is the event that will cause the trigger on the emp_details view below to fire?
BEGIN
new_depts
END;
(1) Points
2. There are 3 employees in department 90 and 5 employees in department 50. The following
trigger has been created:
BEGIN
...
UPDATE employees
SET department_id = 50
(1) Points
Once
Three times (*)
Four times
Five times
Eight times
3. Which of the following can NOT be coded in the body of a DML trigger? (Choose two.) Mark
for Review
(1) Points
IF INSERTING THEN
IF SELECTING THEN (*)
IF DELETING THEN
4. After the following SQL statement is executed, all the triggers on the DEPARTMENTS table will
no longer fire, but will remain in the database. True or False?
(1) Points
True (*)
False
Correct Correct
5. Which of the following will remove from the database the trigger in your schema named
EMP_TRIGG? Mark for Review
(1) Points
None of these.
6. By default, any user can create a DML trigger on a table in his/her schema. True or False? Mark
for Review
(1) Points
True
False (*)
7. Which of the following could NOT cause a DDL or Database Event trigger to fire? Mark for
Review
(1) Points
A table is dropped.
A user connects to the database.
8. The database administrator wants to write a log record every time any user's session raises an
ORA-00942 exception. The DBA decides to create the following trigger:
BEGIN
-- Line A
END;
(1) Points
IF (SERVERERROR(942)) THEN
IF (IS_SERVERERROR(942)) THEN (*)
IF (IS_SERVERERROR(ORA-00942)) THEN
9. What is the benefit of using the CALL statement in a trigger body? Mark for Review
(1) Points
It allow both DDL events and database events to be handled by a single trigger.
It allows the database administrator to monitor who is currently connected to the database.
(1) Points
Use triggers to override privilege checking and view other users' private tables.
Do not use a trigger to replace or duplicate something which the Oracle Server does automatically. (*)
11. A business rule states that an employee's salary cannot be greater than 99,999.99 or less than 0.
The best way to enforce this rule is by using: Mark for Review
(1) Points
A database trigger
A view
An application trigger
12. Which of the following events could NOT automatically fire a database trigger? Mark for
Review
(1) Points
You click your mouse on a button to choose the correct answer to this question (*)
A DML operation on a view
Correct Correct
13. An AFTER UPDATE trigger can specify more than one column. True or False? Mark for
Review
(1) Points
True (*)
False
Correct Correct
14. What is wrong with the following code?
BEGIN
...
(1) Points
(*)
Correct Correct
15. A DML statement trigger fires only once for each triggering DML statement, while a row
trigger fires once for each row processed by the triggering statement. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
BEGIN
-- Line A
ELSE
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?
Mark for Review
(1) Points
IF UPDATING(SALARY) THEN
IF UPDATE('SALARY') THEN
IF UPDATE(SALARY) THEN
2. Examine the following trigger. It should raise an application error if a user tries to update an
employee's last name. It should allow updates to all other columns of the EMPLOYEES table. What
should be coded at line A?
BEGIN
-- Line A
END IF;
END;
(1) Points
IF UPDATE('LAST_NAME') THEN
IF UPDATING THEN
Correct Correct
3. What is wrong with the following code example for a compound trigger?
COMPOUND TRIGGER
log_emp_tab t_log_emp;
BEGIN
-- some action
AFTER STATEMENT IS
BEGIN
-- some action
END log_emps;
(1) Points
4. A business rule states that an employee's salary must be between 4000 and 30000. We could
enforce this rule using a check constraint, but it is better to use a database trigger. True or False?
Mark for Review
(1) Points
True
False (*)
5. A user's schema contains procedure MYPROC, function MYFUNC, trigger MYTRIGG and package
MYPACK which contains a public procedure PACKPROC. These subprograms have no parameters, and
the function returns a NUMBER. Which of the following calls to these objects (from an anonymous
block) are incorrect? (Choose two) Mark for Review
(1) Points
mytrigg; (*)
mypack.packproc;
myproc;
v_number := myfunc;
6. Which of the following are NOT stored inside the database? Mark for Review
(1) Points
A database trigger
A sequence
An index
7. Which of the following could NOT cause a DDL or Database Event trigger to fire? Mark for
Review
(1) Points
A table is dropped.
A user connects to the database.
Correct Correct
8. The database administrator wants to write a log record every time an Oracle Server error
occurs in any user's session. The DBA creates the following trigger:
-- Line A
BEGIN
END;
(1) Points
BEGIN
CALL del_emp_proc
END;
(1) Points
When using CALL, only one DML statement can be tested, so UPDATE OR DELETE is wrong.
10. Which of the following is the correct syntax for creating a DML trigger associated with the
EMPLOYEES table? The trigger must fire whenever an employee's JOB_ID is updated, but not if a
different column is updated. Mark for Review
(1) Points
BEGIN ...
(*)
BEGIN ...
BEGIN ...
CREATE TRIGGER job_upd_trigg
BEGIN ...
Correct Correct
11. Which of the following are possible keywords for the timing component of a trigger? (Choose
three.) Mark for Review
(1) Points
INSTEAD
WHENEVER
AFTER (*)
BEFORE (*)
INSTEAD OF (*)
Incorrect Incorrect. Refer to Section 13 Lesson 2.
BEGIN
RAISE_APPLICATION_ERROR(-20201,'Invalid delete');
ROLLBACK;
END;
(1) Points
END loc_trigg;
(*)
13. Which dictionary view would you query to see the detailed body code of triggers in your
schema? Mark for Review
(1) Points
USER_OBJECTS
USER_SOURCE
None of these; you cannot view the code of the trigger body after the trigger has been created.
USER_TRIGGERS (*)
USER_TRIGGER
Incorrect Incorrect. Refer to Section 13 Lesson 5.
14. User KULJIT creates two triggers named EMP1_TRIGG and EMP2_TRIGG, which are both DML
triggers referencing her EMPLOYEES table. Kuljit now wants to remove both of these triggers from the
database. What command(s) should Kuljit use to do this? Mark for Review
(1) Points
(*)
(1) Points
True
False (*)
Section 14 Quiz
1. If two related objects are in different databases, the dependency between them is
automatically recorded on the dependent object's data dictionary. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 14 Lesson 2.
2. Which Data Dictionary table stores information about a procedure's timestamp? Mark for
Review
(1) Points
USER_MODE
USER_TIMESTAMP
USER_OBJECTS (*)
USER_PROCEDURES
- 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?
(1) Points
True
False (*)
4. 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
Signature Mode
5. Procedure B has the ZERO_DIVIDE pre-defined exception added to its EXCEPTION section. It is
compiled successfully. In Timestamp Mode, Procedure A, which is dependent on remote Procedure B,
will compile and execute successfully. True or False? Mark for Review
(1) Points
True
False (*)
(1) Points
Using a cursor FOR loop instead of opening and closing the cursor explicitly
7. When a table is dropped, all PL/SQL subprograms that reference the table are automatically
dropped. True or False? Mark for Review
(1) Points
True
False (*)
(1) Points
(*)
Which of the following changes to the LOCATIONS table will allow the procedure to be recompiled
successfully without editing its code? (Choose two.)
(1) Points
(1) Points
(*)
The procedure will be recompiled automatically the next time it is invoked. The recompilation may or
may not be successful.
(*)
The procedure will be recompiled automatically the next time it is invoked. The recompilation will
always be successful.
11. The PL/SQL variable V_LAST_NAME is used to store fetched values of the LAST_NAME column of
the EMPLOYEES table. To minimize dependency failures, the variable should be declared as:
v_last_name VARCHAR2(25);
True or False?
(1) Points
True
False (*)
What will happen to the procedure if a new column is added to the employees table?
(1) Points
The procedure will automatically be dropped and must be recreated.
The procedure will still be valid and execute correctly because it does not reference the added
column.
The procedure will be marked invalid and must be recompiled before it can be reexecuted. (*)
13. Which of the following database objects are created when the utldtree.sql script is run?
(Choose three.) Mark for Review
(1) Points
Which of the following statements about dependencies are true? (Choose two.)
(1) Points
15. Function FETCH_EMP references the EMPLOYEES table. The table is modified by:
(1) Points
1. Procedure B has its local variable emp_number changed to emp_name. The data type of emp_id is
changed from number to integer. It is compiled successfully. In Signature Mode, Procedure A, which is
dependent on remote Procedure B, will compile and execute successfully. True or False? Mark for
Review
(1) Points
True (*)
False
Correct Correct
2. 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
Signature Mode
(1) Points
4. Which Data Dictionary table stores information about a procedure's timestamp? Mark for
Review
(1) Points
USER_PROCEDURES
USER_TIMESTAMP
USER_MODE
USER_OBJECTS (*)
(1) Points
6. User BOB wants to know which objects reference his DEPARTMENTS table. Which of the following
must he execute to populate the DEPTREE_TEMPTAB table? Mark for Review
(1) Points
BEGIN
deptree_fill('TABLE','DEPARTMENTS');
END;
BEGIN
deptree_fill('TABLE','BOB','DEPARTMENTS');
END;
(*)
BEGIN
ideptree('TABLE','BOB','DEPARTMENTS');
END;
BEGIN
utldtree('DEPARTMENTS');
END;
7. Package emp_pack contains two public procedures: get_emps and upd_emps. A separate
procedure emp_proc invokes emp.pack.get_emps. The upd_emps package body code is now altered,
and the package body (but not the package specification) is recreated.
True
False (*)
8. The IDEPTREE view shows dependencies by indenting the lines of output instead of by using a
NESTED_LEVEL column. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
9. A single PL/SQL subprogram such as a procedure can be both a referenced object and a
dependent object. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
RETURN NUMBER IS
v_count NUMBER(6);
BEGIN
RETURN v_count;
END;
Which of the following will display the dependency between DEPTFUNC and DEPARTMENTS?
(1) Points
SELECT name, type
FROM user_dependencies
FROM user_dependencies
FROM user_objects
FROM user_dependencies
(*)
Which of the following statements about dependencies are true? (Choose two.)
(1) Points
12. Which of the following will NOT help to minimize dependency failures? (Choose two.) Mark
for Review
(1) Points
Declaring scalar variables with NOT NULL if the corresponding table column has a NOT NULL
constraint (*)
(1) Points
14. Which data dictionary view shows information about references and dependencies? Mark
for Review
(1) Points
USER_LOCAL_DEPENDENCIES
USER_DEPENDENCIES (*)
DEPTREE
USER_REFERENCES
15. View dept_view is based on a select from table departments. Procedure show_dept contains
code which selects from dept_view. Which of the following statements are true? (Choose three.)
Mark for Review
(1) Points
1. Which of the following techniques will make it more likely that an invalidated PL/SQL subprogram
will recompile successfully? (Choose two.) Mark for Review
(1) Points
Using a cursor FOR loop instead of opening and closing the cursor explicitly
SELECTing a list of column-names instead of using SELECT *
2. Which of the following is NOT created when the utldtree.sql script is run? Mark for Review
(1) Points
Correct Correct
3. A procedure includes the following code:
Which of the following changes to the employees table will allow the procedure to be recompiled
successfully ? (Choose two.)
(1) Points
The table is dropped but a public table exists with the same name and structure. (*)
4. Function FETCH_EMP references the EMPLOYEES table. The table is modified by:
(1) Points
5. A single procedure can be both a referenced object and a dependent object. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
What will happen to the procedure if a new column is added to the employees table?
(1) Points
The procedure will still be valid and execute correctly because it does not reference the added
column.
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.
Which of the following changes to the LOCATIONS table will allow the procedure to be recompiled
successfully without editing its code? (Choose two.)
(1) Points
Which of the following statements about dependencies are true? (Choose two.)
(1) Points
9. Which of the following will NOT help to minimize dependency failures? (Choose two.) Mark
for Review
(1) Points
Declaring scalar variables with NOT NULL if the corresponding table column has a NOT NULL
constraint (*)
10. Which of the following will display only the number of invalid package bodies in your schema?
Mark for Review
(1) Points
(*)
SELECT COUNT(*) FROM user_objects
11. A remote dependency is when a dependent object resides ________________. Mark for Review
(1) Points
In a local database
12. 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 Stamp Mode
Signature Mode
13. Which Data Dictionary table stores information about a procedure's timestamp? Mark for
Review
(1) Points
USER_MODE
USER_TIMESTAMP
USER_OBJECTS (*)
USER_PROCEDURES
14. If two related objects are in different databases, the dependency between them is
automatically recorded on the dependent object's data dictionary. True or False? Mark for Review
(1) Points
True
False (*)
(1) Points
Correct Correct
Section 15 Quiz
1. Which pair of DBMS_WARNING commands would allow you to obtain the current settings and
change and restore those settings in a PL/SQL subprogram? (Choose two) Mark for Review
(1) Points
DBMS_WARNING.ADD_WARNING_SETTING_CAT
DBMS_WARNING.GET_WARNING_STRING
DBMS_WARNING.SET_WARNING_SETTING_STRING (*)
DBMS_WARNING.GET_WARNING_SETTING_STRING (*)
2. In the USER_ERRORS data dictionary view, if an error is prefixed with "Warning," 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? Mark for Review
(1) Points
True (*)
False
Correct Correct
DBMS_WARNING.ADD_WARNING_SETTING_CAT
('INFORMATIONAL','ENABLE','SESSION');
and
ALTER SESSION
(1) Points
True (*)
False
Correct Correct
DBMS_WARNING.ADD_WARNING_SETTING_CAT('PERFORMANCE','ENABLE','SESSION');
(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.
Enables the PERFORMANCE warning category, leaving other category settings unchanged.
Correct Correct
5. When wrapping subprograms, the entire PL/SQL code must be included as an IN argument with
data type VARCHAR2 up to 32,767 characters. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
6. Obfuscation does not allow anyone to see the source code, including the owner. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
7. Below are the steps to obfuscate a PL/SQL subprogram using the wrapper utility. What is the
missing step?
2. Execute WRAP to create a second text file containing the wrapped code.
3. Connect to the database and execute the wrapped text file as a script to compile the wrapped code
into the Data Dictionary.
(1) Points
8. The value of DBMS_DB_VERSION.VER_LE_11 is TRUE when the version of the Oracle database
is version 11 or greater. True or False? Mark for Review
(1) Points
True
False (*)
...
-- Line A
...
END testproc;
(1) Points
$$END;
$ELSIF
$ENDIF
$END;
$END (*)
10. Identify the selection directives used in conditional compilation. Mark for Review
(1) Points
$IF
$THEN
$ELSE $ELSIF
$ENDIF
$IF
$THEN
$ELSE
$END
$CCFLAG
$$IF
$$THEN
$$ELSE
$$END
$$DEBUG
$$IF
$$THEN
$$ELSE
$$ELSIF
$$END
$IF
$THEN
$ELSE
$ELSIF
$END
(*)
11. 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 Correct
12. When setting PLSQL_OPTIMIZE_LEVEL = 2, the compiled code will remove code and
exceptions that can never be executed. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. When setting PLSQL_OPTIMIZE_LEVEL = 3, the compiled code will run more slowly, but it will
work with older versions of the Oracle software. True or False? Mark for Review
(1) Points
True
False (*)
14. To determine the current setting for PLSQL_OPTIMIZE_LEVEL, query the data dictionary view
USER_PLSQL_OBJECTS_SETTINGS. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. To set the PLSQL_CODE_TYPE to its fastest execution speed, which command do you use?
Mark for Review
(1) Points
1. PLSQL_CODE_TYPE determines the type of code for both PL/SQL code and for SQL statements,
which is what speeds up the execution speed. True or False? Mark for Review
(1) Points
True
False (*)
(1) Points
Separating compiled code so that separate units may be repeated as needed (*)
3. What is the name of the column used to identify the PLSQL_OPTIMIZE_LEVEL in the data
dictionary? Mark for Review
(1) Points
OPTIMIZE_LEVEL
PLSQL_OPTIMIZE_LEVEL (*)
PLSQL_CODE_TYPE
USER_PLSQL_OPTIMIZE
PLSQL_LEVEL
4. To set the PLSQL_CODE_TYPE to its fastest execution speed, which command do you use?
Mark for Review
(1) Points
5. Below are the steps to obfuscate a PL/SQL subprogram using the wrapper utility. What is the
missing step?
2. Execute WRAP to create a second text file containing the wrapped code.
3. Connect to the database and execute the wrapped text file as a script to compile the wrapped code
into the Data Dictionary.
(1) Points
(1) Points
7. Obfuscation does not allow anyone to see the source code, including the owner. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
8. Which pair of DBMS_WARNING commands would allow you to obtain the current settings and
change and restore those settings in a PL/SQL subprogram? (Choose two) Mark for Review
(1) Points
DBMS_WARNING.GET_WARNING_SETTING_STRING (*)
DBMS_WARNING.ADD_WARNING_SETTING_CAT
DBMS_WARNING.SET_WARNING_SETTING_STRING (*)
DBMS_WARNING.SET_WARNING_SETTING_STRING
('ENABLE:SEVERE','SESSION');
and
ALTER SESSION
(1) Points
True
False (*)
10. Select the three categories of PL/SQL compiler warning levels. Mark for Review
(1) Points
SEVERE (*)
INFORMATIONAL (*)
PERFORMANCE (*)
DISABLE
ENABLE
Incorrect Incorrect. Refer to Section 15 Lesson 2.
11. A warning in PL/SQL is the same as an error in PL/SQL, but can only be viewed through the
USER_ERRORS data dictionary view. True or False? Mark for Review
(1) Points
True
False (*)
12. Conditional compilation allows you to include extra code to help with debugging, which can
be removed once errors are resolved. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. Conditional Compilation allows you to include some source code in your PL/SQL program that
may be compiled or may be ignored depending on: Mark for Review
(1) Points
14. 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 Correct
...
-- Line A
...
END testproc;
(1) Points
$END (*)
$ELSIF
$ENDIF
$$END;
$END;
Correct Correct
1. Select the three categories of PL/SQL compiler warning levels. Mark for Review
(1) Points
DISABLE
SEVERE (*)
ENABLE
PERFORMANCE (*)
INFORMATIONAL (*)
2. A warning in PL/SQL is the same as an error in PL/SQL, but can only be viewed through the
USER_ERRORS data dictionary view. True or False? Mark for Review
(1) Points
True
False (*)
3. The informational warning level of the PL/SQL compiler identifies _____________. Mark for
Review
(1) Points
Code that can never be executed and other poor coding practices. (*)
All of these.
DBMS_WARNING.ADD_WARNING_SETTING_CAT
('INFORMATIONAL','ENABLE','SESSION');
and
ALTER SESSION
(1) Points
True (*)
False
Correct Correct
5. One benefit of obfuscation is to protect intellectual property written in PL/SQL. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
(1) Points
BEGIN
-- Line A
IS BEGIN
END mycleverproc;');
END;
(1) Points
DBMS_DML.CREATE_WRAP
DBMS_DDL.WRAP_CODE
DBMS_DDL.WRAPPED
DBMS_DDL.CREATE_WRAP
DBMS_DDL.CREATE_WRAPPED (*)
8. What is the name of the column used to identify the PLSQL_OPTIMIZE_LEVEL in the data
dictionary? Mark for Review
(1) Points
PLSQL_LEVEL
PLSQL_OPTIMIZE_LEVEL (*)
PLSQL_CODE_TYPE
OPTIMIZE_LEVEL
USER_PLSQL_OPTIMIZE
9. When setting PLSQL_OPTIMIZE_LEVEL = 2, the compiled code will remove code and exceptions
that can never be executed. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. To determine the current setting for PLSQL_OPTIMIZE_LEVEL, query the data dictionary view
USER_PLSQL_OBJECTS_SETTINGS. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
11. To set the PLSQL_CODE_TYPE to its fastest execution speed, which command do you use? Mark
for Review
(1) Points
Correct Correct
12. Identify some benefits of using conditional compilation. (Choose two) Mark for Review
(1) Points
Use new features with the latest database release and disable them with older database versions (*)
...
-- Line A
...
END testproc;
(1) Points
$ELSIF
$$END;
$END (*)
$ENDIF
$END;
14. If the version and release of the Oracle database in use is 10.2, what statement will allow
syntax available in version 10.2 or later? Mark for Review
(1) Points
-- some messaage
$ELSE
-- some action
$END
-- some messaage
$ELSE
-- some action
$END
(*)
$ELSE
-- some action
$END
-- some messaage
$ELSE
-- some action
$END
15. Identify the selection directives used in conditional compilation. Mark for Review
(1) Points
$IF
$THEN
$ELSE
$ELSIF
$END
(*)
$IF
$THEN
$ELSE $ELSIF
$ENDIF
$$IF
$$THEN
$$ELSE
$$END
$$DEBUG
$IF
$THEN
$ELSE
$END
$CCFLAG
$$IF
$$THEN
$$ELSE
$$ELSIF
$$END
Correct Correct
1. What is the name of the column used to identify the PLSQL_OPTIMIZE_LEVEL in the data
dictionary? Mark for Review
(1) Points
PLSQL_LEVEL
PLSQL_OPTIMIZE_LEVEL (*)
PLSQL_CODE_TYPE
OPTIMIZE_LEVEL
USER_PLSQL_OPTIMIZE
2. To determine the current setting for PLSQL_OPTIMIZE_LEVEL, query the data dictionary view
USER_PLSQL_OBJECTS_SETTINGS. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
3. What are the valid values for PLSQL_OPTIMIZE_LEVEL in the data dictionary? Mark for
Review
(1) Points
0,1,2,3,4
1,2,3
0,1,2,3 (*)
1,2,3,4
(1) Points
Separating compiled code so that separate units may be repeated as needed (*)
(1) Points
True (*)
False
Correct Correct
A PL/SQL program compiles successfully, but contains some code that causes performance to be less
than optimal.
(1) Points
Warning (*)
Error
Correct Correct
7. The informational warning level for PL/SQL compiled code identifies the code that may cause
execution speed to be slow. True or False? Mark for Review
(1) Points
True
False (*)
DBMS_WARNING.SET_WARNING_SETTING_STRING
('ENABLE:SEVERE','SESSION');
and
ALTER SESSION
(1) Points
True
False (*)
9. For PL/SQL code larger than 32,767 characters, you must use the wrap utility. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
10. You created a package named pkg1. The code is approximately 90,000 characters. What is the
statement that you use to obfuscate this package in the database? Mark for Review
(1) Points
DBMS_DDL.CREATE_WRAPPED ('CREATE OR REPLACE PACKAGE BODY pkg1...);
DBMS_DDL.CREATE_WRAP (pkg1);
WRAP pkg1.sql
DBMS_DDL.CREATE_WRAPPED (pkg1);
11. One benefit of obfuscation is to protect intellectual property written in PL/SQL. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
12. If the version and release of the Oracle database in use is 10.2, what statement will allow
syntax available in version 10.2 or later? Mark for Review
(1) Points
-- some messaage
$ELSE
-- some action
$END
-- some messaage
$ELSE
-- some action
$END
-- some messaage
$ELSE
-- some action
$END
$IF DBMS_DB_VERSION.VER_LE_10_1 $THEN
-- some messaage
$ELSE
-- some action
$END
(*)
...
-- Line A
...
END testproc;
(1) Points
$ENDIF
$END;
$$END;
$ELSIF
$END (*)
14. Identify some benefits of using conditional compilation. (Choose two) Mark for Review
(1) Points
Use new features with the latest database release and disable them with older database versions (*)
Determine initialization values during start up of a database session
15. The value of DBMS_DB_VERSION.VER_LE_11 is TRUE when the version of the Oracle database
is version 11 or greater. True or False? Mark for Review
(1) Points
True
False (*)
Section 14 Quiz
(1) Points
None of these.
2. Function FETCH_EMP references the EMPLOYEES table. The table is modified by:
(1) Points
RETURN NUMBER IS
v_count NUMBER(6);
BEGIN
RETURN v_count;
END;
Which of the following will display the dependency between DEPTFUNC and DEPARTMENTS?
(1) Points
FROM user_objects
FROM user_dependencies
FROM user_dependencies
(*)
FROM user_dependencies
4. User ALICE owns a procedure show_emps which references table employees. Which of the
following will generate information that shows this dependency? Mark for Review
(1) Points
BEGIN deptree_fill('ALICE','PROCEDURE','SHOW_EMPS');
END;
BEGIN deptree_fill('PROCEDURE','ALICE','SHOW_EMPS');
END;
BEGIN deptree_fill('TABLE','ALICE','EMPLOYEES');
END;
(*)
BEGIN deptree_fill('ALICE','TABLE','EMPLOYEES');
END;
BEGIN deptree_fill('TABLE','EMPLOYEES');
END;
What will happen to the procedure if a new column is added to the employees table?
(1) Points
The procedure will still be valid and execute correctly because it does not reference the added
column.
The procedure will be marked invalid and must be recompiled before it can be reexecuted. (*)
6. The PL/SQL variable V_LAST_NAME is used to store fetched values of the LAST_NAME column of
the EMPLOYEES table. To minimize dependency failures, the variable should be declared as:
v_last_name VARCHAR2(25);
True or False?
(1) Points
True
False (*)
7. View dept_view is based on a select from table departments. Procedure show_dept contains
code which selects from dept_view. Which of the following statements are true? (Choose three.)
Mark for Review
(1) Points
8. User BOB wants to know which objects reference his DEPARTMENTS table. Which of the
following must he execute to populate the DEPTREE_TEMPTAB table? Mark for Review
(1) Points
BEGIN
deptree_fill('TABLE','DEPARTMENTS');
END;
BEGIN
deptree_fill('TABLE','BOB','DEPARTMENTS');
END;
(*)
BEGIN
utldtree('DEPARTMENTS');
END;
BEGIN
ideptree('TABLE','BOB','DEPARTMENTS');
END;
9. The IDEPTREE view shows dependencies by indenting the lines of output instead of by using a
NESTED_LEVEL column. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
(1) Points
Incorrect Incorrect. Refer to Section 14 Lesson 1. 11. A remote dependency is when a dependent
object resides ________________. Mark for Review
(1) Points
In a local database
Correct Correct
12. Which statement for setting a database parameter is the default for remote dependency
checking? Mark for Review
(1) Points
ALTER SESSION REMOTE_DEPENDENCIES_MODE = SIGNATURE
13. If two related objects are in different databases, the dependency between them is
automatically recorded on the dependent object's data dictionary. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 14 Lesson 2.
14. Procedure B has a new IN OUT parameter added to it. It compiles successfully. Procedure A is
dependent on Procedure B. In Signature mode,what will happen? Mark for Review
(1) Points
15. Procedure B has the ZERO_DIVIDE pre-defined exception added to its EXCEPTION section. It is
compiled successfully. In Timestamp Mode, Procedure A, which is dependent on remote Procedure B,
will compile and execute successfully. True or False? Mark for Review
(1) Points
True
False (*)
RETURN NUMBER IS
v_count NUMBER(6);
BEGIN
RETURN v_count;
END;
Which of the following will display the dependency between DEPTFUNC and DEPARTMENTS?
(1) Points
FROM user_objects
FROM user_dependencies
(*)
FROM user_dependencies
FROM user_dependencies
2. When a table is dropped, all PL/SQL subprograms that reference the table are automatically
dropped. True or False? Mark for Review
(1) Points
True
False (*)
Which of the following changes to the LOCATIONS table will allow the procedure to be recompiled
successfully without editing its code? (Choose two.)
(1) Points
4. User BOB wants to know which objects reference his DEPARTMENTS table. Which of the
following must he execute to populate the DEPTREE_TEMPTAB table? Mark for Review
(1) Points
BEGIN
deptree_fill('TABLE','DEPARTMENTS');
END;
BEGIN
ideptree('TABLE','BOB','DEPARTMENTS');
END;
BEGIN
utldtree('DEPARTMENTS');
END;
BEGIN
deptree_fill('TABLE','BOB','DEPARTMENTS');
END;
(*)
5. Which of the following database objects are created when the utldtree.sql script is run?
(Choose three.) Mark for Review
(1) Points
(1) Points
7. The PL/SQL variable V_LAST_NAME is used to store fetched values of the LAST_NAME column
of the EMPLOYEES table. To minimize dependency failures, the variable should be declared as:
v_last_name VARCHAR2(25);
True or False?
(1) Points
True
False (*)
(1) Points
Nothing is invalidated because the PL/SQL code does not reference the GENDER column.
The specification and body of EMPPACK are invalidated, but CALL_EMP remains valid.
The body of EMPPACK is invalidated, but the specification remains valid. (*)
Which of the following statements about dependencies are true? (Choose two.)
(1) Points
10. A SELECT from the DEPTREE table displays table LOCATIONS at nested level 0 and procedure
LOCPROC at nested level 2. This shows that LOCPROC is directly dependent on LOCATIONS. True or
False? Mark for Review
(1) Points
True
False (*)
1. With remote dependencies, which of the following is True? Mark for Review
(1) Points
There are two separate data dictionaries on two different servers. (*)
There is one master data dictionary that resides on one server which identifies the status of all
schema objects.
Incorrect Incorrect. Refer to Section 14 Lesson 2.
12. 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
Signature Mode
13. In this scenario, the following status is given for each procedure:
- 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?
(1) Points
True
False (*)
14. Procedure B has its local variable emp_number changed to emp_name. The data type of
emp_id is changed from number to integer. It is compiled successfully. In Signature Mode, Procedure A,
which is dependent on remote Procedure B, will compile and execute successfully. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
15. If two related objects are in different databases, the dependency between them is
automatically recorded on the dependent object's data dictionary. True or False? Mark for Review
(1) Points
True
False (*)
Section 13 Quiz
1. You have created several DML triggers which reference your DEPARTMENTS table. Now you
want to disable all of them using a single SQL statement. Which command should you use? Mark for
Review
(1) Points
2. Which dictionary view would you query to see the detailed body code of triggers in your
schema? Mark for Review
(1) Points
USER_SOURCE
USER_OBJECTS
USER_TRIGGERS (*)
USER_TRIGGER
None of these; you cannot view the code of the trigger body after the trigger has been created.
3. User KULJIT creates two triggers named EMP1_TRIGG and EMP2_TRIGG, which are both DML
triggers referencing her EMPLOYEES table. Kuljit now wants to remove both of these triggers from the
database. What command(s) should Kuljit use to do this? Mark for Review
(1) Points
(*)
Incorrect Incorrect. Refer to Section 13 Lesson 5.
4. 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 the smallest number of triggers
that must be create to do this? Mark for Review
(1) Points
One
Two (*)
Three
Six
Eight
5. We want to prevent employees from being deleted on Sundays. To do this, we create the
following trigger:
CREATE OR REPLACE TRIGGER stop_del_emps
BEGIN
RAISE_APPLICATION_ERROR(-20101,'Invalid delete');
END IF;
END;
(1) Points
It should be an AFTER trigger because the Oracle Server cannot fire the trigger until it knows that the
employee has been deleted.
It should be a BEFORE trigger because if an AFTER trigger were created, the employee would already
have been deleted by the time the trigger checks the date. (*)
It should be a BEFORE trigger because you cannot use RAISE_APPLICATION_ERROR with AFTER
triggers.
Incorrect Incorrect. Refer to Section 13 Lesson 2.
BEGIN
...
(1) Points
(*)
COMPOUND TRIGGER
BEGIN
-- some action
BEGIN
-- some action
AFTER STATEMENT IS
BEGIN
-- some action
END compound_trigger;
(1) Points
8. There are 3 employees in department 90 and 5 employees in department 50. The following
trigger has been created:
BEGIN
...
UPDATE employees
SET department_id = 50
(1) Points
Once
Four times
Five times
Eight times
9. A row trigger has been created which is fired by UPDATE ON employees. A user now executes a
single SQL statement which updates four rows of the EMPLOYEES table. How many times will the row
trigger fire? Mark for Review
(1) Points
One time
Two times
Five times
Eight times
BEGIN
CALL del_emp_proc
END;
When using CALL, only one DML statement can be tested, so UPDATE OR DELETE is wrong.
When CALL is used, the BEGIN and END; statements should be omitted. (*)
11. Which of the following could NOT cause a DDL or Database Event trigger to fire? Mark for
Review
(1) Points
A table is dropped.
A specific exception is raised in a user's session.
12. A trigger automatically inserts a row into a logging table every time a user's session receives
this error message:
(1) Points
A row trigger
An AFTER trigger
A DDL trigger
13. You can use a trigger to prevent rows from being deleted from the EMPLOYEES table on
Mondays. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
14. You can code COMMIT and ROLLBACK statements in a trigger body. True or False? Mark for
Review
(1) Points
True
False (*)
15. Which of the following could NOT be done by a database trigger? Mark for Review
(1) Points
Recalculating the total salary bill for a department whenever an employee's salary is changed
Keeping a log of how many rows have been inserted into a table
1. Which of the following are good guidelines to follow when creating a database trigger? (Choose
two.) Mark for Review
(1) Points
Do not use a trigger to replace or duplicate something which the Oracle Server does automatically. (*)
Use triggers to override privilege checking and view other users' private tables.
2. Which of the following best describes a database trigger? Mark for Review
(1) Points
A subprogram that checks whether a user has typed the correct password to log on to the database
A PL/SQL subprogram that executes automatically whenever an associated database event occurs (*)
3. You can use a database trigger to prevent invalid transactions from being committed. True or
False? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. 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 the smallest number of triggers
that must be create to do this? Mark for Review
(1) Points
One
Two (*)
Three
Six
Eight
Incorrect Incorrect. Refer to Section 13 Lesson 2.
5. 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. Which of the following is the
correct syntax to do this? Mark for Review
(1) Points
BEGIN ...
BEGIN ...
(*)
BEGIN ...
6. There are five employees in department 50. A statement trigger is created by:
BEGIN ...
(1) Points
Six times, once after each row and once at the end of the statement
BEGIN ...
(1) Points
True
False (*)
---- Line A
BEGIN ...
(1) Points
COMPOUND TRIGGER
INDEX BY BINARY_INTEGER;
log_emp_tab t_log_emp;
BEGIN
-- some action
AFTER STATEMENT IS
BEGIN
-- some action
END log_emps;
(1) Points
10. You have created several DML triggers which reference your DEPARTMENTS table. Now you
want to disable all of them using a single SQL statement. Which command should you use? Mark for
Review
(1) Points
BEGIN ....
(1) Points
None of these.
An error message is displayed because you cannot drop a table that is associated with a trigger.
12. You can see trigger information in the following Data Dictionary views except: Mark for
Review
(1) Points
USER_ERRORS
USER_OBJECTS
USER_SOURCE (*)
You can view trigger information in all of these Data Dictionary views.
USER_TRIGGERS
13. What is the purpose of using the CALL statement in a trigger? Mark for Review
(1) Points
It allows both DML events and DDL events to be handled using a single trigger.
BEGIN ...
(1) Points
TABLE
DATABASE (*)
SCHEMA (*)
USER
TABLE employees
15. Which kinds of trigger can cause a mutating table problem? (Choose two.) Mark for Review
(1) Points
DDL triggers