0% found this document useful (0 votes)
253 views42 pages

Quiz PL SQL 10 - 15

This document contains a quiz on package concepts in Oracle PL/SQL. It includes 8 multiple choice questions testing knowledge of package specifications, bodies, public and private components, initialization blocks, and invoking package subprograms. An asterisk indicates the correct answer for each question. The questions cover topics such as what can be included in a package, reasons for using packages, the difference between specifications and bodies, and how to reference package variables and call procedures from outside the package.

Uploaded by

Angeeeldust
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views42 pages

Quiz PL SQL 10 - 15

This document contains a quiz on package concepts in Oracle PL/SQL. It includes 8 multiple choice questions testing knowledge of package specifications, bodies, public and private components, initialization blocks, and invoking package subprograms. An asterisk indicates the correct answer for each question. The questions cover topics such as what can be included in a package, reasons for using packages, the difference between specifications and bodies, and how to reference package variables and call procedures from outside the package.

Uploaded by

Angeeeldust
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 42

Test: Creating Packages: Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which of the following can be included in a package
!ark for
Review
(") #oints
procedures
variables
#$%&'$ types
()ceptions
All of the above (*)
*orrect
2. Which of the following are good reasons to group a set of procedures and functions
into a package !ark for
Review
(") #oints
Application developers do not need to know the details of the package body
code.
Related subprogra+s and variables can be grouped together for easier
+anage+ent and +aintenance.
,f the detailed code is changed, applications which invoke the package do not
need to be reco+piled.
All of the above. (*)
*orrect
3. ,n which co+ponent of a package is the full definition of a public procedure written
!ark for
Review
(") #oints
-ody (*)
&pecification
-oth the body and the specification
.either the body nor the specification
*orrect
4. /he two parts of a package are stored as separate ob0ects in the database. /rue or
1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
5. /o be able to invoke a package subprogra+ fro+ outside the package, it +ust be
declared in the package2 !ark for
Review
(") #oints
-ody
&pecification
-ody and the specification (*)
.one of the above
*orrect
6. A nu+ber variable declared in a package is initiali3ed to 4 unless assigned another
value. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
7. #ackage &pecification 5(#/6#A*7 was created by the following code2
*R(A/( 8R R(#$A*( #A*7A9( dept6pack ,&
#R8*(5:R( ins6dept(p6deptno ,. .:!-(R);
1:.*/,8. get6dept(p6deptno ,. .:!-(R) R(/:R. <AR*=AR>;
(.5 dept6pack;
Which of the following are correct synta) for invoking the package subprogra+s
(*hoose two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
-(9,.
dept6pack.ins6dept(>4);
(.5;
(*)
-(9,.
dept6pack.get6dept(>4);
(.5;
5(*$AR(
v6deptna+e <AR*=AR>(>4);
-(9,.
v6deptna+e 2? get6dept(@4);
(.5;
*R(A/( #R8*(5:R( dept6proc ,&
v6deptna+e <AR*=AR>(>4);
-(9,.
v6deptna+e 2? dept6pack.get6dept(A4);
(.5;
(*)
-(9,.
dept6pack(B4);
(.5;
*orrect
8. #ackage (!#6#A*7 contains two procedures, 5($6(!# and &=8W6(!#. Cou
want to write an anony+ous block which invokes these procedures but you have
forgotten which para+eters they use. Which of the following will give you this
infor+ation
!ark for
Review
(") #oints
5(&*R,-( del6e+p
5(&*R,-( show6e+p
5(&*R,-( e+p6pack(del6e+p, show6e+p)
5(&*R,-( e+p6pack
(*)
5(&*R,-( e+p6pack.del6e+p
5(&*R,-( e+p6pack.show6e+p
.one of the above
*orrect
Test: Managing Package Concepts: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. A public co+ponent declared in the package specification can be referenced by a
private co+ponent defined in the package body. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. A local variable declared within a procedure in a package can be referenced by any
other co+ponent of that package. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. ()a+ine the following package specification2
*R(A/( 8R R(#$A*( #A*7A9( +ypack ,&
percent6ta) .:!-(R 2? >4;
#R8*(5:R( proc";
(.5 +ypack;
/he package body of +ypack also includes a function called func". Which of the
following state+ents are true (*hoose three.)
!ark for
Review
(") #oints
(*hoose all correct answers)
proc" is a public procedure and func" is a private function.
(*)
/he package will not co+pile because you cannot declare variables in the
specification, only procedures and functions. .
/he variable can be +odified by2
-(9,.
+ypack.percent6ta) 2? "4;
(.5;
(*)
/he function can be invoked fro+ outside the package.
/he procedure can be invoked by2
-(9,.
+ypack.proc";
(.5;
(*)
*orrect
4. We want to re+ove both the specification and the body of package *86#A*7 fro+
the database. Which of the following co++ands will do this !ark for
Review
(") #oints
5R8# -8/= co6pack;
5R8# #A*7A9( -85C co6pack;
5R8# #A*7A9( co6pack; (*)
5R8# #A*7A9( &#(*,1,*A/,8. co6pack;
.one of the above
*orrect
5. Which one of the following queries would you use to see the detailed code of a
package called (!#6#79 !ark for
Review
(") #oints
&($(*/ te)t 1R8! user6source W=(R( na+e ? D(!#6#79D A.5 type ?
D#A*7A9(D 8R5(R -C line;
&($(*/ source 1R8! user6packages W=(R( na+e ? D(!#6#79D A.5
type ? D#A*7A9( -85CD 8R5(R -C line;
&($(*/ te)t 1R8! all6source W=(R( na+e ? D(!#6#79D A.5 type ?
D#A*7A9(D 8R5(R -C line;
&($(*/ te)t 1R8! user6source W=(R( na+e ? D(!#6#79D A.5 type ?
D#A*7A9( -85CD 8R5(R -C line; (*)
*orrect
6. What will be displayed when a user e)ecutes the following state+ent
&($(*/ ob0ect6na+e 1R8! user6ob0ects
W=(R( ob0ect6type $,7( D#A*7ED;
!ark for
Review
(4) #oints
/he na+es of all package specifications in the userDs sche+a
/he na+es of all package specifications and package bodies in the userDs
sche+a (*)
/he para+eters which +ust be used when invoking all packaged
subprogra+s in the userDs sche+a
/he detailed code of all packages in the userDs sche+a
/he na+es of all packages which can be invoked by the user
*orrect
7. When one co+ponent of a package is called, all the packageDs co+ponents are
loaded into +e+ory. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
8. A local variable defined inside a package procedure is visible to the calling
environ+ent. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
. Cour sche+a contains a package called (!#6#79. Cou want to re+ove the
package body but not the specification. /he correct synta) to do this is2 5R8#
-85C e+p6pkg; /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
1!. &*8//Ds sche+a contains a package (!#6#79 which contains a public
procedure (!#6&A$ which accepts a .:!-(R para+eter. Which of the following
will invoke the procedure successfully
!ark for
Review
(4) #oints
e+p6pkg.e+p6sal("4");
scott.e+p6pkg.e+p6sal("4")2 (*)
e+p6sal("4");
.one of the above
All of the above
*orrect
Test: "#$ance# Package Concepts: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which two of these functions could not be in the sa+e package ". 1:.*/,8.
get6e+p (p" 5A/() R(/:R. <AR*=AR>; >. 1:.*/,8. get6e+p (p" 5A/(, p>
.:!-(R) R(/:R. <AR*=AR>; B. 1:.*/,8. get6e+p (p" 5A/(, p>
.:!-(R) R(/:R. .:!-(R; A. 1:.*/,8. get6e+p (p" .:!-(R, p> 5A/()
R(/:R. <AR*=AR>;
!ark for
Review
(") #oints
" and >
" and A
> and A
> and B (*)
B and A
*orrect
2. ()a+ine the following package code2
*R(A/( 8R R(#$A*( #A*7A9( over6pack ,&
#R8*(5:R( do6work" (p" ,. <AR*=AR>, p> ,. .:!-(R);
#R8*(5:R( do6work> (p" ,. <AR*=AR>, p> ,. .:!-(R);
#R8*(5:R( do6work" (para+" ,. *=AR, para+> ,. .:!-(R);
1:.*/,8. do6work> (para+" ,. <AR*=AR>, para+> ,. .:!-(R) R(/:R.
5A/(;
(.5 over6pack;
Which of the following calls will be successful (*hoose three.)
!ark for
Review
(") #oints
(*hoose all correct answers)
over6pack.do6work"(D&+ithD,>4);
v6date 2? over6pack.do6work>(D&+ithD,>4); (*)
over6pack.do6work>(D&+ithD,>4); (*)
over6pack.do6work"(p"?FD&+ithD,p>?F>4); (*)
over6pack.do6work"(para+"?FD&+ithD);
*orrect
3. ,f a subprogra+ is public (declared in the package specification), its detailed code
can be written anywhere in the package body without the need to use forward
declarations. /rue or 1alse
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
4. A package initiali3ation block is e)ecuted auto+atically every ti+e a user invokes
any procedure or function in the package. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
5. Which one of the following is .8/ a restriction on a package function called fro+ a
&'$ state+ent !ark for
Review
(") #oints
/he function can include a *8!!,/.
/he function can be overloaded. (*)
/he function can include a R8$$-A*7.
/he function can return a -88$(A..
*orrect
6. /he package na+e +ust be included when calling a package function fro+ a
&($(*/ state+ent e)ecuted outside the package. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
7. #ackage 18RWAR56#A*7 contains two procedures2 #R8*" is public while
#R8*> is private (not declared in the package specification). /hese procedures
have no para+eters. Which of the following package bodies will .8/ co+pile
successfully (*hoose two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
*R(A/( 8R R(#$A*( #A*7A9( -85C forward6pack ,&
#R8*(5:R( proc" ,&
-(9,.
proc>;
(.5;
#R8*(5:R( proc> ,&
-(9,.
5-!&68:/#:/.#:/6$,.((DAny +essageD);
(.5;
(.5 forward6pack;
(*)
*R(A/( 8R R(#$A*( #A*7A9( -85C forward6pack ,&
#R8*(5:R( proc> ,&
-(9,.
5-!&68:/#:/.#:/6$,.((DAny +essageD);
(.5;
#R8*(5:R( proc" ,&
-(9,.
proc>;
(.5;
(.5 forward6pack;
*R(A/( 8R R(#$A*( #A*7A9( -85C forward6pack ,&
#R8*(5:R( proc>;
#R8*(5:R( proc" ,&
-(9,.
proc>;
(.5;
#R8*(5:R( proc> ,&
-(9,.
5-!&68:/#:/.#:/6$,.((DAny +essageD);
(.5;
(.5 forward6pack;
*R(A/( 8R R(#$A*( #A*7A9( -85C forward6pack ,&
#R8*(5:R( proc";
#R8*(5:R( proc" ,&
-(9,.
proc>;
(.5;
#R8*(5:R( proc> ,&
proc";
(.5;
(.5 forward6pack;
(*)
*R(A/( 8R R(#$A*( #A*7A9( -85C forward6pack ,&
#R8*(5:R( proc>;
#R8*(5:R( proc" ,&
-(9,.
proc>;
(.5;
#R8*(5:R( proc> ,&
-(9,.
proc";
(.5;
(.5 forward6pack;
*orrect
8. Which of the following best describes a package initiali3ation block
!ark for
Review
(") #oints
,t is a na+ed procedure in a package which +ust be invoked by a user before
any other part of the package can be invoked.
,t is an anony+ous block in the package specification.
,t is an anony+ous block at the end of a package body which e)ecutes
auto+atically the first ti+e each user session invokes a subprogra+ in the
package. (*)
,t is a private function within the package body.
-ecause it is an anony+ous block, it cannot be invoked and therefore will
never e)ecute. ,t is treated as a set of co++ents.
*orrect
. A bodiless package contains what
!ark for
Review
(") #oints
#rocedures only
1unctions only
#ublic variables only (*)
#rivate variables only
*orrect
1!. /he following package is valid. /rue or 1alse
*R(A/( 8R R(#$A*( #A*7A9( e)ceptions6pkg ,&
e6cons6violation (G*(#/,8.;
#RA9!A (G*(#/,8.6,.,/ (e6cons6violation, H>>I>);
e6value6too6large (G*(#/,8.;
#RA9!A (G*(#/,8.6,.,/ (e6value6too6large, H"ABJ);
(.5 e)ceptions6pkg;
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
11. =ow would you invoke the constant k+6to6+ile fro+ the global6consts bodiless
package at <AR,A-$( A
&($(*/ trail6na+e, distance6in6k+ * <AR,A-$( A
1R8! trails
W=(R( park6na+e ? DC8&(!,/(D;
!ark for
Review
(") #oints
k+6to6+ile.global6consts
k+6to6+ile (global6consts)
global6consts.k+6to6+ile (*)
global6consts (k+6to6+ile)
*orrect
12. When using a package function in 5!$ state+ents, which rules +ust you follow
(*hoose three) !ark for
Review
(") #oints
(*hoose all correct answers)
!ust not end the current transaction (*)
*an read or +odify the table being changed by that 5!$ state+ent
*hanges to a package variable could have an i+pact on another stored
function (*)
*annot e)ecute a 5!$ state+ent or +odify the database (*)
,ncorrect. Refer to &ection "4 $esson B.
13. /he following e)a+ple package specification is valid to create a data type ed6type
that can be used in other subprogra+s. /rue or 1alse
*R(A/( 8R R(#$A*( #A*7A9( e+p6dept6pkg
,&
/C#( ed6type ,& R(*8R5 (f6na+e e+ployees.first6na+eE/C#(,
l6na+e e+ployees.last6na+eE/C#(,
d6na+e depart+ents.depart+ent6na+eE/C#();
#R8*(5:R( sel6e+p6dept
(p6e+p6id ,. e+ployees.e+ployee6idE/C#(,
p6e+p6dept6rec 8:/ ed6type);
(.5 e+p6dept6pkg;
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
14. ,.5(G -C is +issing fro+ the e+pt6tab /C#( declaration. What is the +ost
efficient declaration
*R(A/( 8R R(#$A*( #A*7A9( e+p6pkg ,&
/C#( e+p6tab ,& /A-$( 81 e+ployeesER8W/C#(;
#R8*(5:R( get6e+ployees(p6e+p6table 8:/ e+p6tab);
(.5 e+p6pkg;
!ark for
Review
(") #oints
,.5(G -C ,./(9(R
,.5(G -C -,.ARC
,.5(G -C -,.ARC6,./(9(R (*)
,.5(G A$$
*orrect
Test: Persistant State o% Package &aria'(es: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. A packageDs state is initiali3ed when the package is first loaded. /rue or 1alse
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. :sers A and - call the sa+e procedure in a package to initiali3e a global variable
+y6pkg.g6var. What will be the value of +y6pkg.g6var for :ser A at #oint A
:ser A2 +y6pkg.g6var is "4
:ser -2 +y6pkg.g6var is "4
:ser A2 +y6pkg.g6var is @4
:ser -2 +y6pkg.g6var is >@
#oint A
!ark for
Review
(") #oints
"4
@4 (*)
>@
*orrect
3. A cursorDs state is defined only by whether it is open or closed and, if open, how
+any rows it holds. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
4. ,n the following e)a+ple, which state+ent best fits in $ine " (*hoose ")
5(*$AR(
v6+ore6rows6e)ist -88$(A. 2? /R:(;
-(9,.
HH $ine "
$88#
v6+ore6rows6e)ist 2? curs6pkg.fetch6n6rows(B);
5-!&68:/#:/.#:/6$,.((DHHHHHHHD);
(G,/ W=(. .8/ v6+ore6rows6e)ist;
(.5 $88#;
curs6pkg.close6curs;
(.5;
!ark for
Review
(") #oints
curs6pkg.e+p6cursE,&8#(.;
curs6pkg.close6curs;
curs6pkg.open6curs; (*)
(G,/ W=(. curs6pkg.e+p6cursE.8/18:.5;
*orrect
Test: )sing *rac(e+Supp(ie# Packages: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. /he 5-!&68:/#:/ package is useful for which of the following activities
(*hoose two) !ark for
Review
(") #oints
(*hoose all correct answers)
,nteract with a user during e)ecution of a function or procedure
5isplay results to the developer during testing for debugging purposes (*)
/race the code e)ecution path for a function or procedure (*)
Write operating syste+ te)t files to the userDs screen
*orrect
2. /he 5-!&68:/#:/ gives progra++ers an easyHtoHuse interface to see, for
instance, the current value of a loop counter, or whether or not a progra+ reaches a
particular branch of an ,1 state+ent. (/rue or 1alse)
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
3. Which 5-!&68:/#:/ package subprogra+ places te)t into the buffer at $ine "
(*hoose one) ,1 v6bool" A.5 .8/ v6bool> A.5 v6nu+ber K >@ /=(. HH$ine "
($&( ... (.5 ,1; 5-!&68:/#:/..(W6$,.(;
!ark for
Review
(") #oints
5-!&68:/#:/.#:/(D,1 branch was e)ecutedD); (*)
5-!&68:/#:/.#:/6$,.((D,1 branch was e)ecutedD);
5-!&68:/#:/.9(/6$,.((D,1 branch was e)ecutedD);
5-!&68:/#:/..(W6$,.((D,1 branch was e)ecutedD);
*orrect
4. /he :/$61,$( package can be used to read and write binary files such as L#(9s
as well as te)t files. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
5. :sing the 18#(. function, you can do which actions with the :/$61,$( package
(*hoose >) !ark for
Review
(") #oints
(*hoose all correct answers)
,t is used to append to a file until processing is co+plete. (*)
,t is used to read and write te)t files stored outside the database. (*)
,t is used to find out how +uch free space is left on an operating syste+ disk.
,t is used to +anipulate large ob0ect data type ite+s in colu+ns.
*orrect
6. /he :/$61,$( package contains several e)ceptions e)clusively used in this
package. Which are they (*hoose B) !ark for
Review
(") #oints
(*hoose all correct answers)
,.<A$,56#A/= (*)
.865A/A618:.5
WR,/(6(RR8R (*)
,.<A$,568#(RA/,8. (*)
M(R865,<,5(
*orrect
7. Which general e)ceptions +ay be handled by the :/$61,$( package (*hoose >)
!ark for
Review
(") #oints
(*hoose all correct answers)
/886!A.C6R8W&
<A$:(6(RR8R (*)
M(R865,<,5(
.865A/A618:.5 (*)
*orrect
Test: )sing ,-na.ic SQ/: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. What happens when a &'$ state+ent is parsed (*hoose three.)
!ark for
Review
(") #oints
(*hoose all correct answers)
/he userDs required privileges are checked. (*)
/he synta) of the state+ent is checked. (*)
/he state+ent is e)ecuted.
/he results of the state+ent are returned to the user.
8racle queries the 5ata 5ictionary to +ake sure that the tables referenced in
the &'$ state+ent e)ist. (*)
*orrect
2. When &'$ state+ents are included within a procedure, the state+ents are parsed
when the procedure is co+piled. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
3. A progra++er wants to code a procedure which will create a table with a single
colu+n. /he datatype of the colu+n will be chosen by the user who invokes the
procedure. /he progra++er writes the following code2
*R(A/( 8R R(#$A*( #R8*(5:R( create6tab
(p6col6datatype ,. <AR*=AR>) ,&
-(9,.
*R(A/( /A-$( newtab (only6col p6col6datatype);
(.5;
Why will this procedure not co+pile successfully
!ark for
Review
(") #oints
-ecause you cannot create a table inside a procedure
-ecause the invoking user +ay not have *R(A/( /A-$( privilege
-ecause when the procedure is co+piled, 8racle cannot check if the para+eter
value passed into the procedure is a valid colu+n datatype (*)
-ecause table .(W/A- +ay already e)ist
.one of the above; the procedure will co+pile successfully.
*orrect
4. 1or which of the following is it necessary to use 5yna+ic &'$ (*hoose three.)
!ark for
Review
(") #oints
(*hoose all correct answers)
A$/(R (*)
9RA./ (*)
&A<(#8,./
:#5A/(
5R8# (*)
*orrect
5. ()a+ine the following procedure, which drops a table whose na+e is passed as an
,. para+eter2
*R(A/( 8R R(#$A*( #R8*(5:R( drop6tab
(p6table6na+e ,. <AR*=AR>) ,&
v6sql6state+ent <AR*=AR>("44);
-(9,.
...
(.5;
Which of the following will work correctly when coded in the procedureDs e)ecutable
section (*hoose two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
(G(*:/( ,!!(5,A/( D5R8# /A-$( p6table6na+eD;
(G(*:/( ,!!(5,A/( D5R8# /A-$( D NN p6table6na+e;
(*)
v6sql6state+ent 2? D5R8# /A-$( D NN p6table6na+e;
(G(*:/( ,!!(5,A/( v6sql6state+ent;
(*)
v6sql6state+ent 2? D5R8# /A-$( D NN p6table6na+e;
(G(*:/( ,!!(5,A/( Dv6sql6state+entD;
v6sql6state+ent 2? D5R8# /A-$( D;
(G(*:/( ,!!(5,A/( v6sql6state+ent p6table6na+e;
*orrect
6. What will happen when the following procedure is invoked
*R(A/( 8R R(#$A*( #R8*(5:R( do6so+e6work ,&
*:R&8R c6curs ,& &($(*/ ob0ect6na+e 1R8! user6ob0ects
W=(R( ob0ect6type ? D1:.*/,8.D;
-(9,.
18R v6curs6rec ,. c6curs $88#
(G(*:/( ,!!(5,A/( DA$/(R 1:.*/,8. D NN v6curs6rec.ob0ect6na+e NN D
*8!#,$(D;
(G,/ W=(. c6cursER8W*8:./ F >;
(.5 $88#;
(.5;
!ark for
Review
(") #oints
All functions in the userDs sche+a will be reco+piled.
/he first two functions in the userDs sche+a will be reco+piled.
/he first three functions in the userDs sche+a will be reco+piled. (*)
/he procedure will not co+pile successfully because you cannot A$/(R
functions using 5yna+ic &'$.
/he procedure will not co+pile successfully because the synta) of the A$/(R
1:.*/,8. state+ent is incorrect.
*orrect
7. /he 5-!&6&'$ package is easier to use than (G(*:/( ,!!(5,A/(. /rue or
1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
8. 8nly one call to 5-!&6&'$ is needed in order to drop a table. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
. .a+e two reasons for using 5yna+ic &'$.
!ark for
Review
(") #oints
(*hoose all correct answers)
Avoids errrors at co+pile ti+e of 5!$ state+ents
*reates a &'$ state+ent with varying colu+n data, or different conditions (*)
(nables dataHdefinition state+ents to be written and e)ecuted fro+ #$%&'$ (*)
(nables syste+ control state+ents to be written and e)ecuted fro+ #$%&'$
*orrect
Test: 0.pro$ing P/1SQ/ Per%or.ance: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. What are benefits of using the .8*8#C hint (*hoose two)
!ark for
Review
(") #oints
(*hoose all correct answers)
&afer because it uses passing by value
(fficient since it uses less +e+ory (*)
:ses a larger block of server +e+ory for faster access
1aster because a single copy of the data is used (*)
*orrect
2. A functionHbased inde) +ay be +ade using your own functions, but only if the
function is created using the 5(/(R!,.,&/,* clause. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
3. /he following procedure co+piles successfully. /rue or 1alse
*R(A/( 8R R(#$A*( #A*7A9( e+p6pkg ,&
/C#( t6e+p ,& /A-$( 81 e+ployeesER8W/C#(
,.5(G -C -,.ARC6,./(9(R;
#R8*(5:R( e+p6proc
(p6s+all6arg ,. .:!-(R, p6big6arg .8*8#C 8:/ t6e+p);
...
(.5 e+p6pkg;
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
4. ,n the following e)a+ple, where do you place the phrase 5(/(R!,.,&/,*
*R(A/( 8R R(#$A*( 1:.*/,8. total6sal
(p6dept6id ,. HH #osition A
e+ployees.depart+ent6idE/C#()
R(/:R. .:!-(R HH #osition -
,& v6total6sal .:!-(R;
-(9,.
&($(*/ &:!(salary) ,./8 v6total6sal
1R8! e+ployees W=(R( depart+ent6id ? p6dept6in;
R(/:R. v6total6sal HH #osition *;
(.5 total6sal;
!ark for
Review
(") #oints
#osition A
#osition - (*)
#osition *
*orrect
5. What is wrong with this code e)a+ple
*R(A/( 8R R(#$A*( #R8*(5:R( insert6e+ps ,&
/C#( t6e+p ,& /A-$( 81 e+ployeesER8W/C#( ,.5(G -C
-,.ARC6,./(9(R;
v6e+ptab t6e+p;
-(9,.
18RA$$ i ,. v6e+ptab.1,R&/..v6e+ptab.$A&/
,.&(R/ ,./8 e+ployees <A$:(& v6e+ptab(i);
(.5 $88#;
(.5 insert6e+ps;
!ark for
Review
(") #oints
/he phrase should be 18R A$$.
v6e+ptab is incorrectly typed.
18RA$$ does not require (.5 $88#. (*)
.othing is wrong; it will co+pile successfully.
*orrect
6. 18RA$$ can only be used with the ,.&(R/ state+ent. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
7. ,n the following e)a+ple, where do you place the phrase -:$7 *8$$(*/
...
-(9,.
&($(*/ HH #osition A
salary HH #osition -
,./8 v6saltab HH #osition *
1R8! e+ployees W=(R( depart+ent6id ? >4 8R5(R -C salary
HH #osition 5
;
...
!ark for
Review
(") #oints
#osition A
#osition - (*)
#osition *
#osition 5
*orrect
8. ,n the following e)a+ple, where do you place the phrase -:$7 *8$$(*/
5(*$AR(
/C#( .a+e$ist ,& /A-$( 81 e+p.ena+eE/C#(;
na+es .a+e$ist;
*:R&8R c" ,& &($(*/ ena+e HH #osition A
1R8! e+p W=(R( 0ob ? D*$(R7D;
-(9,.
8#(. c";
1(/*= c" HH #osition -
,./8 HH #osition *
na+es;
...
*$8&( c";
(.5;
!ark for
Review
(") #oints
#osition A
#osition - (*)
#osition *
*orrect
. What is the +ain purpose for using the R(/:R.,.9 clause
!ark for
Review
(") #oints
,+prove perfor+ance by returning a single value
,+prove perfor+ance by +ini+i3ing the nu+ber of state+ents
,+prove perfor+ance by +aking one call to the &'$ engine (*)
Return +ore readily any e)ceptions that are raised by the state+ent
*orrect
1!. /he following state+ent is a valid e)a+ple of using the R(/:R.,.9 clause. /rue
or 1alse
5(*$AR(
/C#( (+pRec ,& R(*8R5 (last6na+e e+ployees.last6na+eE/C#(, salary
e+ployees.salaryE/C#();
e+p6info (+pRec;
e+p6id .:!-(R 2? "44;
-(9,.
:#5A/( e+ployees &(/ salary ? salary * "." W=(R( e+ployee6id ? e+p6id
R(/:R.,.9 last6na+e, salary ,./8 e+p6info;
db+s6output.put6line(DLust gave a raise to D NN e+p6info.last6na+e NN
D, who now +akes D NN e+p6info.salary);
(.5;
!ark for
Review
(") #oints
/rue (*)
1alse
Test: 0ntro#uction to Triggers: Quiz
Answer the question(s) on this page, and click .e)t to go to the ne)t test page. *lick &u++ary to see which
questions you need to answer before sub+itting the test. *lick 1inish /est if you are ready to sub+it your test.
Section 1
(Answer all questions in this section)
1. Which of the following could .8/ be done by a database trigger
!ark for
Review
(") #oints
(nforcing a co+ple) business rule
(nforcing a co+ple) database security check
Recalculating the total salary bill for a depart+ent whenever an e+ployeeDs
salary is changed
(nsuring that a student never arrives late for a class
7eeping a log of how +any rows have been inserted into a table
2. Cou can use a database trigger to prevent invalid transactions fro+ being
co++itted. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse
3. Which of the following best describes a database trigger
!ark for
Review
(") #oints
,t allows users to log on to the database.
,t e)ecutes auto+atically whenever a particular event occurs within the
database.
,t prevents unique constraints fro+ being violated.
,t e)ecutes auto+atically whenever a user clicks on a button with his +ouse.
,t allows foreign key constraints to be violated.
4. A database trigger is a #$%&'$ stored subprogra+ which is e)plicitly invoked 0ust
like a procedure or a function. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse
5. Which of the following events could .8/ auto+atically fire a database trigger
!ark for
Review
(") #oints
A user logging on to the database
A &'$ ,.&(R/ state+ent
Cou click your +ouse on a button to choose the correct answer to this
question
A 5!$ operation on a view
/he 5atabase Ad+inistrator shuts down the database
6. While editing a docu+ent in !icrosoft Word, you go to the 1,$( +enu and &A<(
your work. /o do this, !icrosoft Word has e)ecuted an application trigger. /rue or
1alse
!ark for
Review
(") #oints
/rue
1alse
7. A business rule states that an e+ployeeDs salary +ust be between A444 and
B4444. We could enforce this rule using a check constraint, but it is better to use a
database trigger. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse
8. Which of the following are good guidelines to follow when creating triggers
(*hoose two) !ark for
Review
(") #oints
(*hoose all correct answers)
-e aware of recursive and cascading effects
Where possible, use triggers to enforce .8/ .:$$ constraints
Avoid lengthy trigger logic by creating a procedure and invoking it fro+ within
the trigger
:se triggers to replace functionality which is already built into the database
Always create +ore triggers than you need, because it is better to be safe
. A userDs sche+a contains procedure !C#R8*, function !C1:.*, trigger
!C/R,99 and package !C#A*7 which contains a public procedure #A*7#R8*.
/hese subprogra+s have no para+eters, and the function returns a .:!-(R.
Which of the following calls to these ob0ects (fro+ an anony+ous block) are
incorrect (*hoose two)
!ark for
Review
(") #oints
(*hoose all correct answers)
+ypack.packproc;
+ytrigg;
+yproc;
v6nu+ber 2? +yfunc;
,1 .8/ +yfunc /=(. ...
1!. Which of the following are .8/ allowed within a database trigger (*hoose two)
!ark for
Review
(") #oints
(*hoose all correct answers)
*8!!,/
A call to a packaged procedure
,.&(R/
A -oolean variable
&A<(#8,./
Test: Creating ,M/ Triggers: Part 0: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which of the following is the correct synta) for creating a 5!$ trigger associated
with the (!#$8C((& table /he trigger +ust fire whenever an e+ployeeDs L8-6,5
is updated, but not if a different colu+n is updated.
!ark for
Review
(") #oints
*R(A/( /R,99(R 0ob6upd6trigg
A1/(R :#5A/( 8. e+ployees(0ob6id)
-(9,. ...
*R(A/( /R,99(R 0ob6upd6trigg
W=(.(<(R :#5A/( 81 0ob6id ,. e+ployees
-(9,. ...
*R(A/( /R,99(R 0ob6upd6trigg
A1/(R :#5A/( 8. e+ployees.0ob6id
-(9,. ...
*R(A/( /R,99(R 0ob6upd6trigg
A1/(R :#5A/( 81 0ob6id 8. e+ployees
-(9,. ...
(*)
*orrect
2. What is wrong with the following code
*R(A/( 8R R(#$A*( /R,99(R +ytrigg
A1/(R 5($(/( 8. depart+ents
-(9,.
,.&(R/ ,./8 audit6table (who, when)
<A$:(& (:&(R, &C&5A/();
*8!!,/;
(.5;
!ark for
Review
(") #oints
A 5!$ trigger cannot itself contain a 5!$ state+ent such as ,.&(R/ ,./8
audit6table.
Cou cannot use *8!!,/ inside a trigger. (*)
/he last line of code should be (.5 +ytrigg;
/he second line should be2 A1/(R 5($(/( 81 5(#AR/!(./&
.othing is wrong, the trigger will e)ecute successfully.
*orrect
3. Which of the following are possible keywords for the ti+ing co+ponent of a trigger
(*hoose three.) !ark for
Review
(") #oints
(*hoose all correct answers)
-(18R( (*)
,.&/(A5
W=(.(<(R
,.&/(A5 81 (*)
A1/(R (*)
*orrect
4. We want to create a log record auto+atically every ti+e any 5!$ operation is
e)ecuted on either or both of the (!#$8C((& and 5(#AR/!(./& tables. What is
the s+allest nu+ber of triggers that +ust be create to do this
!ark for
Review
(") #oints
8ne
/wo (*)
/hree
&i)
(ight
*orrect
5. We want to prevent e+ployees fro+ being deleted on &undays. /o do this, we
create the following trigger2
*R(A/( 8R R(#$A*( /R,99(R stop6del6e+ps
....... 5($(/( 8. e+ployees HH $ine A
-(9,.
,1 /86*=AR(&C&5A/(D,D5CD) ? D&:.D /=(.
RA,&(6A##$,*A/,8.6(RR8R(H>4"4",D,nvalid deleteD);
(.5 ,1;
(.5;
&hould this be a -(18R( or A1/(R trigger, and why
!ark for
Review
(") #oints
,t should be a -(18R( trigger because if an A1/(R trigger were created, the
e+ployee would already have been deleted by the ti+e the trigger checks the
date. (*)
,t should be a -(18R( trigger because you cannot use
RA,&(6A##$,*A/,8.6(RR8R with A1/(R triggers.
,t should be an A1/(R trigger because the 8racle &erver cannot fire the trigger
until it knows that the e+ployee has been deleted.
,t does not +atter, either a -(18R( or an A1/(R trigger could be created.
*orrect
6. An A1/(R :#5A/( trigger can specify +ore than one colu+n. /rue or 1alse
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
7. A -(18R( state+ent trigger inserts a row into a logging table every ti+e a user
updates the salary colu+n of the e+ployees table. /he user now tries to update the
salaries of three e+ployees with a single :#5A/( state+ent, but the update fails
because it violates a check constraint. =ow +any rows will be inserted into the
logging table
!ark for
Review
(") #oints
.one, the transactions are rolled back because the update failed. (*)
8ne
/hree
1our
.one of the above
*orrect
8. /here are five e+ployees in depart+ent @4. A state+ent trigger is created by2
*R(A/( 8R R(#$A*( /R,99(R e+p6upd6trigg
A1/(R 5($(/( 8. (!#$8C((&
-(9,. ...
A user now e)ecutes2
5($(/( 1R8! e+ployees W=(R( depart+ent6id ? @4;
=ow +any ti+es will the trigger fire, and when
!ark for
Review
(") #oints
8nce, before the 5($(/( is e)ecuted
1ive ti+es, after each e+ployee row is deleted
8nce, after the 5($(/( is e)ecuted (*)
&i) ti+es, once after each row and once at the end of the state+ent
/he trigger will not fire at all.
*orrect
Test: Creating ,M/ Triggers: Part 00: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Cou decide to create the following trigger2
*R(A/( 8R R(#$A*( /R,99(R e+pl6trigg
-(18R( :#5A/( 8. e+ployees
-(9,.
HH $ine A
RA,&(6A##$,*A/,8.6(RR8R(D*annot update salaryD);
($&(
,.&(R/ ,./8 log6table values (:&(R, &C&5A/();
(.5 ,1;
(.5;
Cou want the trigger to prevent updates to the &A$ARC colu+n, but allow updates
to all other colu+ns. What should you code at $ine A
!ark for
Review
(") #oints
,1 :#5A/,.9 &A$ARC /=(.
,1 :#5A/,.9(D&A$ARCD) /=(. (*)
,1 :#5A/((D&A$ARCD) /=(.
,1 :#5A/,.9(&A$ARC) /=(.
,1 :#5A/((&A$ARC) /=(.
*orrect
2. Which of the following best describes conditional predicates in a trigger
!ark for
Review
(") #oints
/hey are special variables which +ust be 5(*$AR(d within the trigger.
/hey allow the trigger code to see what data values are being inserted into a
row.
/hey are auto+atically declared boolean variables which allow the trigger
body to detect which 5!$ operation is being e)ecuted. (*)
/hey are special cursor attributes, like ER8W*8:./ and E.8/18:.5
*orrect
3. ()a+ine the following code. /o create a row trigger, what code should be included
at $ine A
*R(A/( 8R R(#$A*( /R,99(R del6e+p6trigg
-(18R( 5($(/( 8. e+ployees
HHHH $ine A
-(9,. ...
!ark for
Review
(") #oints
18R (<(RC R8W
18R (A*= R8W (*)
18R (<(RC R8W
18R A$$ R8W&
.othing is needed because 5!$ triggers are row triggers by default.
*orrect
4. A row trigger has been created which is fired by :#5A/( 8. e+ployees. A user
now e)ecutes a single &'$ state+ent which updates four rows of the
(!#$8C((& table. =ow +any ti+es will the row trigger fire
!ark for
Review
(") #oints
8ne ti+e
/wo ti+es
1our ti+es (*)
1ive ti+es
(ight ti+es
*orrect
5. Whenever an e+ployeeDs L8-6,5 is updated, we want to insert a row into a
logging table to record the e+ployee6id and the new value of L8-6,5. We create a
row trigger whose body includes the following code2
-(9,.
,.&(R/ ,./8 logging6table (e+p6id, 0ob6id)
<A$:(& HH #oint A
(.5;
At point A, which of the following will insert the correct data into the logging table
(*hoose two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
(28$5.e+ployee6id, 28$5.0ob6id);
(28$5.e+ployee6id, 2.(W.0ob6id); (*)
(2.(W.e+ployee6id, 28$5.0ob6id);
(2.(W.e+ployee6id, 2.(W.0ob6id); (*)
(.(W.e+ployee6id, .(W.0ob6id);
*orrect
6. /he 8$5 and .(W qualifiers can be used with state+ent triggers as well as row
triggers. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
7. Which of the following state+ents about ,.&/(A5 81 triggers are .8/ true
(*hoose two.) !ark for
Review
(") #oints
(*hoose all correct answers)
/hey can be created on a table. (*)
/hey can be created on a si+ple view.
/hey can be created on a co+ple) view.
/hey can be state+ent triggers. (*)
/hey can be row triggers.
*orrect
8. /he following view and trigger have been created2
*R(A/( <,(W dept6view A& &($(*/ * 1R8! depart+ents;
*R(A/( 8R R(#$A*( /R,99(R dept6view6trigg
,.&/(A5 81 :#5A/( 8. dept6view
-(9,.
5-!&68:/#:/.#:/6$,.((D&a+ple !essageD);
(.5;
5epart+ents @4 and J4 e)ist but depart+ent J" does not. A user now e)ecutes the
following state+ent2
:#5A/( dept6view &(/ depart+ent6na+e ? D&alesD
W=(R( depart+ent6id ,. (@4,J4,J");
What happens
!ark for
Review
(") #oints
/wo rows are updated and O&a+ple !essageO is displayed once.
.o rows are updated and O&a+ple !essageO is displayed once.
.o rows are updated and O&a+ple !essageO is displayed twice. (*)
.o rows are updated and O&a+ple !essageO is displayed three ti+es.
.one of the above
*orrect
. What are the ti+ing events for a co+pound trigger
!ark for
Review
(") #oints
-efore the triggering state+ent; After the triggering state+ent; ,nstead of the
-efore the triggering state+ent; -efore each row; After each row; After the
triggering state+ent (*)
-efore the triggering state+ent; After the triggering state+ent; After each row
-efore the triggering state+ent; -efore each row; After the triggering
state+ent
*orrect
1!. What is wrong with this co+pound trigger e)a+ple
*R(A/( 8R R(#$A*( /R,99(R co+pound6trigger
18R :#5A/( 81 salary
*8!#8:.5 /R,99(R
threshold *8.&/A./ &,!#$(6,./(9(R 2? >44;
-(18R( (A*= R8W ,&
-(9,.
HH so+e action
(.5 -(18R( (A*= R8W;
A1/(R (A*= R8W ,&
-(9,.
HH so+e action
(.5 A1/(R (A*= R8W;
A1/(R &/A/(!(./ ,&
-(9,.
HH so+e action
(.5 A1/(R &/A/(!(./;
(.5 co+pound6trigger;
!ark for
Review
(") #oints
!issing -(18R( ti+ing state+ent
!issing the (G*(#/,8. section
!issing na+e of table on which the trigger fires (*)
!issing the ,.&/(A5 81 ti+ing section
!issing the -(18R( and ,.&/(A5 81 ti+ing sections
*orrect
Test: Creating ,,/ an# ,ata'ase 2$ents Triggers: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which of the following could .8/ cause a 55$ or 5atabase (vent trigger to fire
!ark for
Review
(") #oints
A table is dropped.
A user connects to the database.
/he 5-A starts up the database.
A user deletes rows fro+ the (!#$8C((& table. (*)
A specific e)ception is raised in a userDs session.
*orrect
2. /he database ad+inistrator creates a trigger that auto+atically disconnects user
=A*7(R whenever =A*7(R connects to the database. What type of trigger is
this
!ark for
Review
(") #oints
A 55$ trigger
A 5atabase (vent trigger (*)
A 5!$ trigger
A state+ent trigger
An ,.&/(A5 81 trigger
*orrect
3. :ser =ARL,/ wants to prevent any ob0ects which he owns fro+ being dropped.
=ar0it decides to e)ecute the following code2
*R(A/( 8R R(#$A*( /R,99(R stop6drop
HHHH $ine A
-(9,.
RA,&(6A##$,*A/,8.6(RR8R(H>4>4",DAtte+pted dropD);
(.5;
What should =ar0it code at $ine A
!ark for
Review
(") #oints
-(18R( 5R8# 8. =ARL,/
-(18R( 5R8# 8. /A-$(
-(18R( 5R8# 8. &*=(!A (*)
-(18R( 5R8# 8. 8W.(R
-(18R( 5R8# 8. :&(R68-L(*/&
*orrect
4. Cou can create a trigger which prevents 55$ state+ents on an individual table,
while still allowing 55$ on other tables in the sa+e sche+a. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
5. /he database ad+inistrator wants to write a log record every ti+e any userDs
session raises an 8RAH44IA> e)ception. /he 5-A decides to create the following
trigger2
*R(A/( 8R R(#$A*( /R,99(R log6IA>6trigg
A1/(R &(R<(R(RR8R 8. 5A/A-A&(
-(9,.
HH $ine A
,.&(R/ ,./8 log6table <A$:(& ( ...);
(.5;
What should the 5-A code at $ine A
!ark for
Review
(") #oints
,1 (&(R<(R(RR8R(IA>)) /=(.
,1 (,&6&(R<(R(RR8R(IA>)) /=(. (*)
,1 (&(R<(R(RR8R ? IA>) /=(.
,1 (,&6&(R<(R(RR8R ? IA>) /=(.
,1 (,&6&(R<(R(RR8R(8RAH44IA>)) /=(.
*orrect
6. What is the benefit of using the *A$$ state+ent in a trigger body
!ark for
Review
(") #oints
,t allow both 55$ events and database events to be handled by a single
trigger.
,t prevents data being read fro+ a +utating table.
,t allows the database ad+inistrator to +onitor who is currently connected to
the database.
,t allows the trigger body code to be placed in a separate procedure. (*)
*orrect
7. What is wrong with the following code
*R(A/( 8R R(#$A*( /R,99(R call6trigg
A1/(R :#5A/( 8R 5($(/( 8. e+ployees
-(9,.
*A$$ del6e+p6proc
(.5;
!ark for
Review
(") #oints
When *A$$ is used, the -(9,. and (.5; state+ents should be o+itted. (*)
/he *A$$ state+ent should end with a se+icolon (;)
Cou cannot use a *A$$ state+ent in a 5!$ trigger.
When using *A$$, only one 5!$ state+ent can be tested, so :#5A/( 8R
5($(/( is wrong.
*orrect
8. What is wrong with the following code
*R(A/( 8R R(#$A*( /R,99(R e+p6d+l6trigg
-(18R( :#5A/( 81 salary 8. e+ployees
18R (A*= R8W
5(*$AR(
v6+a)6sal e+ployees.salaryE/C#(;
-(9,.
&($(*/ +a)(sal) ,./8 v6+a)6sal 1R8! e+ployees;
(.5;
!ark for
Review
(") #oints
Cou cannot use a 5(*$AR( state+ent in a trigger.
/he trigger body is reading the sa+e table (e+ployees) that the triggering
event is updating. (*)
Cou +ust use RA,&(6A##$,*A/,8.6(RR8R in a -(18R( trigger.
Cou can never use &($(*/ inside a 5!$ trigger.
.othing is wrong, the trigger will e)ecute correctly.
*orrect
. !utating table errors can be caused by 5!$ triggers, but not by database event
triggers. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
1!. Cou have been granted *R(A/( /R,99(R privilege. Cou can now create an
A1/(R $89811 8. &*=(!A trigger. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
Test: Managing Triggers: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which dictionary view would you query to see the detailed body code of triggers in
your sche+a !ark for
Review
(") #oints
:&(R6&8:R*(
:&(R6/R,99(R
:&(R6/R,99(R& (*)
:&(R68-L(*/&
.one of the above; you cannot view the code of the trigger body after the
trigger has been created.
*orrect
2. -y default, any user can create a 5!$ trigger on a table in his%her sche+a. /rue or
1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. Cou have created several 5!$ triggers which reference your 5(#AR/!(./& table.
.ow you want to disable all of the+ using a single &'$ state+ent. Which co++and
should you use
!ark for
Review
(") #oints
A$/(R /R,99(R 5,&A-$( A$$ 8. depart+ents;
A$/(R /A-$( depart+ents 5,&A-$( A$$ /R,99(R&; (*)
A$/(R /A-$( depart+ents 5,&A-$( /R,99(R&;
5R8# A$$ /R,99(R& 8. depart+ents;
*orrect
4. Which co++and would you use to see if your triggers are enabled or disabled
!ark for
Review
(") #oints
&($(*/ trigger6na+e, status
1R8! :&(R6/R,99(R&;
(*)
&($(*/ ob0ect6na+e, status
1R8! :&(R68-L(*/&
W=(R( ob0ect6type ? D/R,99(RD;
&($(*/ trigger6na+e, trigger6type
1R8! :&(R6/R,99(R&;
5(&*R,-( /R,99(R
*orrect
5. :ser 7:$L,/ creates two triggers na+ed (!#"6/R,99 and (!#>6/R,99, which
are both 5!$ triggers referencing her (!#$8C((& table. 7ul0it now wants to
re+ove both of these triggers fro+ the database. What co++and(s) should 7ul0it
use to do this
!ark for
Review
(") #oints
5R8# A$$ /R,99(R& 8. e+ployees;
5R8# /R,99(R& 8. e+ployees;
5R8# /R,99(R e+p"6trigg;
5R8# /R,99(R e+p>6trigg;
(*)
5R8# /R,99(R e+p"6trigg A.5 e+p>6trigg;
*orrect
6. A user creates the following trigger2
*R(A/( 8R R(#$A*( /R,99(R e+p6trigg
A1/(R 5($(/( 8. e+ployees
-(9,.
...
(.5;
/he user now tries to drop the (!#$8C((& table. What happens
!ark for
Review
(") #oints
/he table is dropped but the trigger is not dropped.
An error +essage is displayed because you cannot drop a table that is
referenced by a trigger.
/he table is dropped and the trigger is disabled.
-oth the table and the trigger are dropped. (*)
*orrect
Test: 0ntro#uction to ,epen#encies: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. #$%&'$ procedure A invokes procedure -, which in turn invokes procedure *,
which references table /. ,f table / is dropped, which of the following state+ents is !ark for
true
Review
(") #oints
* is invalid but A and - are still valid
A, - and * are all invalid (*)
- and * are invalid but A is still valid
A, - and * are all still valid
.one of the above
*orrect
2. A procedure show6e+ps contains the following declaration2
*:R&8R e+p6curs ,& &($(*/ last6na+e, salary 1R8! e+ployees;
What will happen to the procedure if a new colu+n is added to the e+ployees
table
!ark for
Review
(") #oints
/he procedure will still be valid and e)ecute correctly because it does not
reference the added colu+n.
/he procedure will auto+atically be dropped and +ust be recreated.
/he procedure will be +arked invalid and +ust be reco+piled before it can be
ree)ecuted. (*)
:sersD privileges to e)ecute the procedure will auto+atically be revoked.
*orrect
3. <iew dept6view is based on a select fro+ table depart+ents. #rocedure
show6dept contains code which selects fro+ dept6view. Which of the following
state+ents are true (*hoose three.)
!ark for
Review
(") #oints
(*hoose all correct answers)
depart+ents is indirectly dependent on show6dept
show6dept is directly dependent on dept6view (*)
dept6view is directly dependent on depart+ents (*)
show6dept is indirectly dependent on depart+ents (*)
e+p6view is directly dependent on show6dept
*orrect
4. A single #$%&'$ subprogra+ such as a procedure can be both a referenced ob0ect
and a dependent ob0ect. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
5. Which data dictionary view shows infor+ation about references and
dependencies !ark for
Review
(") #oints
5(#/R((
:&(R65(#(.5(.*,(& (*)
:&(R6R(1(R(.*(&
:&(R6$8*A$65(#(.5(.*,(&
*orrect
6. Which of the following state+ents will show whether procedure +yproc is valid or
invalid !ark for
Review
(") #oints
&($(*/ status 1R8! :&(R68-L(*/&
W=(R( ob0ect6type ? D#R8*(5:R(D
A.5 ob0ect6na+e ? D!C#R8*D;
(*)
&($(*/ status 1R8! :&(R6#R8*(5:R(&
W=(R( procedure6na+e ? D!C#R8*D;
&($(*/ valid 1R8! :&(R68-L(*/&
W=(R( ob0ect6type ? D#R8*(5:R(D
A.5 ob0ect6na+e ? D!C#R8*D;
&($(*/ * 1R8! deptree;
*orrect
7. Which of the following database ob0ects are created when the utldtree.sql script is
run (*hoose three.) !ark for
Review
(") #oints
(*hoose all correct answers)
/he utldtree table
/he deptree6te+ptab table (*)
/he deptree and ideptree views (*)
/he deptree table
/he deptree6fill procedure (*)
*orrect
8. :ser A$,*( owns a procedure show6e+ps which references table e+ployees.
Which of the following will generate infor+ation that shows this dependency !ark for
Review
(") #oints
-(9,. deptree6fill(D/A-$(D,D(!#$8C((&D);
(.5;
-(9,. deptree6fill(D#R8*(5:R(D,DA$,*(D,D&=8W6(!#&D);
(.5;
-(9,. deptree6fill(DA$,*(D,D/A-$(D,D(!#$8C((&D);
(.5;
-(9,. deptree6fill(D/A-$(D,DA$,*(D,D(!#$8C((&D);
(.5;
(*)
-(9,. deptree6fill(DA$,*(D,D#R8*(5:R(D,D&=8W6(!#&D);
(.5;
*orrect
. A &($(*/ fro+ 5(#/R(( produced the following output.
>NESTED_LEVEL >TYPE >NAME
>0 >TABLE >EMPLOYEES
!ark for
Review
(") #oints
>1 >VIEW >EMP_VW
>2 >PROCEDURE >ADD_EMP
>1 >PROCEDURE >QUERY_EMP
What dependencies does this show (*hoose three.)
(*hoose all correct answers)
':(RC6(!# is directly dependent on (!#$8C((& (*)
A556(!# is directly dependent on (!#$8C((&
A556(!# is directly dependent on (!#6<W (*)
':(RC6(!# is directly dependent on A556(!#
(!#6<W is directly dependent on (!#$8C((& (*)
,ncorrect. Refer to &ection "A $esson ".
1!. /he ,5(#/R(( view shows dependencies by indenting the lines of output instead
of by using a .(&/(56$(<($ colu+n. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
11. #rocedure get6depts has been +arked invalid because one of the ob0ects it
references has been altered. Which of the following state+ents are true (*hoose
two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
/he procedure will be reco+piled auto+atically the ne)t ti+e it is invoked.
/he reco+pilation will always be successful.
/he procedure will be reco+piled auto+atically the ne)t ti+e it is invoked.
/he reco+pilation +ay or +ay not be successful.
(*)
/he procedure can be reco+piled +anually by2
A$/(R #R8*(5:R( get6depts *8!#,$(;
(*)
/he procedure can be reco+piled +anually by2
A$/(R #R8*(5:R( get6depts R(*8!#,$(;
/he procedure does not need to be reco+piled.
*orrect
12. A procedure includes the following code2
&($(*/ first6na+e, salary ,./8 v6first6na+e, v6salary
1R8! e+ployees W=(R( e+ployee6id ? "44;
Which of the following changes to the e+ployees table will allow the procedure to
be reco+piled successfully (*hoose two.)
!ark for
Review
(") #oints
(*hoose all correct answers)
/he table is dropped but a public table e)ists with the sa+e na+e and
structure. (*)
/he table is dropped.
A new colu+n is added to the table. (*)
/he table na+e is changed to newe+ps.
/he first6na+e colu+n is dropped fro+ the table.
*orrect
13. Which of the following will .8/ help to +ini+i3e dependency failures (*hoose
two.) !ark for
Review
(") #oints
(*hoose all correct answers)
&($(*/ing a list of colu+n na+es instead of using &($(*/ * (*)
5eclaring records using the ER8W/C#( attribute
,ncluding a colu+n list with ,.&(R/ state+ents
5eclaring scalar variables with .8/ .:$$ if the corresponding table colu+n
has a .8/ .:$$ constraint (*)
5eclaring scalar variables using the E/C#( attribute
*orrect
14. #ackage e+p6pack contains two public procedures2 get6e+ps and upd6e+ps. A
separate procedure e+p6proc invokes e+p.pack.get6e+ps. /he upd6e+ps
package body code is now altered, and the package body (but not the package
specification) is recreated.
e+p6proc will be +arked invalid and needs to be reco+piled. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
Test: )n#erstan#ing 3e.ote ,epen#encies: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. A re+ote dependency is when a dependent ob0ect resides on a database on a
separate node. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. With re+ote dependencies, one +aster data dictionary that resides on one server
identifies the status of all sche+a ob0ects. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. /he 5ata 5ictionary controls the re+ote dependency +ode. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
4. Which state+ent for setting a database para+eter is the default for re+ote
dependency checking !ark for
Review
(") #oints
A$/(R &(&&,8. &(/ R(!8/(65(#(.5(.*,(&6!85( ? /,!(&/A!#
(*)
A$/(R &(&&,8. &(/ R(!8/(65(#(.5(.*,(&6!85( ? &,9.A/:R(
A$/(R &(&&,8. R(!8/(65(#(.5(.*,(&6!85( ? /,!(&/A!#
A$/(R &(&&,8. R(!8/(65(#(.5(.*,(&6!85( ? &,9.A/:R(
*orrect
5. ,n this scenario, the following status is given for each procedure2
H #rocedure A is local and has a ti+e sta+p of "4 A!
H #rocedure - is re+ote and has a local ti+e sta+p of @ A! and has a re+ote ti+e
sta+p of A A!
,n /i+esta+p !ode, #rocedure A will e)ecute successfully at "" A!. /rue or
1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
6. ,n &ignature !ode, a procedure will not co+pile if the signatures of the re+ote
dependencies do not +atch. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
7. ,n this scenario, the following status is given for each procedure2
H #rocedure A is local, e)ecuted, and invalidated because the re+ote #rocedure -
ti+e sta+p does not +atch the local ti+e sta+p for #rocedure -
H #rocedure A is reco+piled.
,n /i+esta+p !ode, now #rocedure A will e)ecute successfully. /rue or 1alse
!ark for
Review
(") #oints
/rue (*)
1alse
*orrect
8. ,n &ignature !ode, a co+piled procedure is still valid if its dependent procedure
has a para+eter data type change fro+ .:!-(R to <AR*=AR>. !ark for
Review
(") #oints
/rue
1alse (*)
,ncorrect. Refer to &ection "A $esson >.
. A re+ote dependency is when a dependent ob0ect resides on a database on a
separate node. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
1!. With re+ote dependencies, one +aster data dictionary that resides on one server
identifies the status of all sche+a ob0ects. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
11. /he 5ata 5ictionary controls the re+ote dependency +ode. /rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
12. Which state+ent for setting a database para+eter is the default for re+ote
dependency checking !ark for
Review
(") #oints
A$/(R &(&&,8. &(/ R(!8/(65(#(.5(.*,(&6!85( ? /,!(&/A!#
(*)
A$/(R &(&&,8. &(/ R(!8/(65(#(.5(.*,(&6!85( ? &,9.A/:R(
A$/(R &(&&,8. R(!8/(65(#(.5(.*,(&6!85( ? /,!(&/A!#
A$/(R &(&&,8. R(!8/(65(#(.5(.*,(&6!85( ? &,9.A/:R(
*orrect
13. ,n this scenario, the following status is given for each procedure2
H #rocedure A is local and has a ti+e sta+p of "4 A!
H #rocedure - is re+ote and has a local ti+e sta+p of @ A! and has a re+ote ti+e
sta+p of A A!
!ark for
Review
(") #oints
,n /i+esta+p !ode, #rocedure A will e)ecute successfully at "" A!. /rue or
1alse
/rue
1alse (*)
*orrect
14. ,n &ignature !ode, a procedure will not co+pile if the signatures of the re+ote
dependencies do not +atch. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
15. ,n this scenario, the following status is given for each procedure2
H #rocedure A is local, e)ecuted, and invalidated because the re+ote #rocedure -
ti+e sta+p does not +atch the local ti+e sta+p for #rocedure -
H #rocedure A is reco+piled.
,n /i+esta+p !ode, now #rocedure A will e)ecute successfully. /rue or 1alse
!ark for
Review
(") #oints
/rue (*)
1alse
,ncorrect. Refer to &ection "A $esson >.
16. ,n &ignature !ode, a co+piled procedure is still valid if its dependent procedure
has a para+eter data type change fro+ .:!-(R to <AR*=AR>. !ark for
Review
(") #oints
/rue
1alse (*)
,ncorrect. Refer to &ection "A $esson >.
Test: )sing t4e P/1SQ/ 0nitia(ization Para.eters: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. /o set the #$&'$6*85(6/C#( to its fastest e)ecution speed, which co++and do
you use !ark for
Review
(") #oints
A$/(R &C&/(! &(/ #$&'$6*85(6/C#(?.A/,<(;
A$/(R &C&/(! &(/ #$&'$6*85(6/C#(?>;
A$/(R &(&&,8. &(/ #$&'$6*85(6/C#( ? .A/,<(; (*)
A$/(R &(&&,8. &(/ #$&'$6*85(6/C#( ? ,./(R#R(/(5;
A$/(R &(&&,8. &(/ #$&'$6*85(6/C#( ? >;
*orrect
2. #$&'$6*85(6/C#( deter+ines the type of code for both #$%&'$ code and for
&'$ state+ents, which is what speeds up the e)ecution speed. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. Which are .8/ e)a+ples of benefits of using #$&'$68#/,!,M(6$(<($. (*hoose
two) !ark for
Review
(") #oints
(*hoose all correct answers)
*ontrol what #$%&'$ does with useless code
*o+bining co+piled code fro+ one subprogra+ into another subprogra+
&eparating co+piled code so that separate units +ay be repeated as needed
(*)
-ackward co+patible with previous versions of the 8racle database
!odify source code to opti+i3e frequentlyHused ele+ents at the top (*)
*orrect
4. When setting #$&'$68#/,!,M(6$(<($ ? >, the co+piled code will re+ove code
and e)ceptions that can never be e)ecuted. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
5. Which data dictionary view allows you to see the setting for
#$&'$68#/,!,M(6$(<($ !ark for
Review
(") #oints
:&(R6#$&'$68-L(*/&
:&(R6#$&'$68#/,!,M(
:&(R6#$&'$68-L(*/6&(//,.9& (*)
:&(R68-L(*/6&(//,.9&
:&(R6#$&'$6*85(6/C#(
*orrect
6. What are the valid values for #$&'$68#/,!,M(6$(<($ in the data dictionary
!ark for
Review
(") #oints
4,",>,B (*)
4,",>,B,A
",>,B
",>,B,A
*orrect
Test: ,isp(a-ing Co.pi(er 5arning Messages: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. An error in #$%&'$ is when the co+piler does not proceed successfully and an error
+essage is displayed. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. A warning in #$%&'$ is the sa+e as an error in #$%&'$, but can only be viewed
through the :&(R6(RR8R& data dictionary view. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. Which #$%&'$ warning +essage identifies code that can cause une)pected
behavior or wrong results when e)ecuted !ark for
Review
(") #oints
,.18R!A/,8.A$
#(R18R!A.*(
A$$
&(<(R( (*)
(RR8R
*orrect
4. /he infor+ational warning level for #$%&'$ co+piled code identifies the code that
+ay cause e)ecution speed to be slow. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
5. /he two state+ents below are equivalent. /rue or 1alse
5-!&6WAR.,.9.A556WAR.,.96&(//,.96*A/
(D,.18R!A/,8.A$D,D(.A-$(D,D&(&&,8.D);
!ark for
Review
(") #oints
and
A$/(R &(&&,8.
&(/ #$&'$6WAR.,.9& ? D(.A-$(2,.18R!A/,8.A$D;
/rue (*)
1alse
*orrect
6. Which pair of 5-!&6WAR.,.9 co++ands would allow you to obtain the current
settings and change and restore those settings in a #$%&'$ subprogra+ (*hoose
two)
!ark for
Review
(") #oints
(*hoose all correct answers)
5-!&6WAR.,.9.&(/6WAR.,.96&(//,.96&/R,.9 (*)
5-!&6WAR.,.9.A556WAR.,.96&(//,.96*A/
5-!&6WAR.,.9.9(/6WAR.,.96&(//,.96&/R,.9 (*)
5-!&6WAR.,.9.9(/6WAR.,.96&/R,.9
*orrect
Test: )sing Con#itiona( Co.pi(ation: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. *onditional co+pilation allows you to include e)tra code to help with debugging,
which can be re+oved once errors are resolved. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. Cou can choose which code to include in a #$%&'$ progra+ based on conditional
co+pilation directives. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
3. ,dentify the selection directives used in conditional co+pilation.
!ark for
Review
(") #oints
P,1
P/=(.
P($&(
P(.5
P**1$A9
PP,1
PP/=(.
PP($&(
PP($&,1
PP(.5
P,1
P/=(.
P($&( P($&,1
P(.5,1
P,1
P/=(.
P($&(
P($&,1
P(.5
(*)
PP,1
PP/=(.
PP($&(
PP(.5
PP5(-:9
*orrect
4. ,nquiry directives are used to selectively include or e)clude #$%&'$ code based on
values of preHdefined variables that are set using the #$&'$6**1$A9& para+eter.
/rue or 1alse
!ark for
Review
(") #oints
/rue
1alse (*)
*orrect
5. /he value of 5-!&65-6<(R&,8..<(R6$(6"" is /R:( when the version of the
8racle database is version "" or greater. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
6. ,f the version and release of the 8racle database in use is "4.>, what state+ent will
allow synta) available in version "4.> or later !ark for
Review
(") #oints
P,1 5-!&65-6<(R&,8..<(R6$(6"46> P/=(.
HH so+e +essaage
P($&(
HH so+e action
P(.5
P,1 5-!&65-6<(R&,8..<(R6$(6"46> P/=(.
HH so+e +essaage
P($&(
HH so+e action
P(.5;
P,1 5-!&65-6<(R&,8..<(R6$(6"46" P/=(.
HH so+e +essaage
P($&(
HH so+e action
P(.5
(*)
P,1 5-!&65-6<(R&,8..<(R6$(6"46" P/=(.
HH so+e +essaage
P($&(
HH so+e action
P(.5;
*orrect
Test: 6i#ing 7our Source Co#e: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. 8ne benefit of obfuscation is to protect intellectual property written in #$%&'$. /rue
or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
2. 8bfuscation allows the owner to see the source code, but not the users to who+
(G(*:/( privileges have been granted. /rue or 1alse !ark for
Review
(") #oints
/rue
1alse (*)
*orrect
3. When wrapping subprogra+s, the entire #$%&'$ code +ust be included as an ,.
argu+ent with data type <AR*=AR> up to B>,QRQ characters. /rue or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect
4. /o obfuscate the procedure +y6proc, what state+ent should be at $ine A
-(9,.
HH $ine A
(D*R(A/( 8R R(#$A*( #R8*(5:R( +ycleverproc
(p6para+" ,. .:!-(R, p6para+> 8:/ .:!-(R)
,& -(9,.
... %* so+e clever but private code here *%
(.5 +ycleverproc;D);
(.5;
!ark for
Review
(") #oints
5-!&65!$.*R(A/(6WRA#
5-!&655$.*R(A/(6WRA#
5-!&655$.*R(A/(6WRA##(5 (*)
5-!&655$.WRA##(5
5-!&655$.WRA#6*85(
*orrect
5. /o create obfuscated code using the wrapper utility, deter+ine the order in which to
e)ecute the following steps.
A *onnect to the database and e)ecute the wrapped te)t file as a script to co+pile
the wrapped code into the 5ata 5ictionary.
- $og into the database server co+puter.
* *reate a te)t file containing your co+plete unwrapped source code.
5 ()ecute WRA# to create a second te)t file containing the wrapped code.
!ark for
Review
(") #oints
A,-,*,5
-,*,5,A (*)
*,5,A,-
*,A,-,5
-,5,*,A
*orrect
6. 1or #$%&'$ code larger than B>,QRQ characters, you +ust use the wrap utility. /rue
or 1alse !ark for
Review
(") #oints
/rue (*)
1alse
*orrect

You might also like