Professional Documents
Culture Documents
LESSON 1
1. PL/SQL subprograms, unlike anonymous blocks, are compiled each time they are executed. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
3. Procedures are generally used to perform what? Mark for Review
(1) Points
A SELECT statement
An action (*)
A return of values
Correct
4. Which of the following are characteristics of anonymous PL/SQL blocks but not PL/SQL
subprograms? (Choose three.) Mark for Review
(1) Points (Choose all correct answers)
Can take parameters
False (*)
False (*)
Correct
7. Which of the following keywords MUST be included in every PL/SQL procedure definition?
(Choose two.) Mark for Review
(1) Points (Choose all correct answers)
BEGIN (*)
REPLACE
EXCEPTION
DECLARE
END (*)
Correct
8. A programmer wants to create a PL/SQL procedure named MY_PROC. What will happen when the
following code is executed?
The statement will fail because the last line of code should be END emp_proc; (*)
The statement will fail because you cannot declare variables such as v_empid inside a procedure.
Stored externally
A and B
A and C
A, B and D (*)
B and C
BEGIN
add_dept;
END;
False
False
Correct
13. Why will the following procedure fail?
LESSON 2
1. You want to create a procedure which accepts a single parameter. The parameter is a number with a
maximum value of 9999.99. Which of the following is a valid declaration for this parameter? Mark for
Review
(1) Points
(v_num NUMBER(6,2))
(v_num)
(v_num NUMBER(4,2))
Correct
2. What is the correct syntax to create procedure MYPROC that accepts two number parameters X and
Y? Mark for Review
(1) Points
CREATE PROCEDURE myproc (x NUMBER, y NUMBER) IS ... (*)
They allow values to be passed between the calling environment and the procedure. (*)
Correct
4. Procedure TESTPROC accepts one parameter P1, whose value is up to 1000 characters in length.
Which one of the following declares this parameter correctly? Mark for Review
(1) Points
CREATE PROCEDURE testproc
(p1 VARCHAR2(100) )
IS
BEGIN ....
DECLARE
v_param VARCHAR2(20) := 'Smith';
BEGIN
subproc(v_param);
END;
v_param (*)
'Smith'
A parameter is the name of a variable, while an argument is the datatype of that variable
A parameter is the name of a variable that is passed into or out of a procedure, while an argument is the
value of that variable (*)
Correct
7. Which one of the following statements about formal and actual parameters is true? Mark for
Review
(1) Points
Formal and actual parameters must have the same name.
A formal parameter is declared within the called procedure, while an actual parameter is declared in the
calling environment. (*)
A literal value.
An expression.
All of the above. (*)
Correct
9. A procedure has been created as:
You want to call the procedure from an anonymous block. Which of the following calls is valid?
myproc(v_left, v_right);
myproc(v_left, 30);
LESSON 3
myproc('Smith',100,5000);
Named
Correct
2. If you don't specify a mode for a parameter, what is the default mode? Mark for Review
(1) Points
OUT
IN (*)
COPY
DEFAULT
R(ead)
Correct
3. Procedure NUMPROC has been created as:
You want to call the procedure, passing arguments of 10 for X and 20 for Z. Which one of the following calls is
correct?
numproc(x=10,z=20);
numproc(10,z=>20); (*)
numproc(x=>10,20);
Correct
4. A procedure is invoked by this command:
myproc('Smith',salary=>5000);
Named
Correct
5. Three IN parameters for procedure ADD_EMPLOYEE are defined as:
(p_name VARCHAR2 ,
p_salary NUMBER := 1000,
p_hired DATE DEFAULT SYSDATE)
add_employee('Jones');
1000 (*)
The procedure will not compile because P_SALARY should have been coded as DEFAULT 1000
Correct
6. Which kind of parameters cannot have a DEFAULT value? Mark for Review
(1) Points
OUT (*)
IN
CONSTANT
R(ead)
W(rite)
Correct
7. Which of the following statements about IN OUT parameters is true? (Choose two.) Mark for
Review
(1) Points (Choose all correct answers)
The data type for the parameter must be VARCHAR2.
The parameter value passed into the subprogram is always returned unchanged to the calling environment.
The parameter value can be returned as the original unchanged value. (*)
The parameter value can be returned as a new value that is set within the procedure. (*)
Correct
8. What are the three parameter modes for procedures? Mark for Review
(1) Points
IN, OUT, IN OUT (*)
Correct
9. When creating a procedure, where in the code must the parameters be listed? Mark for Review
(1) Points
After the procedure name. (*)
Correct
10. The following procedure has been created:
Which one of the following calls to the procedure will NOT work?
Correct
11. What will happen when the following procedure is called as format_phone (8005551234)?
CREATE OR REPLACE PROCEDURE format_phone
(p_phone_no IN OUT VARCHAR2) IS
BEGIN
p_phone_no := SUBSTR(p_phone_no,1,3) ||
'.' || SUBSTR(p_phone_no,4,3) ||
'.' || SUBSTR(p_phone_no,7);
END format_phone;
The phone number 800.555.1234 is placed into the p_phone_no variable. (*)
The procedure does not execute because the input variable is not properly declared.