0% found this document useful (1 vote)
3K views6 pages

PL/SQL Practice Quizzes Exam 2

This document contains 10 practice quiz questions testing knowledge of PL/SQL concepts like exceptions, cursors, parameters, and packages. The questions cover topics such as the purpose of exception handlers, cursor declarations, parameter modes, invoking stored procedures, package specifications and bodies, and anonymous blocks.

Uploaded by

meachamrob
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
3K views6 pages

PL/SQL Practice Quizzes Exam 2

This document contains 10 practice quiz questions testing knowledge of PL/SQL concepts like exceptions, cursors, parameters, and packages. The questions cover topics such as the purpose of exception handlers, cursor declarations, parameter modes, invoking stored procedures, package specifications and bodies, and anonymous blocks.

Uploaded by

meachamrob
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Practice Quizes #4

Question 1 2.5 out of 2.5 points A(n) ____ is a mechanism to trap an error that occurs in processing. Answer Selected Answer: c. Exception handler Question 2 2.5 out of 2.5 points

The ____ is an Oracle built-in procedure that allows developers to associate their own error number and message to an error. Answer Selected Answer: c. RAISE_APPLICATION_ERROR Question 3 2.5 out of 2.5 points

____ is used to trap errors not specifically addressed in one of the exception handlers. Answer Selected Answer: c. WHEN OTHERS Question 4 2.5 out of 2.5 points

Analyze the cursor declaration below. Which of the followings is the correct answer to explain the purpose of this cursor? CURSOR c_dept_cursor IS SELECT department_id,department_name FROM departments WHERE department_id < 100 ORDER BY department_id; Answer Selected Answer: c. To retrieve department_id, and department_name for those departments with department_id less than 100 and process the records in the order by the department_id. Question 5 2.5 out of 2.5 points

A(n) ____ represents a work area or section of memory in which an SQL statement is being processed in the Oracle server. Answer Selected Answer: c. cursor Question 6 2.5 out of 2.5 points

The ____ action used in an explicit cursor processes the query and creates an active set of rows available in the cursor. Answer Selected Answer: b. OPEN Question 7 2.5 out of 2.5 points

____ is required in a PRAGMA EXCEPTION_INIT statement. Answer

Selected Answer: b. Exception name Question 8 2.5 out of 2.5 points

____ is an acceptable error number for the RAISE_APPLICATION_ERROR function. Answer Selected Answer: c. -20002 Question 9 2.5 out of 2.5 points

Which of the following functions returns the Oracle error message in exception handling? Answer Selected Answer: b. SQLERRM Question 10 2.5 out of 2.5 points

____ refers to a condition where there is no WHEN clause in the CASE statement. Answer Selected Answer: a. CASE_NOT_FOUND

Practice Quiz #5
Question 1 2.5 out of 2.5 points

To reference a host variable in PL/SQL, a preceding ____ must be used with the host variable name. Answer Selected Answer: a. colon Question 2 2.5 out of 2.5 points

If no mode is indicated in a parameter, the default value of ______________ is applied. Answer Selected Answer: c. IN Question 3 2.5 out of 2.5 points

Which of the following statements is true? Answer Selected Answer: a. If an exception is raised in procedure B that has been called from procedure A, the control initially moves to the exception handler section of procedure B. Question 4 2.5 out of 2.5 points

_____________ indicate which way the value provided for the parameter flows: into the procedure, out of the procedure, or both. Answer Selected Answer: c. Modes Question 5 2.5 out of 2.5 points

____ a program unit or PL/SQL block of code allows the storage and reuse of the code.

Answer Selected Answer: a. Naming Question 6 2.5 out of 2.5 points

A parameter with a(n) ____ only mode can receive a value, but this value cannot be changed in the procedure. Answer Selected Answer: b. IN Question 7 2.5 out of 2.5 points

Examine the following procedure. CREATE OR REPLACE PROCEDURE INSERT_TEAM (V_ID in NUMBER, V_CITY in VARCHAR2 DEFAULT 'AUSTIN', V_NAME in VARCHAR2) IS BEGIN INSERT INTO TEAM (id, city, name) VALUES (v_id, v_city, v_name); COMMIT; END; / Which of the following statements will successfully invoke this procedure in SQL*Plus? Answer Selected Answer: b. EXECUTE INSERT_TEAM(3,'AUSTIN','LONGHORNS'); Question 8 2.5 out of 2.5 points

If values are calculated or retrieved from the database within the procedure, ____ parameters are used to return these values to the calling environment. Answer Selected Answer: b. OUT Question 9 2.5 out of 2.5 points

____ can accept and return none, one, or many parameters. Answer Selected Answer: b. Stored procedures Question 10 2.5 out of 2.5 points

The following example is for _______________. EXECUTE add_department (p_loc=>1500, p_name=>'INFORMATION TECHNOLOGY'); Answer Selected Answer: b. passing parameters using the named notation

Practice Quiz #6
Question 1 2.5 out of 2.5 points

Based on the package specification below, which of the following code fragments correctly creates a package body? CREATE OR REPLACE PACKAGE ordering_pkg

IS pv_total_num NUMBER(3,2); PROCEDURE order_total_pp (p_bsktid IN NUMBER, p_sub OUT NUMBER); FUNCTION ship_calc_pf (p_qty IN NUMBER) RETURN NUMBER; END; Answer Selected Answer: a. CREATE OR REPLACE PACKAGE BODY ordering_pkg IS FUNCTION ship_calc_pf (p_qty IN NUMBER) RETURN NUMBER IS lv_ship_num NUMBER(5,2); BEGIN ... code detail ... END ship_calc_pf; PROCEDURE order_total_pp (p_bsktid IN NUMBER, p_sub OUT NUMBER) IS BEGIN ... code detail ... END order_total_pp; END; Question 2 2.5 out of 2.5 points

In the code below, which of the following is the parameter variable? CREATE OR REPLACE FUNCTION fct_test1_sf (p_num IN NUMBER) RETURN NUMBER IS BEGIN UPDATE bb_test1 SET col1 = p_num; RETURN p_num; END; / Answer Selected Answer: c. p_num Question 3 2.5 out of 2.5 points

Using the same name on multiple program units within the same package is referred to as ____. Answer Selected Answer: a. overloading Question 4 2.5 out of 2.5 points

The following code is an example of a(n) ____. DECLARE lv_name_txt VARCHAR2(35); lv_id_num NUMBER(4) := 25; lv_first_txt VARCHAR2(15) := 'Scott'; lv_last_txt VARCHAR2(20) := 'David'; BEGIN

lv_name_txt := memfmt1_sf(lv_id_num,lv_first_txt, lv_last_txt); DBMS_OUTPUT.PUT_LINE(lv_name_txt); END; / Answer Selected Answer: d. anonymous block Question 5 2.5 out of 2.5 points

A good method to handle the size issue when declaring variables that hold values from a database table is to use the ____ attribute to use the size of the database column. Answer Selected Answer: b. %TYPE Question 6 2.5 out of 2.5 points

Which of the following code fragments would NOT raise an error? Answer Selected Answer: b. DECLARE v_amt1 number(5,2); v_amt2 number(3,0); BEGIN v_amt1 := 32.50; v_amt2 := ROUND(v_amt1,1); DBMS_OUTPUT.PUT_LINE(v_amt2); END; / Question 7 2.5 out of 2.5 points

Analyze the following code. The code fragment below is an example of a(n) ____. CREATE OR REPLACE PACKAGE ordering_pkg IS pv_total_num NUMBER(3,2); PROCEDURE order_total_pp (p_bsktid IN NUMBER, p_sub OUT NUMBER); FUNCTION ship_calc_pf (p_qty IN NUMBER) RETURN NUMBER; END; Answer Selected Answer: c. package specification Question 8 2.5 out of 2.5 points

Analyze the following code that invokes a package procedure. Which of the following statements is true? EXECUTE emma.hr_package.new_emp(:p_emp_id); Answer Selected Answer: c. This codes invokes a procedure called new_emp from the package called hr_package in the emma schema. Question 9 2.5 out of 2.5 points

Which of the followings is incorrect for a PL/SQL function? Answer Selected Answer: d. A PL/SQL function does not contain a RETURN clause in the header. Question 10 2.5 out of 2.5 points

Which data dictionary can be used to display a list of functions you created in your schema? Answer Selected Answer: c. USER_OBJECTS

You might also like