Advertisement
Guest User

bananaking

a guest
Oct 31st, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.05 KB | None | 0 0
  1. 1. A programmer creates a PL/SQL subprogram which is compiled and
  2. stored in the database. Two separate users then execute an application
  3. which invokes this subprogram four times. How many times must the
  4. subprogram be recompiled? Mark for Review
  5. (1) Points
  6. Twice
  7. Four times
  8. None (*)
  9. Eight times
  10. Once
  11. Correct
  12. 2. Which of the following are benefits of using PL/SQL
  13. subprograms rather than anonymous blocks? (Choose three.) Mark for
  14. Review
  15. (1) Points
  16. (Choose all correct answers)
  17. Easier to write
  18. Better data security (*)
  19. Easier code maintenance (*)
  20. Faster performance (*)
  21. Do not need to declare variables
  22. Correct
  23. 3. A programmer wants to create a PL/SQL procedure named
  24. EMP_PROC. What will happen when the following code is executed?
  25. CREATE OR REPLACE PROCEDURE emp_proc IS
  26. v_salary employees.salary%TYPE;
  27. BEGIN
  28. SELECT salary INTO v_salary FROM employees
  29. WHERE employee_id = 999;
  30. DBMS_OUTPUT.PUT_LINE('The salary is: ' || v_salary);
  31. END;
  32. Mark for Review
  33. (1) Points
  34. The statement will raise a NO_DATA_FOUND
  35. exception because employee_id 999 does not exist.The statement will fail because the last line
  36. of code should be END emp_proc;
  37. The statement will fail because you cannot
  38. declare variables such as v_salary inside a procedure.
  39. The procedure will be created successfully.
  40. (*)
  41. The statement will fail because the procedure
  42. does not have any parameters.
  43. Correct
  44. 4. Which of the following are characteristics of PL/SQL
  45. stored procedures? (Choose three.) Mark for Review
  46. (1) Points
  47. (Choose all correct answers)
  48. They are named PL/SQL blocks (*)
  49. They must return exactly one value to the
  50. calling environment.
  51. They can have an exception section. (*)
  52. They can be invoked from inside a SQL
  53. statement.
  54. They can accept parameters. (*)
  55. Incorrect. Refer to Section 7.
  56. 5. The following are the steps involved in creating, and
  57. later modifying and re-creating, a PL/SQL procedure in Application
  58. Express. In what sequence should these steps be performed?
  59. Retrieve the saved code from "Saved SQL" in SQL Commands
  60. Execute the code to create the procedure
  61. Execute the code to re-create the procedure
  62. Click on the "Save" button and save the procedure code
  63. Modify the code in the SQL Commands window
  64. Type the procedure code in the SQL Commands window Mark for Review
  65. (1) Points
  66. F,C,A,B,E,D
  67. F,B,D,A,E,C (*)
  68. E,D,F,C,A,B
  69. F,B,D,E,A,CF,B,C,D,E,A
  70. Incorrect. Refer to Section 7.6.
  71. A PL/SQL procedure named MYPROC has already been created and stored
  72. in the database. Which of the following will successfully re-create the
  73. procedure after some changes have been made to the code? Mark for
  74. Review
  75. (1) Points
  76. CREATE PROCEDURE myproc IS ...
  77. CREATE OR REPLACE PROCEDURE myproc IS ....
  78. (*)
  79. UPDATE PROCEDURE myproc IS ...
  80. ALTER PROCEDURE myproc IS ...
  81. None of the above, because the procedure must
  82. be dropped before it can be re-created.
  83. Incorrect. Refer to Section 7.
  84. 7. The following procedure has been created:
  85. CREATE OR REPLACE PROCEDURE myproc
  86. (A IN NUMBER := 20,
  87. B IN NUMBER,
  88. C IN NUMBER DEFAULT 30)
  89. IS .....
  90. Which of the following will invoke the procedure correctly? Mark for
  91. Review
  92. (1) Points
  93. myproc(40);
  94. myproc(10, B => 30, 50);
  95. myproc(C => 25);
  96. All of the above
  97. None of the above (*)
  98. Incorrect. Refer to Section 7.
  99. 8. Suppose you set up a parameter with an explicit IN mode.
  100. What is true about that parameter? Mark for Review
  101. (1) Points
  102. It must have a DEFAULT value.
  103. It cannot have a DEFAULT value.It acts like a constant (its value cannot be
  104. changed inside the subprogram). (*)
  105. It must be the same type as the matching OUT
  106. parameter.
  107. It inherits its type from the matching OUT
  108. parameter.
  109. Correct
  110. 9. Procedure SOMEPROC has five parameters named A, B, C, D,
  111. E in that order. The procedure was called as follows:
  112. SOMEPROC(10,20,D=>50);
  113. How was parameter D referenced? Mark for Review
  114. (1) Points
  115. Positionally
  116. Named (*)
  117. A combination of positionally and named
  118. A combination of named and defaulted
  119. Defaulted
  120. Correct
  121. 10. Procedure SOMEPROC has five parameters named A, B, C, D,
  122. E in that order. The procedure was called as follows:
  123. SOMEPROC(10,20,D=>50);
  124. How was parameter B referenced? Mark for Review
  125. (1) Points
  126. Positional (*)
  127. Named
  128. A combination of positionally and named
  129. A combination of named and defaulted
  130. Defaulted
  131. Correct11. Using nested blocks,
  132. when is it necessary to label the outer block?. Mark for Review
  133. (1) PointsYou must always label the outer block.
  134. You must always label both blocks.
  135. You must label the outer block when two
  136. variables with the same name are declared, one in each block.
  137. You must label the outer block when two
  138. variables with the same name are declared and you need to reference the
  139. outer block's variable within the inner block. (*)
  140. Block labels are just comments and are
  141. therefore recommended but never needed.
  142. Correct
  143. 12. Which of the following will display the value 'Smith'?
  144. Mark for Review
  145. (1) Points
  146. <<outer>>
  147. DECLARE
  148. v_name VARCHAR2(10) := 'Smith';
  149. BEGIN
  150. DECLARE
  151. v_name VARCHAR2(10) := 'Jones';
  152. BEGIN
  153. DBMS_OUTPUT.PUT_LINE(v_name);
  154. END;
  155. END;
  156. <<outer>>
  157. DECLARE
  158. v_name VARCHAR2(10) := 'Smith';
  159. BEGIN
  160. DECLARE
  161. v_name VARCHAR2(10) := 'Jones';
  162. BEGIN
  163. DBMS_OUTPUT.PUT_LINE(<<outer>>.v_name);
  164. END;
  165. END;
  166. <<outer>>
  167. DECLARE
  168. v_name VARCHAR2(10) := 'Smith';
  169. BEGIN
  170. DECLARE
  171. v_name VARCHAR2(10) := 'Jones';
  172. BEGIN
  173. DBMS_OUTPUT.PUT_LINE(outer.v_name);
  174. END;
  175. END; (*)
  176. <<outer>>
  177. DECLARE
  178. v_name VARCHAR2(10) := 'Smith';
  179. BEGIN
  180. <<inner>>
  181. DECLARE
  182. v_name VARCHAR2(10) := 'Jones';
  183. BEGIN
  184. DBMS_OUTPUT.PUT_LINE(v_name);
  185. END;
  186. END;
  187. Correct
  188. 13. The following code will execute correctly. True or
  189. False?
  190. DECLARE
  191. v_myvar1 NUMBER;
  192. BEGIN
  193. DECLARE
  194. v_myvar2 NUMBER;
  195. BEGIN
  196. v_myvar1 := 100;
  197. END;
  198. v_myvar2 := 100; v END; Mark for Review
  199. (1) Points
  200. True
  201. False (*)
  202. Correct
  203. 14. What will happen when the following code is executed?
  204. BEGIN -- outer block
  205. DECLARE -- inner block
  206. CURSOR emp_curs IS SELECT * FROM employees;
  207. v_emp_rec emp_curs%ROWTYPE;
  208. BEGIN
  209. OPEN emp_curs;
  210. LOOP
  211. FETCH emp_curs INTO v_emp_rec;
  212. DBMS_OUTPUT.PUT_LINE(v_emp_rec.salary);
  213. END LOOP;
  214. END;
  215. CLOSE emp_curs;
  216. END; Mark for Review
  217. (1) PointsThe code will fail because you cannot declare
  218. a cursor in an inner block.
  219. The code will fail because the cursor is
  220. declared in the inner block but is referenced in the outer block. (*)
  221. The code will execute successfully and
  222. display all the employees' salaries.
  223. The code will execute forever because there
  224. is no statement to EXIT from the loop.
  225. Correct
  226. 15. What will be displayed when the following code is
  227. executed?
  228. <<outer>>
  229. DECLARE
  230. v_myvar NUMBER;
  231. BEGIN
  232. v_myvar := 10;
  233. DECLARE
  234. v_myvar NUMBER := 200;
  235. BEGIN
  236. outer.v_myvar := 20;
  237. v_myvar := v_myvar / 0; -- this raises a ZERO_DIVIDE error
  238. outer.v_myvar := 30;
  239. END;
  240. v_myvar := 40;
  241. EXCEPTION
  242. WHEN ZERO_DIVIDE THEN
  243. DBMS_OUTPUT.PUT_LINE(v_myvar);
  244. END; Mark for Review
  245. (1) Points
  246. 10
  247. 20 (*)
  248. 30
  249. 40
  250. 200
  251. Incorrect. Refer to Section 6.16.
  252. What will happen when the following code is executed?
  253. DECLARE
  254. e_excep1 EXCEPTION;
  255. e_excep2 EXCEPTION;
  256. BEGIN
  257. RAISE e_excep1;
  258. EXCEPTION WHEN e_excep1 THEN BEGIN
  259. RAISE e_excep2; END;
  260. END; Mark for Review
  261. (1) Points
  262. It will fail to compile because you cannot
  263. have a subblock inside an exception section.
  264. It will fail to compile because e_excep1 is
  265. out of scope in the subblock.
  266. It will fail to compile because you cannot
  267. declare more than one exception in the same block.
  268. It will compile successfully and return an
  269. unhandled e_excep2 to the calling environment. (*)
  270. Correct
  271. 17. Consider the following function:
  272. CREATE FUNCTION ADD_EM
  273. (a NUMBER := 1,
  274. b NUMBER := 2 )
  275. RETURN NUMBER
  276. IS BEGIN
  277. RETURN (a+b);
  278. END ADD_EM;
  279. Which one of the following blocks will NOT work correctly? Mark for
  280. Review
  281. (1) Points
  282. DECLARE
  283. x NUMBER;
  284. BEGIN
  285. x:= add_em(b=4);
  286. END;
  287. (*)
  288. DECLARE
  289. x NUMBER;
  290. BEGIN
  291. x:= add_em(4);
  292. END;
  293. DECLARE
  294. x NUMBER;
  295. BEGIN
  296. x:= add_em(4,5);
  297. END;
  298. DECLARE x NUMBER;
  299. BEGIN
  300. x:= add_em;
  301. END;
  302. None of them will work.
  303. Incorrect. Refer to Section 8.
  304. 18. A function must have at least one IN parameter, and must
  305. return exactly one value. Mark for Review
  306. (1) Points
  307. True
  308. False (*)
  309. Correct
  310. 19. Why will this function not compile correctly?
  311. CREATE FUNCTION bad_one
  312. IS BEGIN
  313. RETURN NULL;
  314. END bad_one; Mark for Review
  315. (1) Points
  316. You cannot RETURN a NULL.
  317. You must declare the type of the RETURN
  318. before the IS. (*)
  319. You must have at least one IN parameter.
  320. You must code CREATE OR REPLACE, not CREATE.
  321. The body of the function must contain at
  322. least one executable statement (as well as RETURN).
  323. Correct
  324. 20. A function named MYFUNC has been created. This function
  325. accepts one IN parameter of datatype VARCHAR2 and returns a NUMBER.
  326. You want to invoke the function within the following anonymous block:
  327. DECLARE
  328. v_var1 NUMBER(6,2);
  329. BEGIN
  330. -- Line A
  331. END; What could be coded at Liine A? Mark for Review
  332. (1) Points
  333. myfunc('Crocodile') := v_var1;
  334. myfunc(v_var1) := 'Crocodile';
  335. myfunc(v_var1, 'Crocodile');
  336. v_var1 := myfunc('Crocodile'); (*)
  337. myfunc('Crocodile', v_var1);
  338. Incorrect. Refer to Section 8.21.
  339. What is wrong with the following code?
  340. CREATE FUNCTION badfunc
  341. (p_param NUMBER(4))
  342. RETURN BOOLEAN
  343. IS BEGIN
  344. RETURN (p_param > 10);
  345. END badfunc; Mark for Review
  346. (1) Points
  347. P_PARAM must be declared AFTER the RETURN
  348. clause.
  349. P_PARAM must have a default value.
  350. The datatype of the IN parameter cannot have
  351. a precision or scale. It must be NUMBER, not NUMBER(4). (*)
  352. RETURN (p_param > 10); is wrong because you
  353. cannot return an expression.
  354. The NUMBER datatype must have a scale as well
  355. as a precision.
  356. Correct
  357. 22. Which of the following is a difference between a
  358. procedure and a function? Mark for Review
  359. (1) Points
  360. Functions cannot be nested; procedures can be
  361. nested to at least 8 levels.
  362. A procedure can have default values for
  363. parameters, while a function cannot.
  364. An explicit cursor can be declared in a
  365. procedure, but not in a function.
  366. A function cannot be used within a SQL
  367. statement; a procedure can be used within SQL.A function must return a value, a procedure
  368. may or may not. (*)
  369. Correct
  370. 23. You want to remove the procedure NO_NEED from your
  371. schema. You execute:
  372. DROP PROCEDURE no_need;
  373. Which Data Dictionary views are updated automatically? Mark for Review
  374. (1) Points
  375. USER_PROCEDURES
  376. USER_OBJECTS
  377. USER_SOURCE
  378. All of the above. (*)
  379. None of the above.
  380. Correct
  381. 24. Examine the following code: CREATE PROCEDURE parent
  382. IS BEGIN
  383. child1;
  384. child2;
  385. EXCEPTION
  386. WHEN NO_DATA_FOUND THEN NULL;
  387. END parent;
  388. Neither CHILD1 nor CHILD2 has an exception handler.
  389. When PARENT is invoked, CHILD1 raises a NO_DATA_FOUND exception. What
  390. happens next? Mark for Review
  391. (1) Points
  392. PARENT handles the exception, then CHILD1
  393. continues to execute.
  394. CHILD1 ends abruptly. PARENT handles the
  395. exception and then ends. CHILD2 does not execute. (*)
  396. CHILD1 ends abruptly, PARENT handles the
  397. exception, then CHILD2 executes.
  398. CHILD1 ends abruptly, PARENT also ends
  399. abruptly and returns an unhandled exception.
  400. PARENT does not compile because you cannot
  401. use NULL; in an exception handler.Correct
  402. 25. The following code shows the dependencies between three
  403. procedures:
  404. CREATE PROCEDURE parent
  405. IS BEGIN
  406. child1;
  407. child2;
  408. END parent;
  409. You now try to execute:
  410. DROP PROCEDURE child2;
  411. What happens? Mark for Review
  412. (1) Points
  413. You cannot drop CHILD2 because PARENT is
  414. dependent on it.
  415. CHILD2 is dropped successfully. PARENT and
  416. CHILD1 are both marked INVALID.
  417. The database automatically drops PARENT as
  418. well.
  419. CHILD2 is dropped successfully. PARENT is
  420. marked INVALID. CHILD1 is still valid. (*)
  421. The database automatically drops CHILD1 as
  422. well.
  423. Incorrect. Refer to Section 8.26.
  424. User BOB creates procedure MYPROC using the default Definer's
  425. Rights. BOB then executes:
  426. GRANT EXECUTE ON bob.myproc TO ted;
  427. When TED invokes BOB.MYPROC, whose privileges are checked? Mark for
  428. Review
  429. (1) Points
  430. TED's privileges
  431. PUBLIC's privileges
  432. SYSTEM's privileges
  433. BOB's privileges (*)
  434. ORACLE's privileges
  435. Incorrect. Refer to Section 8.
  436. 27. How do you specify that you want a procedure MYPROCA to
  437. use "Definer's Rights"? Mark for Review
  438. (1) PointsCREATE OR REPLACE PROCEDURE myproca
  439. AUTHID CURRENT_USER IS...
  440. CREATE OR REPLACE PROCEDURE myproca
  441. AUTHID OWNER IS...
  442. GRANT DEFINER TO myprocA;
  443. ALTER PROCEDURE myproca TO DEFINER;
  444. Definer's Rights are the default, therefore
  445. no extra code or commands are needed. (*)
  446. Correct
  447. 28. You have created procedure MYPROC with a single
  448. parameter PARM1 NUMBER. Now you want to add a second parameter to the
  449. procedure. Which of the following will change the procedure successfully?
  450. Mark for Review
  451. (1) Points
  452. ALTER PROCEDURE myproc ADD (parm2 NUMBER);
  453. The procedure cannot be modified. Once a
  454. procedure has been created, the number of parameters cannot be changed.
  455. CREATE OR REPLACE PROCEDURE someproc
  456. (parm1 NUMBER, parm2 NUMBER);
  457. (You do not need to repeat the detailed code of the procedure, only the
  458. header)
  459. REPLACE PROCEDURE someproc
  460. (parm1 NUMBER, parm2 NUMBER)
  461. IS
  462. BEGIN ...
  463. CREATE OR REPLACE PROCEDURE MYPROC
  464. (parm1 NUMBER, parm2 NUMBER)
  465. IS
  466. BEGIN ... (*)
  467. Incorrect. Refer to Section 7.
  468. 29. Which of the following statements about actual
  469. parameters is NOT true? Mark for Review
  470. (1) Points
  471. An actual parameter is declared in the
  472. calling environment, not in the called procedureAn actual parameter must be the name of a
  473. variable (*)
  474. An actual parameter can have a Boolean
  475. datatype
  476. The datatypes of an actual parameter and its
  477. formal parameter must be compatible
  478. An actual parameter can have a TIMESTAMP
  479. datatype
  480. Incorrect. Refer to Section 7.
  481. 30. A procedure will execute faster if it has at least one
  482. parameter. Mark for Review
  483. (1) Points
  484. True
  485. False (*)
  486. Correct31. Which of the following
  487. is NOT correct coding for a procedure parameter? Mark for Review
  488. (1) Points
  489. (p_param IN VARCHAR2)
  490. (p_param VARCHAR2)
  491. (p_param VARCHAR2(50)) (*)
  492. (p_param employees.last_name%TYPE)
  493. (p_param IN OUT VARCHAR2)
  494. Correct
  495. 32. You want to create a procedure named SOMEPROC which
  496. accepts a single parameter named SOMEPARM. The parameter can be up to 100
  497. characters long. Which of the following is correct syntax to do this?
  498. Mark for Review
  499. (1) Points
  500. CREATE PROCEDURE someproc
  501. (someparm varchar2)
  502. IS
  503. BEGIN ...
  504. (*)
  505. CREATE PROCEDURE someproc
  506. (someparm varchar2(100) )IS
  507. BEGIN...
  508. CREATE PROCEDURE someproc
  509. IS
  510. (someparm VARCHAR2)
  511. BEGIN...
  512. CREATE PROCEDURE someproc
  513. someparm varchar2(100);
  514. IS
  515. BEGIN...
  516. CREATE PROCEDURE someproc
  517. (someparm 100)
  518. IS
  519. BEGIN ...
  520. Correct
  521. 33. Which of the following best describes how an IN
  522. parameter affects a procedure? Mark for Review
  523. (1) Points
  524. It describes the order in which the
  525. procedure's statements should be executed.
  526. It describes which parts of the procedure's
  527. code are optional or conditional.
  528. It makes the procedure execute faster.
  529. It passes a value into the procedure when the
  530. procedure is invoked. (*)
  531. It allows complex calculations to be executed
  532. inside the procedure.
  533. Incorrect. Refer to Section 7.
  534. 34. Examine the following code fragment. At Line A, you want
  535. to raise an exception if the fetched salary value is greater than 30000.
  536. How can you do this?
  537. DECLARE
  538. v_salary employees.salary%TYPE;
  539. BEGIN
  540. SELECT salary INTO v_salary FROM employees
  541. WHERE employee_id = 100;
  542. IF v_salary > 30000 THEN
  543. -- Line A
  544. END IF;
  545. ... Mark for Review (1) Points
  546. Test for WHEN VALUE_TOO_HIGH in the exception
  547. section.
  548. Use RAISE_APPLICATION_ERROR to raise an
  549. exception explicitly. (*)
  550. Test for WHEN OTHERS in the exception
  551. section, because WHEN OTHERS traps all exceptions.
  552. Define an EXCEPTION variable and associate it
  553. with an Oracle Server error number using PRAGMA EXCEPTION_INIT.
  554. Incorrect. Refer to Section 6.
  555. 35. An attempt to insert a null value into a NOT NULL table
  556. column raises an ORA-01400 exception. How can you code an exception
  557. handler to trap this exception? Mark for Review
  558. (1) Points
  559. Test for WHEN ORA-1400 in the exception
  560. section.
  561. Declare a variable e_null_excep of type
  562. EXCEPTION, associate it with ORA-01400 using a PRAGMA directive, and test
  563. for WHEN e_null_excep in the exception section. (*)
  564. Declare a variable e_null_excep of type
  565. VARCHAR2, associate it with ORA-01400 using a PRAGMA directive, and test
  566. for WHEN e_null_excep in the exception section.
  567. Declare a variable as follows: e_null_excep
  568. EXCEPTION := -01400; Then test for WHEN e_null_excep in the exception
  569. section.
  570. Incorrect. Refer to Section 6.36.
  571. Examine the followiing code. Which exception handlers would
  572. successfully trap the exception which will be raised when this code is
  573. executed? (Choose two.)
  574. DECLARE
  575. CURSOR emp_curs IS SELECT * FROM employees;
  576. v_emp_rec emp_curs%ROWTYPE;
  577. BEGIN
  578. FETCH emp_curs INTO v_emp_rec;
  579. OPEN emp_curs;
  580. CLOSE emp_curs;
  581. EXCEPTION ...
  582. END; Mark for Review
  583. (1) Points
  584. (Choose all correct answers)
  585. WHEN CURSOR_NOT_OPENWHEN INVALID_CURSOR (*)
  586. WHEN OTHERS (*)
  587. WHEN NO_DATA_FOUND
  588. WHEN INVALID_FETCH
  589. Correct
  590. 37. Which of these exceptions would need to be raised
  591. explicitly by the PL/SQL programmer? Mark for Review
  592. (1) Points
  593. OTHERS
  594. A SELECT statement returns more than one row.
  595. A check constraint is violated.
  596. A SQL UPDATE statement does not update any
  597. rows. (*)
  598. A row is FETCHed from a cursor while the
  599. cursor is closed.
  600. Correct
  601. 38. How can you retrieve the error code and error message of
  602. any Oracle Server exception? Mark for Review
  603. (1) Points
  604. By using the functions SQLCODE and SQLERRM
  605. (*)
  606. By using the functions SQLCODE and SQLERR
  607. By using RAISE_APPLICATION_ERROR
  608. By defining an EXCEPTION variable and using
  609. PRAGMA EXCEPTION_INIT
  610. Correct
  611. 39. Examine the following code. What message or messages
  612. will be displayed when this code is executed?
  613. DECLARE
  614. v_last_name employees.last_name%TYPE;
  615. v_number NUMBER := 27;
  616. BEGIN v_number := v_number / 0;
  617. SELECT last_name INTO v_last_name FROM employees
  618. WHERE employee_id = 999;
  619. EXCEPTION
  620. WHEN NO_DATA_FOUND THEN
  621. DBMS_OUTPUT.PUT_LINE('No rows were found');
  622. WHEN ZERO_DIVIDE THEN
  623. DBMS_OUTPUT.PUT_LINE('Attempt to divide by zero');
  624. WHEN OTHERS THEN
  625. DBMS_OUTPUT.PUT_LINE('An error occurred');
  626. END; Mark for Review
  627. (1) Points
  628. No rows were found
  629. Attempt to divide by zero (*)
  630. Attempt to divide by zero No rows were found
  631. An error occurred
  632. No message will be displayed
  633. Correct
  634. 40. In which DML statements can user-defined functions be
  635. used? Mark for Review
  636. (1) Points
  637. INSERT and UPDATE, but not DELETE.
  638. INSERT only.
  639. All DML statements. (*)
  640. UPDATE only
  641. DELETE only
  642. Correct41. Which one of the
  643. following statements about user-defined functions is NOT true? Mark
  644. for Review
  645. (1) Points
  646. They can execute spell-checking routines.
  647. They can be used inside SQL statements.
  648. They can be combined (nested) together,
  649. similar to nesting system functions, for example INITCAP(SUBSTR( .....)).
  650. They can return a TIMESTAMP datatype.
  651. They can allow you to COMMIT from inside a
  652. SELECT statement. (*)Incorrect. Refer to Section 8.
  653. 42. Which of the following are NOT allowed in a function
  654. which is used inside a SQL statement which updates the EMPLOYEES table?
  655. (Choose two). Mark for Review
  656. (1) Points
  657. (Choose all correct answers)
  658. SELECT .... FROM departments ....;
  659. COMMIT; (*)
  660. A RETURN statement.
  661. DDL statements such as CREATE or ALTER. (*)
  662. A WHEN OTHERS exception handler.
  663. Correct
  664. 43. Which of the following is NOT an advantage of including
  665. an exception handler in a PL/SQL block? Mark for Review
  666. (1) Points
  667. Protects the database from errors
  668. Code is more readable because error-handling
  669. routines can be written in the same block in which the error occurred
  670. Prevents errors from occurring (*)
  671. Avoids costly and time-consuming correction
  672. of mistakes
  673. Correct
  674. 44. While a PL/SQL block is executing, more than one
  675. exception can occur at the same time. True or False? Mark for Review
  676. (1) Points
  677. True
  678. False (*)
  679. Incorrect. Refer to Section 6.
  680. 45. The following EXCEPTION section is constructed
  681. correctly. True or False? EXCEPTION
  682. WHEN NO_DATA_FOUND OR TOO_MANY_ROWS
  683. THEN statement_1;
  684. statement_2;
  685. WHEN OTHERS
  686. THEN statement_3;
  687. END; Mark for Review
  688. (1) Points
  689. True (*)
  690. False
  691. Correct46. Which of the following
  692. are good practice guidelines for exception handling? (Choose three.)
  693. Mark for Review
  694. (1) Points
  695. (Choose all correct answers)
  696. Test your code with different combinations of
  697. data to see what potential errors can happen. (*)
  698. Use an exception handler whenever there is
  699. any possibility of an error occurring. (*)
  700. Include a WHEN OTHERS handler as the first
  701. handler in the exception section.
  702. Allow exceptions to propagate back to the
  703. calling environment.
  704. Handle specific named exceptions where
  705. possible, instead of relying on WHEN OTHERS. (*)
  706. Correct
  707. 47. A user-defined exception must be declared as a variable
  708. of data type EXCEPTION. True or False? Mark for Review
  709. (1) Points
  710. True (*)
  711. False
  712. Correct
  713. 48. A user-defined exception can be raised:
  714. A. In the declaration section
  715. B. In the executable section
  716. C. In the exception section Mark for Review (1) Points
  717. B
  718. C
  719. A and B
  720. B and C (*)
  721. A and C
  722. Correct
  723. 49. User-defined exceptions must be declared explicitly by
  724. the programmer, but then are raised automatically by the Oracle Server.
  725. True or False? Mark for Review
  726. (1) Points
  727. True
  728. False (*)
  729. Correct
  730. 50. Department-id 99 does not exist. What will be displayed
  731. when the following code is executed?
  732. DECLARE
  733. v_deptname departments.department_name%TYPE;
  734. BEGIN
  735. SELECT department_name INTO v_deptname
  736. FROM departments WHERE department_id = 99;
  737. EXCEPTION
  738. WHEN NO_DATA_FOUND THEN
  739. RAISE_APPLICATION_ERROR(-20201,'Department does not exist');
  740. END; Mark for Review
  741. (1) Points
  742. ORA-01403: No Data Found ORA-20201:
  743. Department does not exist
  744. ORA-01403: No Data Found
  745. ORA-20201: Department does not exist (*)
  746. None of the above
  747. Incorrect. Refer to Section 6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement