Test:Semester2MidTermExam 1. Whe When na aus user ers ses essi sion onc cha hang nges est the hev val alue ueo of fa apa pack ckag age eva vari riab able le, ,th the ene new wva va luecanim luecanimmedia mediately telybese beseenby enbyothe otherses rsessions sions.Tru .Trueor eorFalse False? ? MarkforR MarkforReview eview (1)Points True False(*)
Correct 2. Pac Packa kage geC CUR URSP SPAC ACK Kde decl clar ares esa ag glo loba bal lcu curs rsor ori in nth the epa pack ckag ag especification.Thepackagecontainsthreepublicprocedures:OPENPROC especification.Thepackagecontainsthreepu blicprocedures:OPENPROCopensth opensth ecursor;FETCHPROCfetches5rowsfromthecu ecursor;FETCHPROCfe tches5rowsfromthecursor'sactiveset;CLOSEP rsor'sactiveset;CLOSEPROCclose ROCclose sthecursor. Whatwillhappenwhenausersessionexecutes Whatwillhappenwhen ausersessionexecutesthefollowingcommandsin thefollowingcommandsintheorde theorde rshown? curspack.openproc;--line1 curspack.fetchproc;--line2 curspack.fetchproc;--line3 curspack.openproc;--line4 curspack.fetchproc;--line5 curspack.closeproc;--line6 MarkforReview (1)Points Thefirst15rowswillbefetched. Thefirst10rowswillbefetched,thenthefi Thefirst10rowswill befetched,thenthefirst5rowswillbefetche rst5rowswillbefetched d again. Thefirst5rowswillbefetchedthreetimes. Anerrorwilloccuratline2. Anerrorwilloccuratline4.(*)
Correct 3. An AnOr Orac acle led dir irec ecto tory ryc cal alle led dFI FILE LESD SDIR IRh has asb bee een ncr crea eate ted dby by executing: CREATEORREPLACEDIRECTORYfilesdirAS'C:\NEWFILES'; Whichofthefollowingwillcreateanewtext Whichofthefollowing willcreateanewtextfilecalledC:\NEWFILES\E filecalledC:\NEWFILES\EMP_REPORT MP_REPORT .TXT? .TXT? MarkforR MarkforReview eview (1)Points
UTL_FILE.CREATE('FILESDIR','EMP_REPORT.TXT'); UTL_FILE.FOPEN('C:\NEWFILES\EMP_REPORT.TXT','w'); UTL_FILE.FOPEN('FILESDIR','EMP_REPORT.TXT','w');(*) UTL_FILE.OPEN('FILESDIR','EMP_REPORT.TXT','c');
Correct 4. eUT eUTL_ L_FI FILE LEp pac acka kage ge? ? (1)Points
Whi Which cho of fth the efo foll llow owin ing gbe best std des escr crib ibes est the hep pur urpo pose seo of fth th Mark Markf for orR Rev evie iew w
Itisusedtoloadbinaryfilessuchasemploy Itisusedtoloadbin aryfilessuchasemployees'photosintothedata ees'photosintothedatab b ase. Itisusedtoreadandwritetextfilesstored Itisusedtoreadand writetextfilesstoredoutsidethedatabase.(* outsidethedatabase.(*) ) Itisusedtofindouthowmuchfreespaceis Itisusedtofindout howmuchfreespaceisleftonanoperatingsyst leftonanoperatingsyste e mdisk. ItisusedtoqueryCHARandVARCHAR2columnsintables.
Correct 5. The TheU UTL TL_F _FIL ILE Epa pack ckag age eca can nbe beu use sed dto toc cre reat ate ebi bina nary ryf fil iles es suchasJ suchasJPEGs PEGsaswe aswellas llastext textfile files.Tr s.Trueor ueorFals False? e? MarkforR MarkforReview eview (1)Points True False(*)
Correct 6. The TheD DBM BMS_ S_OU OUTP TPUT UT.P .PUT UTp pro roce cedu dure rep pla lace ces ste text xti in na abu buff ffer erb b utdoesnotdisplaythecontentsofthebuffer utdoesnotdisplayth econtentsofthebuffer.TrueorFalse? .TrueorFalse? MarkforReview (1)Points
True(*) False
Correct
Section10 (Answerallquestionsinthissection) 7. E x a m i n e th e f o l l o w i n g p a c k a g e c o d e : CREATEORREPLACEPACKAGEol_packIS PROCEDUREsubprog(p1INVARCHAR2,p2INNUMBER); PROCEDUREsubprog(param1INCHAR,param2INNUMBER); FUNCTIONsubprog(param1INVARCHAR2,para FUNCTIONsubprog( param1INVARCHAR2,param2INNUMBER)RETURNDATE m2INNUMBER)RETURNDATE; ; ENDol_pack; Whichofthefollowingcallswillbesuccessful?(Choosetwo.) MarkforReview (1)Points (Chooseallcorrectanswers) ol_pack.subprog('Jane',30); ol_pack.subprog(param1=>'Jane',param2=>30);(*) v_number:=ol_pack.subprog(p1=>'Jane'); v_date:=ol_pack.subprog('Jane',30);(*)
Incorrect.RefertoSection10Lesson3. 8. Fun Funct ctio ions nsc cal alle led dfr from oma aS SQL QLq que uery ryo or rDM DML Lst stat atem emen ent tmu must st notendthecurrenttransaction,orcreateor notendthecurrentt ransaction,orcreateorrollbacktoasavepoint rollbacktoasavepoint.Trueor .Trueor False? MarkforReview (1)Points True(*) False
Correct
9. Ap Apub ubli lic cfu func ncti tion oni in na apa pack ckag age eis isi inv nvok oked edf fro rom mwi with thin ina a SQLstatement.Thefunction'scodecaninclud SQLstatement.Thefu nction'scodecanincludeaCOMMITstatement.Tru eaCOMMITstatement.TrueorFals eorFals e? M a r k f o r R e v i ew (1)Points True False(*)
Correct 10. 10. Pac Packa kage geH HRP RPAC ACK Kco cont ntai ains nst the hef fol ollo lowi wing ngp pub ubli lic cfu func ncti tion on: : FUNCTIONempfunc(p_deptnoNUMBER)RETURNNUMBERIS BEGIN UPDATEemployeesSETsalary=salary*1.1 WHEREdepartment_id=p_deptno; RETURNSQL%ROWCOUNT; ENDempfunc; WhatwillhappenwhenthefollowingSQLstatementisexecuted? SELECTdepartment_name,hrpack.empfunc(department_id) FROMdepartments; MarkforReview (1)Points TheSELECTwillfailbecauseyoucannotreturnSQL%ROWCOUNTfromapack TheSELECTwillfailbecauseyoucannotreturn SQL%ROWCOUNTfromapacka a gedfunction. TheSELECTwillfailbecauseyoucannotcallp TheSELECTwillfailb ecauseyoucannotcallpackagedfunctionsfromwi ackagedfunctionsfromwit t hinaSQLstatement. TheSELECTwillfailbecauseyoucannotexecuteaDMLstatementfromwi TheSELECTwillfailbecauseyoucannotexecut eaDMLstatementfromwit t hinaquery. TheSELECTwillsucceedbecauseitisreferencingadifferenttablefro TheSELECTwillsucceedbecauseitisreferenc ingadifferenttablefrom m thefunction.(*)
Correct 11. Thef Thefoll ollowi owing ngexa exampl mples eshow howsa sava valid lidre recor cordd ddata ataty type peand andva varia riable ble.T .True rue orFalse? TYPEDeptRecTyp ISRECORD(deptidNUMBER(4)NOTNULL:=99, dnamedepartments.department_name%TYPE, locdepartments.location_id%TYPE,
regionregions%ROWTYPE); dept_recDeptRecTyp; MarkforReview (1)Points True(*) False
Correct 12. 12. In Ina apa pack ckag age, e,p pub ubli lic cco comp mpon onen ents tsa are red dec ecla lare red din int the hes spe pe cifica cificatio tionb nbut utpri privat vatec ecomp ompone onents ntsar aren enot. ot.Tr True ueor orFal False? se? Markf Markfor orRev Review iew (1)Points True(*) False
Correct 13. 13. Whi Which cho of fth the efo foll llow owin ing gwi will lld dis ispl play ayt the hed det etai aile led dco code deo o fthesubprogramsinpackageDEPTPACKinyourschema? fthesubprogramsinpackageDEPTPACKinyour schema? MarkforReview (1)Points SELECTtextFROMUSER_SOURCE WHEREname='DEPTPACK' ANDtype='PACKAGE' ORDERBYline; SELECTtextFROMUSER_SOURCE WHEREname='DEPTPACK' ANDtype='PACKAGEBODY' ORDERBYline; (*)
SELECTtextFROMUSER_SOURCE WHEREobject_name='DEPTPACK' ANDobject_type='PACKAGEBODY' ORDERBYline; SELECTtextFROMUSER_SOURCE WHEREname='DEPTPACK' ANDtype='BODY' ORDERBYline;
Correct 14. 14. You Your rsc sche hema mac con onta tain ins sfo four urp pac acka kage ges, s,e eac ach hha havi ving nga as spe peci ci ficationandabody.Youhavealsobeengrantedprivilegestoaccessth ficationandabody.Youhavealsobeengrante dprivilegestoaccessthreepacka reepacka ges(andtheirbodies)inotherusers'schemas ges(andtheirbodies) inotherusers'schemas.Whatwillbedisplayed .Whatwillbedisplayedbythefo bythefo llowingquery? SELECTCOUNT(*)FROMALL_OBJECTS WHEREobject_typeLIKE'PACK%' ANDowner<>USER; MarkforReview (1)Points 14 7 3 6(*) 0
Correct 15. 15. Pac Packa kage geO OLD LDPA PACK CKi is sin iny you our rsc sche hema ma. .Wh What atw wil ill lha happ ppen enw whe he nthefollowingstatementisexecuted? DROPPACKAGEoldpack; MarkforReview (1)Points Thebodywillbedroppedbutthespecification Thebodywillbedropp edbutthespecificationwillberetained. willberetained. Thespecificationwillbedroppedbutthebody Thespecificationwill bedroppedbutthebodywillberetained. willberetained. Boththespecificationandthebodywillbedropped.(*) Thestatementwillfailbecauseyoumustdrop Thestatementwillfai lbecauseyoumustdropthebodybeforeyoucand thebodybeforeyoucandr r opthespecification.
Correct
16. 16. Exa Exami mine net the hef fol ollo lowi wing ngp pac acka kage ges spe peci cifi fica cati tion on: : CREATEORREPLACEPACKAGEtaxpackIS CURSORempcursISSELECT*FROMemployees; PROCEDUREtaxproc; ENDmypack; ThepackagebodyofTAXPACKalsoincludesafunctioncalledTAXFUNC.Wh ThepackagebodyofTAXPACKalsoincludesafu nctioncalledTAXFUNC.Whichoneo ichoneo fthefollowingstatementsisNOTtrue? MarkforReview (1)Points Theprocedurecanbeinvokedby: BEGIN taxpack.taxproc; END;
Thepackaagewillnotcompilebecauseyoucannotdeclareacursorinth Thepackaagewillnotcompilebecauseyoucann otdeclareacursorinthe e specification. (*)
TAXPROCisapublicprocedureandTAXFUNCisaprivatefunction TAXPROCcaninvokeTAXFUNCifTAXPROCiscodedbeforeTAXFUNC TAXPROCcanopenthecursor
Correct 17. 17. Whi Which cho of fth the efo foll llow owin ing gst stat atem emen ents tsa abo bout utp pac acka kage ges sis isN NOT OT true? MarkforReview (1)Points Allproceduresandfunctionsmustbedeclared Allproceduresandfun ctionsmustbedeclaredinthespecification.(*) inthespecification.(*) Cursorscanbedeclaredinthespecification. Thebodycontainsthedetailedcodeofthesubprograms. Variablescanbedeclaredinthebody. Thespecificationmustbecreatedbeforethebody.
Correct 18. 18. Eve Every rys sub ubpr prog ogra ram mwh whic ich hha has sbe been end dec ecla lare red din ina ap pac acka kage ges s pecificationmustalsobeincludedinthepackagebody.TriueorFalse? pecificationmustalsobeincludedinthepack agebody.TriueorFalse? Markfor Review (1)Points True(*) False
Correct 19. 19. Pac Packa kage geM MYP YPAC ACK Kco cont ntai ains nsp pro roce cedu dure reM MYP YPRO ROC. C.Y You ouc can ans see eew w hichparametersMYPROCusesbyexecuting:DESCRIBEmypack.myproc.True hichparametersMYPROCusesbyexecuting:DESC RIBEmypack.myproc.TrueorFalse? orFalse? MarkforReview (1)Points True False(*)
Correct 20. 20. Wha What tis isw wro rong ngw wit ith hth the efo foll llow owin ing gsy synt ntax axf for orc cre reat atin ing ga a packagespecification? CREATEORREPLACEPACKAGEmypackIS g_constant1NUMBER(6):=100; FUNCTIONfunc1(p_param1INVARCHAR2); FUNCTIONfunc2; ENDmypack; MarkforReview (1)Points Youcannotdeclareconstantsinthespecification. Apackagemustcontainatleastoneprocedure. TheRETURNdatatypeofthefunctionsmustbespecified. (*)
Thefirstlineshouldbe: CREATEORREPLACEPACKAGESPECIFICATIONmypackIS
Nothingiswrong,thiscodecontainsnoerrors.
Correct 21. Thef Thefoll ollowi owing ngpro proced cedure uread adds dsac acolu olumn mnof ofdat dataty atype peDAT DATEt Etot othe heEMP EMPLOY LOYEES EES table.Thenameofthenewcolumnispassedt table.Thenameofth enewcolumnispassedtotheprocedureasapara otheprocedureasaparameter. meter. CREATEORREPLACEPROCEDUREaddcol (p_col_nameINVARCHAR2)IS v_first_stringVARCHAR2(100):='ALTERTAB v_first_stringVAR CHAR2(100):='ALTERTABLEEMPLOYEESADD('; LEEMPLOYEESADD('; v_second_stringVARCHAR2(6):='DATE)'; BEGIN ...LineA END; Whichofthefollowingwillworkcorrectlywhe Whichofthefollowing willworkcorrectlywhencodedatlineA?(Choos ncodedatlineA?(Choosetwo.) etwo.) MarkforReview (1)Points (Chooseallcorrectanswers) v_first_string||p_col_name||v_second_string; EXECUTEIMMEDIATEv_first_string||p_col_name EXECUTEIMMEDIATEv_fi rst_string||p_col_name||v_second_string; ||v_second_string; (*)
EXECUTEIMMEDIATE'v_first_string'||p_col_na EXECUTEIMMEDIATE'v_f irst_string'||p_col_name||'v_second_string'; me||'v_second_string'; v_first_string:=v_first_string||p_col_name; EXECUTEIMMEDIATEv_first_string||v_second_string; (*)
EXECUTEv_first_string||p_col_name||v_second_string;
Correct 22. 22. You Youw wan ant tto toc cre reat ate ea afu func ncti tion onw whi hich chd dro rops psa at tab able le. .Yo You u writethefollowingcode: CREATEORREPLACEFUNCTIONdroptab (p_tab_nameINVARCHAR2) RETURNBOOLEANIS BEGIN DROPTABLEp_tab_name; RETURNTRUE; EXCEPTION WHENOTHERSTHENRETURNFALSE;
END; Whywillthisprocedurenotcompilesuccessfully? MarkforReview (1)Points Becauseyoucanneverdropatablefrominsideafunction BecausethePL/SQLcompilercannotcheckiftheargumentofp_tab_name BecausethePL/SQLcompilercannotcheckifth eargumentofp_tab_namei i savalidtable-name(*) Becauseyoudonothavetheprivilegeneededtodropatable BecauseyoucannotuseRETURNintheexceptionsection
Correct 23. 23. Whi Which cho of fth the efo foll llow owin ing gSQ SQL Lst stat atem emen ents tsc can anb be ein incl clud uded edi i naPL naPL/SQ /SQLb Lbloc locko konly nlyby byus using ingDy Dynam namic icSQL SQL?( ?(Cho Choose osetw two.) o.) Markf Markfor orRev Review iew (1)Points (Chooseallcorrectanswers) DELETE SAVEPOINT ALTER(*) SELECT.....FORUPDATENOWAIT GRANT(*)
Correct 24 .
Na m e t w o r e a s o n s f o r u s i n g D yn a m i c S QL .
M a rk f or
Review (1)Points (Chooseallcorrectanswers) ProvidetheabilitytoexecuteSQLstatementswhosestructureisunknow ProvidetheabilitytoexecuteSQLstatements whosestructureisunknown n untilexecutiontime.(*)
Providetheabilitytohandlemutatingrowswhenexecutingastatement Providetheabilitytohandlemutatingrowswh enexecutingastatementi i nvolvingthesametable. AllowfetchofdataforDMLstatements. Enablessession-controlstatementstobewritt Enablessession-contro lstatementstobewrittenandexecutedfromPL/S enandexecutedfromPL/SQ Q L.(*)
Correct 25. 25. Wha What tdo does est the heR RET ETUR URNI NING NGc cla laus use edo doi in nth the eex exam ampl ple ebe belo low? w? CREATEORREPLACEPROCEDUREnew_dept (p_dept_nameINdepartments.name%TYPE)IS v_new_dept_iddepartments.dept_id%TYPE; BEGIN INSERTINTOdepartments(dept_id,name) VALUESdept_seq.NEXTVAL,p_dept_name RETURNINGdept_seq.CURRVALINTOv_new_dept_id; DBMS_OUTPUT.PUT_LINE(p_dept_name||'isdepa DBMS_OUTPUT.PUT_LINE (p_dept_name||'isdepartmentnumber'||v_new_ rtmentnumber'||v_new_dept_id); dept_id); ENDnew_dept; MarkforReview (1)Points Insertsthenewdepartmentidinthedepartmenttable. PerformstheSELECTstatementtodeterminethedepartmentidofthenew PerformstheSELECTstatementtodeterminethe departmentidofthenew department.(*) Usesthenewdepartmentnumberinacursor.
Incorrect.RefertoSection12Lesson2. 26. 26.
Wha What tis ist the hec cor orre rect cts syn ynta tax xto tou use set the heR RET ETUR URNI NING NGp phr hras ase e
atPositionA? DECLARE TYPEEmpRecISRECORD(last_nameemployees.las TYPEEmpRecISRECORD (last_nameemployees.last_name%TYPE,salaryemplo t_name%TYPE,salaryemployees.sala yees.sala ry%TYPE); emp_infoEmpRec; emp_idNUMBER:=100; BEGIN UPDATEemployeesSETsalary=salary*1.1W UPDATEemployeesSET salary=salary*1.1WHEREemployee_id=emp_id HEREemployee_id=emp_id--Posit --Posit ionA dbms_output.put_line('Justgavearaiseto' dbms_output.put_line ('Justgavearaiseto'||emp_info.last_name|| ||emp_info.last_name||',whon ',whon owmakes'||emp_info.salary); END; MarkforReview
(1)Points RETURNINGFROMemp_info; last_name,salaryRETURNINGINTOemp_info; RETURNINGlast_name,salaryINTOemp_info;(*) RETURNINGlast_name,salaryTOemp_info;
Incorrect.RefertoSection12Lesson2. 27. 27. Det Deter ermi mini nist stic icm mea eans nst the hef fun unct ctio ion nwi will lla alw lway ays sre retu turn rnt the he sameoutputreturnvalueforanygivensetof sameoutputreturnva lueforanygivensetofinputargumentvalues.T inputargumentvalues.TrueorFa rueorFa lse? lse? Mark Markf for orR Rev evie iew w (1)Points True(*) False
Incorrect.RefertoSection12Lesson2. 28. 28. You Youw wan ant tto tot tak ake ema make kea ac cop opy yof ofa all llt the hec cit itie ies sin int the hew w orldlistedinthecitiestable,whichcontain orldlistedinthecit iestable,whichcontainsmillionsofrows.Thef smillionsofrows.Thefollowing ollowing procedureaccomplishthisefficiently.TrueorFalse? CREATEORREPLACEPROCEDUREcopy_citiesIS TYPEt_citiesISTABLEOFcities%ROWTYPEIND TYPEt_citiesISTAB LEOFcities%ROWTYPEINDEXBYBINARY_INTEGER; EXBYBINARY_INTEGER; v_citiestabt_emp; BEGIN SELECT*BULKCOLLECTINTOv_citiestabFROMcities; FORALLiINv_citiestab.FIRST..v_citiestab.LAST INSERTINTOnew_citiesVALUESv_citiestab(i); ENDcopy_cities; MarkforReview (1)Points True(*) False
Correct
Section13 (Answerallquestionsinthissection) 29. 29. You Youc can anu use sea at tri rigg gger ert to opr prev even ent tro rows wsf fro rom mbe bein ing gde dele lete te dfromthe dfromtheEMPL EMPLOYEES OYEEStabl tableon eonMonda Mondays.T ys.Trueo rueorFal rFalse? se? MarkforR MarkforReview eview (1)Points True(*) False
Correct 30. 30. Whi Which cho of fth the efo foll llow owin ing gbe best std des escr crib ibes esa ad dat atab abas ase etr trig igge ge r? M a r k f o r R e v i ew (1)Points Asubprogramthatcheckswhetherauserhastypedthecorrectpassword Asubprogramthatcheckswhetherauserhasty pedthecorrectpasswordt t ologontothedatabase. APL/SQLsubprogramthatexecutesautomaticallywheneveranassociated APL/SQLsubprogramthatexecutesautomaticall ywheneveranassociatedd d atabaseeventoccurs.(*) APL/SQLsubprogramthatalwaysreturnsexactlyonevalue. Asubprogramthatisinvokedexplicitlybythe Asubprogramthatisi nvokedexplicitlybythecallingapplication. callingapplication. APL/SQLsubprogramthatinsertsrowsintoaloggingtable.
Correct 31. What Whattyp typeo eofd fdata atabas baseo eobje bject ctwou would ldyou youcr creat eatet etow owrit ritea eana naudi uditin tingr greco eco rdautomat rdautomaticall icallyeve yeveryti rytimea meauser userconne connectst ctstothe othedata database? base? MarkforR MarkforReview eview (1)Points Aprocedure Acomplexview Atrigger(*) Afunction
Apackage
Correct 32. 32. At Atri rigg gger erc can anb be ecr crea eate ted din int the hed dat atab abas ase eor orw wit ithi hin nan ana a ppli pplica cati tion on. .Tr True ueo or rFa Fals lse? e? Mark Markf for orR Rev evie iew w (1)Points True(*) False
Correct 33. 33. Whi Which cho of fth the efo foll llow owin ing gar are ego good odg gui uide deli line nes sto tof fol ollo low wwh wh encreatin encreatingad gadataba atabasetr setrigger igger?(Ch ?(Choose oosetwo.) two.) MarkforR MarkforReview eview (1)Points (Chooseallcorrectanswers) Wherepossible,useatriggertoenforceafor Wherepossible,usea triggertoenforceaforeignkeyconstraint. eignkeyconstraint. Usetriggerstooverrideprivilegecheckingan Usetriggerstooverri deprivilegecheckingandviewotherusers'priva dviewotherusers'privat t etables. DonotuseatriggertoreplaceorduplicatesomethingwhichtheOracle Donotuseatriggertoreplaceorduplicates omethingwhichtheOracle Serverdoesautomatically.(*) Usetriggerstopreventunauthorizedusersfro Usetriggerstopreven tunauthorizedusersfromSELECTingconfidential mSELECTingconfidentiald d ata. Donotcreateatriggerthatautomaticallyfir Donotcreateatrigge rthatautomaticallyfiresanothertrigger.(*) esanothertrigger.(*)
Correct 34. 34. rbody.Tr rbody.Trueor ueorFals False? e? (1)Points True
You Youc can anc cod ode eCO COMM MMIT ITa and ndR ROL OLLB LBAC ACK Kst stat atem emen ents tsi in na atr trig igge ge MarkforR MarkforReview eview
False(*)
Correct
ge r b o d y ? (1)Points
35. 35. Whi Which chd dic icti tion onar ary yvi view ews sho hows wst the hed det etai aile led dco code deo of fa atr trig ig Ma r k fo r Re v i ew
USER_SOURCE USER_TRIGGERS(*) USER_OBJECTS USER_DML_TRIGGERS USER_SUBPROGRAMS
Correct 36. 36.
Use User rAY AYSE SEGU GUL Lsu succ cces essf sful ully lyc cre reat ates est the hef fol ollo lowi wing ngt tri rigg gger er
: CREATETRIGGERloc_trigg BEFOREUPDATEONaysegul.locations BEGIN.... AYSEGULnowtriestodroptheLOCATIONStable.Whathappens? MarkforReview (1)Points Anerrormessageisdisplayedbecauseyoucannotdropatablethatisa Anerrormessageisdisplayedbecauseyoucann otdropatablethatisas s sociatedwithatrigger. Thetableisdroppedandthetriggerisdisabled. Thetriggerisdroppedbutthetableisnotdropped. Boththetableandthetriggeraredropped.(*) Noneoftheabove.
Correct 37. 37. Whi Which cho of fth the efo foll llow owin ing gwi will llr rem emov ove ea atr trig igge ger rin iny you our rsc sc hemanamedEMP_TRIGGfromthedatabase? MarkforReview hemanamedEMP_TRIGGfromthedatabase? (1)Points DROPemp_triggTRIGGER; ALTERTRIGGERemp_triggDISABLE; DROPTRIGGERemp_trigg;(*) REMOVETRIGGERemp_trigg; Noneoftheabove
Correct 38. 38. Atr Atrig igge ger rau auto toma mati tica call lly yin inse sert rts sa aro row win into toa al log oggi ging ngt tab ab leeverytimeauser'ssessionreceivesthiserrormessage: ORA-00942:tableorviewdoesnotexist Whatkindoftriggeristhis? MarkforReview (1)Points Arowtrigger Astatementtrigger Adatabaseeventtrigger(*) ADDLtrigger AnAFTERtrigger
Correct 39 . E x a m i n e th i s c o d e : CREATETRIGGERde_trigg --LineA
BEGIN... WhichofthefollowingareNOTvalidatLineA?(Choosetwo.) MarkforReview (1)Points (Chooseallcorrectanswers) AFTERLOGOFFONSCHEMA(*) AFTERLOGONONSCHEMA BEFORELOGOFFONSCHEMA BEFOREDISCONNECTONSCHEMA(*) AFTERSERVERERRORONSCHEMA
Correct 40 . E x a m i n e th i s c o d e : CREATETRIGGERnew_trigg AFTERCREATEONreserved_word BEGIN... Whichofthefollowingcanbeusedinplaceof Whichofthefollowing canbeusedinplaceofreserved_word?(Chooset reserved_word?(Choosetwo.) wo.) MarkforReview (1)Points (Chooseallcorrectanswers) TABLE SCHEMA(*) USER DATABASE(*) TABLEemployees
Correct
41. Exam Examin ine eth the ef follo ollowi wing ngc cod ode: e: CREATETRIGGERemp_trigg AFTERUPDATEOFsalaryONemployees FOREACHROW DECLARE v_countNUMBER; BEGIN --LineA END; WhichofthefollowingstatementsisNOTallowedatLineA? MarkforReview (1)Points SELECTcount(*)INTOv_countFROMdepartments; UPDATEemployeesSETjob_id='IT_PROG'WHERE UPDATEemployeesSETj ob_id='IT_PROG'WHEREemployee_id=:OLD.employ employee_id=:OLD.employe e e_id; SELECTcount(*)INTOv_countFROMemployees;(*) DBMS_OUTPUT.PUT_LINE('Asalarywasupdated'); None.Alloftheaboveareallowed.
Correct 42. 42. Wha What tis isw wro rong ngw wit ith hth the efo foll llow owin ing gco code de? ? CREATETRIGGERdept_trigg BEFOREUPDATEOFdepartment_nameONdepartments BEGIN DBMS_OUTPUT.PUT_LINE(:NEW.department_name); END; MarkforReview (1)Points Youcannotuse:NEWinaBEFOREtrigger,only Youcannotuse:NEWin aBEFOREtrigger,onlyinanAFTERtrigger. inanAFTERtrigger. Youcannotuse:NEWor:OLDinastatementtrigger.(*) YoucannotuseDBMS_OUTPUT.PUT_LINEinsideatrigger. Thesecondlineshouldbe: BEFOREUPDATEONdepartments.department_name
Correct 43. 43. You Youn nee eed dto toc cre reat ate ea atr trig igge ger rth that atw wil ill lfi fire rew whe hene neve ver ran an employee'ssalaryorjob_idisupdated,butn employee'ssalaryor job_idisupdated,butnotwhenanyothercolumn otwhenanyothercolumnoftheEM oftheEM PLOYEEStableisupdated.Whichofthefollowi PLOYEEStableisupdat ed.Whichofthefollowingisthecorrectsyntax ngisthecorrectsyntaxtodothi todothi s? Ma r k f o r R e v i ew (1)Points CREATETRIGGERemp_upd_trigg AFTERUPDATEONemployees(salary,job_id) BEGIN... CREATETRIGGERemp_upd_trigg AFTERUPDATEOFsalary,job_idONemployees BEGIN... (*)
CREATETRIGGERemp_upd_trigg AFTERUPDATEOF(salary,job_id)ONemployees BEGIN... CREATETRIGGERemp_upd_trigg AFTERUPDATEOFsalaryORjob_idONemployees BEGIN...
Correct 44. 44. The There rea are ref fiv ive eem empl ploy oyee ees sin ind dep epar artm tmen ent t50 50. .Th The efo foll llow owin in gtriggeriscreated: CREATETRIGGERupd_emp AFTERUPDATEONemployees BEGIN INSERTINTOaudit_tableVALUES(USER,SYSDATE); END; Ausernowexecutes: UPDATEemployeesSETsalary=salary*1.1 WHEREdepartment_id=50; Howmanyrowswillbeinsertedintoaudit_table? MarkforReview (1)Points One(*) Two
Five Six Noneoftheabove
Correct 45. 45. AD ADML MLs sta tate teme ment ntt tri rigg gger erf fir ires eso onl nly yon once cef for ore eac ach htr trig igge ge ringDMLstatement,whilearowtriggerfiresonceforeachrowprocess ringDMLstatement,whilearowtriggerfires onceforeachrowprocessedbythe edbythe triggerin triggeringsta gstatemen tement.Tr t.Trueor ueorFals False? e? MarkforR MarkforReview eview (1)Points True(*) False
Correct 46. 46. Exa Exami mine net the hef fol ollo lowi wing ngc cod ode. e.T To ocr crea eate tea ar row owt tri rigg gger er, ,wh wh atcodeshouldbeincludedatLineA? CREATETRIGGERdept_trigg AFTERUPDATEORDELETEONdepartments --LineA BEGIN... MarkforReview (1)Points AFTEREACHROW FOREVERYROW FOREACHROW(*) ONEACHROW ONEVERYROW
Correct 47. 47.
Exa Exami mine net the hef fol ollo lowi wing ngt tri rigg gger er. .It Its sho houl uld dra rais ise ean ana app ppli li
cationerrorifausertriestoupdateanemployee'slastname.Itshou cationerrorifausertriestoupdateanempl oyee'slastname.Itshouldallow ldallow updatestoallothercolumnsoftheEMPLOYEES updatestoallotherc olumnsoftheEMPLOYEEStable.Whatshouldbecod table.Whatshouldbecodedatlin edatlin eA? CREATETRIGGERstop_ln_trigg BEFOREUPDATEONemployees BEGIN --LineA RAISE_APPLICATION_ERROR(-20201,'Updatingl RAISE_APPLICATION_ ERROR(-20201,'Updatinglastnamenotallowed'); astnamenotallowed'); ENDIF; END; MarkforReview (1)Points IFUPDATINGLAST_NAMETHEN IFUPDATING('LAST_NAME')THEN(*) IFUPDATE('LAST_NAME')THEN IFUPDATINGTHEN
Correct 48. 48.
Wha What tis isw wro rong ngw wit ith hth the efo foll llow owin ing gco code dee exa xamp mple lef for ora ac com om
poundtrigger? CREATEORREPLACETRIGGERlog_emps FORUPDATEOFsalaryONemployees COMPOUNDTRIGGER TYPEt_log_empISTABLEOFlog_table%ROWTYPE INDEXBYBINARY_INTEGER; log_emp_tabt_log_emp; AFTEREACHROWIS BEGIN --someaction ENDAFTEREACHROW; AFTERSTATEMENTIS BEGIN --someaction ENDAFTERSTATEMENT; ENDlog_emps; MarkforReview (1)Points Theorderofthetimingstatementsisreversed.(*) ThedeclarationsectionismissingtheDECLAREkeyword. ThetriggeringeventFORUPDATEisnotallowed.
TheCOMPOUNDTRIGGERstatementismissingIS. Thereisnothingwrongwiththisexample.
Incorrect.RefertoSection13Lesson3. 49. 49. INS INSTE TEAD ADO OF Ftr trig igge gers rsa are rea alw lway ays sro row wtr trig igge gers rs, ,ev even eni if fFO FO REACHROW REACHROWiso isomitte mitted.Tr d.Trueor ueorFals False? e? MarkforR MarkforReview eview (1)Points True(*) False
Correct 50 . I n t he f ol l o wi n g c o d e: CREATETRIGGERmytrigg INSTEADOFINSERTORUPDATEONmy_object_name FOREACHROW BEGIN... my_object_namecanbethenameofatable.TrueorFalse? MarkforReview (1)Points True False(*)
C o r r ec t