Vous êtes sur la page 1sur 25

Test: Indexing Tables of Records: Quiz

1. To declare an INDEX BY table, we must first declare a type and then declare a collection variable of that type. Tru

2. "hich of the followin# methods can be used to reference elements of an INDEX BY table! $%hoose three.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

3. "hich of the followin# successfully declares an INDEX BY table of records which could be used to store copies of complete rows from the departments table!

'ar( for )eview $*& +oints

4. "hat is the lar#est number of elements $i.e., records& that an INDEX BY table of records can contain!

'ar( for )eview $*& +oints

5. "hich of these +,-./, data structures could store a complete copy of the employees table, i.e., 01 complete table rows!

'ar( for )eview $*& +oints

6. "hich of these +,-./, data structures can N2T store a collection!

'ar( for )eview $*& +oints

Section 7
Test: Handling xce!tions: Quiz

"ection 1 $3nswer all 4uestions in this section& 1. "hich of the followin# is N2T an advanta#e of includin# an e5ception handler in a +,-./, bloc(! 'ar( for )eview $*& +oints

2. "hich of the followin# best describes a +,-./, e5ception!

'ar( for )eview $*& +oints

3. "hich of these e5ceptions can be handled by an EX%E+TI2N section in a +,-./, bloc(!

'ar( for )eview $*& +oints

4. 2nly one e5ception at a time can be raised durin# one e5ecution of a +,-./, bloc(. True or alse!

'ar( for )eview $*& +oints

5. "hich of the followin# EX%E+TI2N sections is constructed correctly! $%hoose three.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

6. The followin# EX%E+TI2N section is constructed correctly. True or alse! EX%E+TI2N "6EN 7E)28DI9IDE 2) T228'3NY8)2". 2) N28D3T38 2:ND T6EN statement_1; statement_2; "6EN 2T6E). T6EN statement_3; END;

'ar( for )eview $*& +oints

#. "hich of the followin# are N2T #ood practice #uidelines for e5ception handlin#! $%hoose two.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

$. E5amine the followin# code. "hy does this e5ception handler not follow #ood practice #uidelines! $%hoose two.& DE%,3)E v8dept8name departments.department8name<TY+E; BE=IN .E,E%T department8name INT2 v8dept8name )2' departments "6E)E department8id > ?@; EX%E+TI2N "6EN 2T6E). T6EN DB'.82:T+:T.+:T8,INE$A3 select returned more than one rowA&; END; $%hoose all correct answers&

'ar( for )eview $*& +oints

Test: Tra!!ing %racle "er&er xce!tions: Quiz

1. "hich of the followin# is N2T a predefined 2racle .erver error!

'ar( for )eview $*& +oints

2. "hich of the followin# best describes a predefined 2racle .erver error!

'ar( for )eview $*& +oints

3. "hich (ind of error can N2T be handled by +,-./,!

'ar( for )eview $*& +oints

4. E5amine the followin# code. 3t ,ine 3, you want to raise an e5ception if the employeeAs mana#er8id is null. "hat (ind of e5ception is this! DE%,3)E v8m#r8id employees.mana#er8id<TY+E; BE=IN .E,E%T mana#er8id INT2 v8m#r8id )2' employees "6E)E employee8id > *11; I v8m#r8id I. N:,, T6EN BB ,ine 3 END I ; ...

'ar( for )eview $*& +oints

5. 6ow would you trap 2racle .erver e5ception 2)3B1*C1DE no data found!

'ar( for )eview $*& +oints

6. No employees e5ist whose salary is less than 0111. "hich e5ception handlers would successfully trap the e5ception that will be raised when the followin# code is e5ecuted! $%hoose two.& DE%,3)E v8mynum N:'BE) E> *1; v8count N:'BE); BE=IN .E,E%T %2:NT$F& INT2 v8count )2' employees "6E)E salary G 0111; v8mynum E> v8mynum - v8count; EX%E+TI2N ... END; $%hoose all correct answers&

'ar( for )eview $*& +oints

#. "hat is the correct synta5 to associate an e5ception named EX%E+N3'E with the nonBpredefined 2racle .erver error 2)3B100H0!

'ar( for )eview $*& +oints

$. 3n 2)3B*C11 e5ception is raised if an attempt is made to insert a null value into a N2T N:,, column. DE+3)T'ENT8ID is the primary (ey of the DE+3)T'ENT. table. "hat will happen when the followin# code is e5ecuted! DE%,3)E e8not8null EX%E+TI2N; BE=IN +)3='3 EX%E+TI2N8INIT$e8not8null, B*C11&; IN.E)T INT2 departments $department8id, department8name& 93,:E.$null, A'ar(etin#A&; EX%E+TI2N "6EN e8not8null T6EN DB'.82:T+:T.+:T8,INE$A%annot be nullA&; END;

'ar( for )eview $*& +oints

'. E5amine the followin# code. The :+D3TE statement will raise an 2)3B 100H* e5ception. BE=IN :+D3TE employees .ET department8id > C@; EX%E+TI2N "6EN 2T6E). T6EN IN.E)T INT2 error8lo#8table 93,:E. $./,%2DE&; END; "hat will happen when this code is e5ecuted!

'ar( for )eview $*& +oints

1(. "hich type of e5ception ':.T be e5plicitly raised by the +,-./, pro#rammer!

'ar( for )eview $*& +oints

11. 3 +,-./, bloc( e5ecutes and an 2racle .erver e5ception is raised. "hich of the followin# contains the te5t messa#e associated with the e5ception!

'ar( for )eview $*& +oints

12. "hich one of the followin# events would implicitly raise an e5ception!

'ar( for )eview $*& +oints

Test: Tra!!ing )ser*+efined xce!tions: Quiz

1. "hat is a userB defined e5ception!

'ar( for )eview $*& +oints

2. "hat is the datatype of a userBdefined e5ception!

'ar( for )eview $*& +oints

3. "hat is wron# with the followin# code! BE=IN :+D3TE employees .ET salary > 01111 "6E)E Iob8id > A%,E)JA; I ./,<)2"%2:NT > 1 T6EN )3I.E N28D3T38 2:ND; BB ,ine 3 END I ; EX%E+TI2N "6EN N28D3T38 2:ND T6EN DB'.82:T+:T.+:T8,INE$ANo employee was updatedA&; END;

'ar( for )eview $*& +oints

4. "hat will be displayed when the followin# code is e5ecuted! DE%,3)E

'ar( for )eview

e8mye5cep EX%E+TI2N; BE=IN DB'.82:T+:T.+:T8,INE$A'essa#e *A&; )3I.E e8mye5cep; DB'.82:T+:T.+:T8,INE$A'essa#e 0A&; EX%E+TI2N "6EN e8mye5cep T6EN DB'.82:T+:T.+:T8,INE$A'essa#e DA&; )3I.E e8mye5cep; DB'.82:T+:T.+:T8,INE$A'essa#e CA&; END;

$*& +oints

5. The followin# line of code is correct. True or alse! )3I.E83++,I%3TI2N8E))2)$B0*11*,A'y error messa#eA&;

'ar( for )eview $*& +oints

6. 6ow are userBdefined e5ceptions raised !

'ar( for )eview $*& +oints

#. The followin# three steps must be performed to use a userBdefined e5ceptionE B )aise the e5ception B 6andle the e5ception B Declare the e5ception In what se4uence must these steps be performed!

'ar( for )eview $*& +oints

$. You want to display your own error messa#e to the user. "hat is the correct synta5 to do this!

'ar( for )eview $*& +oints

Test: Recognizing t,e "co!e of xce!tions: Quiz

1. +redefined 2racle .erver e5ceptions such as N28D3T38 2:N D can be raised automatically in inner bloc(s and handled in outer bloc(s. True or alse!

'ar( for )eview $*& +oints

2. NonBpredefined 2racle .erver errors $associated with 2racle error numbers by +)3='3 EX%E+TI2N8INIT& can be declared and raised in inner bloc(s and handled in outer bloc(s. True or alse!

'ar( for )eview $*& +oints

3. "hat will happen when the followin# code is e5ecuted! DE%,3)E e8outer8e5cep EX%E+TI2N; BE=IN DE%,3)E e8inner8e5cep EX%E+TI2N; BE=IN )3I.E e8outer8e5cep; END; EX%E+TI2N "6EN e8outer8e5cep T6EN DB'.82:T+:T.+:T8,INE$A2uter raisedA&; "6EN e8inner8e5cep T6EN DB'.82:T+:T.+:T8,INE$AInner raisedA&; END;

'ar( for )eview $*& +oints

4. "hat will happen when the followin# code is e5ecuted! DE%,3)E e8e5cep* EX%E+TI2N; e8e5cep0 EX%E+TI2N; BE=IN )3I.E e8e5cep*; EX%E+TI2N "6EN e8e5cep* T6EN BE=IN )3I.E e8e5cep0; END; END;

'ar( for )eview $*& +oints

5. There are three employees in department H1. "hat will be displayed when this code is e5ecuted! DE%,3)E v8last8name employees.last8name<TY+E; BE=IN DB'.82:T+:T.+:T8,INE$A'essa#e *A&; BE=IN .E,E%T last8name INT2 v8last8name )2' employees "6E)E department8id > H1; DB'.82:T+:T.+:T8,INE$A'essa#e 0A&; END; DB'.82:T+:T.+:T8,INE$A'essa#e DA&; EX%E+TI2N "6EN 2T6E). T6EN DB'.82:T+:T.+:T8,INE$A'essa#e CA&; END;

'ar( for )eview $*& +oints

6. "hat will be displayed when the followin# code is e5ecuted! GGouterKK DE%,3)E v8myvar N:'BE); BE=IN v8myvar E> 0@; DE%,3)E v8myvar N:'BE) E> *11; BE=IN outer.v8myvar E> D1; v8myvar E> v8myvar - 1; outer.v8myvar E> D@; END; v8myvar E> C1; EX%E+TI2N "6EN 7E)28DI9IDE T6EN DB'.82:T+:T.+:T8,INE$v8myvar&; END;

'ar( for )eview $*& +oints

Section 8
Test: -reating .rocedures: Quiz

1. "hich of the followin# are characteristics of anonymous +,-./, bloc(s but not +,-./, subpro#rams! $%hoose three.& $%hoose all correct answers&

'ar( for )eview $*& +oints

2. .ubpro#rams and anonymous bloc(s can be called by other applications. True or alse!

'ar( for )eview $*& +oints

3. "hich of the followin# are benefits of usin# +,-./, subpro#rams rather than anonymous bloc(s! $%hoose three.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

4. +,-./, subpro#rams, unli(e anonymous bloc(s, are compiled each time they are e5ecuted. True or alse!

'ar( for )eview $*& +oints

5. +rocedures are #enerally used to perform what!

'ar( for )eview $*& +oints

6. 3 pro#rammer wants to create a +,-./, procedure named 'Y8+)2%. "hat will happen when the followin# code is e5ecuted! %)E3TE 2) )E+,3%E +)2%ED:)E my8proc I. v8empid employees.empid<TY+E; BE=IN .E,E%T employee8id INT2 v8empid )2' employees "6E)E re#ion8id > HHH; DB'.82:T+:T.+:T8,INE$AThe salary isE A LL v8salary&;

'ar( for )eview $*& +oints

#. "hich of the followin# (eywords ':.T be included in every +,-./, procedure definition! $%hoose two.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

$. 3 stored +,-./, procedure can be invo(ed from which of the followin#! A. 3 +,-./, anonymous bloc(

'ar( for )eview $*& +oints

B. 3 callin# application C. 3 .E,E%T statement D. 3nother +,-./, procedure

'. 3 stored procedure add8dept may be invo(ed by the followin# command in 3pplication E5press. True or alse! BE=IN add8dept; END;

'ar( for )eview $*& +oints

1(. The followin# are the steps involved in creatin#, and later modifyin# and reBcreatin#, a +,-./, procedure in 3pplication E5press. "hich step is missin#!

'ar( for )eview $*& +oints

1. 2. 3. 4. 5.

Type the procedure code in the ./, %ommands window %lic( on the M.aveM button and save the procedure code )etrieve the saved code from M.aved ./,M in ./, %ommands 'odify the code in the ./, %ommands window E5ecute the code to reBcreate the procedure

11. "hen modifyin# procedure code, the procedure code statement must be reBe5ecuted to validate and store it in the database. True or alse!

'ar( for )eview $*& +oints

12. 3 nested subpro#ram can be called from the main procedure or from the callin# environment. True or alse!

'ar( for )eview $*& +oints

13. "hy will the followin# procedure fail! %)E3TE 2) )E+,3%E +)2%ED:)E mainproc ... I. +)2%ED:)E subproc $...& I. BE=IN ... BE=IN ... subproc $...&; ... END;

'ar( for )eview $*& +oints

Test: )sing .ara/eters in .rocedures: Quiz

1. "hich of the followin# best describes the difference between a parameter and an ar#ument!

'ar( for )eview $*& +oints

2. "hat is the correct synta5 to create procedure 'Y+)2% that accepts two number parameters X and Y!

'ar( for )eview $*& +oints

3. "hich of the followin# can be used as an ar#ument for a procedure parameter!

'ar( for )eview $*& +oints

4. 3 procedure has been created asE %)E3TE +)2%ED:)E myproc $p8left N:'BE), p8ri#ht N:'BE)& I. BE=IN .... You want to call the procedure from an anonymous bloc(. "hich of the followin# calls is valid!

'ar( for )eview $*& +oints

5. "hat is the purpose of usin# parameters with stored procedures!

'ar( for )eview $*& +oints

6. +rocedure .:B+)2% was created asE %)E3TE +)2%ED:)E subproc $p8param 93)%63)0& I. BE=IN ... You invo(e the procedure byE DE%,3)E v8param 93)%63)0$01& E> A.mithA; BE=IN subproc$v8param&; END; "hich of the followin# is the actual parameter!

'ar( for )eview $*& +oints

#. "hich one of the followin# statements about formal and actual parameters is true!

'ar( for )eview $*& +oints

$. +rocedure TE.T+)2% accepts one parameter +*, whose value is up to *111 characters in len#th. "hich one of the followin# declares this parameter correctly!

'ar( for )eview $*& +oints

'. You want to create a procedure which accepts a sin#le parameter. The parameter is a number with a ma5imum value of HHHH.HH. "hich of the followin# is a valid declaration for this parameter!

'ar( for )eview $*& +oints

Test: .assing .ara/eters: Quiz

1. "hat are the three parameter modes for procedures!

'ar( for )eview $*& +oints

2. If you donAt specify a mode for a parameter, what is the default mode!

'ar( for )eview $*& +oints

3. "hich of the followin# statements about IN 2:T parameters are true! $%hoose two.&

'ar( for )eview $*& +oints

$%hoose all correct answers&

4. "hen creatin# a procedure, where in the code must the parameters be listed!

'ar( for )eview $*& +oints

5. 3 procedure is invo(ed by this commandE myproc$A.mithA,*11,@111&; "hat is the method of passin# parameters used here!

'ar( for )eview $*& +oints

6. 3 procedure is invo(ed by this commandE myproc$A.mithA,salary>K@111&; "hat is the method of passin# parameters used here!

'ar( for )eview $*& +oints

#. "hich (ind of parameters cannot have a DE 3:,T value!

'ar( for )eview $*& +oints

$. The followin# procedure has been createdE %)E3TE 2) )E+,3%E +)2%ED:)E myproc $p8p* N:'BE), p8p0 93)%63)0& I. BE=IN ... "hich one of the followin# calls to the procedure will N2T wor(!

'ar( for )eview $*& +oints

'. Three IN parameters for procedure 3DD8E'+,2YEE are defined asE $p8name 93)%63)0 , p8salary N:'BE) E> *111, p8hired D3TE DE 3:,T .Y.D3TE& The procedure is invo(ed byE add8employee$ANonesA&; "hat is the value of +8.3,3)Y when the procedure starts to e5ecute!

'ar( for )eview $*& +oints

1(. "hat will happen when the followin# procedure is called as format8phone $O11@@@*0DC&! %)E3TE 2) )E+,3%E +)2%ED:)E format8phone $p8phone8no IN 2:T 93)%63)0& I. BE=IN p8phone8no E> .:B.T)$p8phone8no,*,D& LL A.A LL .:B.T)$p8phone8no,C,D& LL A.A LL .:B.T)$p8phone8no,?&; END format8phone;

'ar( for )eview $*& +oints

11. +rocedure N:'+)2% has been created asE %)E3TE +)2%ED:)E numproc $5 N:'BE), y N:'BE) E> *11, P N:'BE)& I. BE=IN .... You want to call the procedure, passin# ar#uments of *1 for X and 01 for 7. "hich one of the followin# calls is correct!

'ar( for )eview $*& +oints

Vous aimerez peut-être aussi