Quiz s8
Quiz s8
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
All of the above
None of the above
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
Are stored in the database
Can begin with the keyword DECLARE (*)
Are unnamed (*)
Are compiled every time they are executed (*)
Incorrect. Refer to Section 8 Lesson 1.
5. Subprograms and anonymous blocks can be called by other applications. True or False? Mark
for Review
(1) Points
True
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?
BEGIN
add_dept;
END;
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 NUMBER) (*)
(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 ... (*)
CREATE PROCEDURE (x NUMBER, y NUMBER) myproc IS ...
CREATE PROCEDURE myproc IS (x NUMBER, y NUMBER) ...
CREATE PROCEDURE IS myproc (x NUMBER, y NUMBER) ...
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 ....
CREATE PROCEDURE testproc
IS
p1 VARCHAR2(100);
BEGIN ....
CREATE PROCEDURE testproc
DECLARE
p1 VARCHAR2(100);
BEGIN ....
CREATE PROCEDURE testproc
p1 VARCHAR2
IS
BEGIN ....
CREATE PROCEDURE testproc
(p1 VARCHAR2)
IS
BEGIN ....
(*)
Incorrect. Refer to Section 8 Lesson 2.
5. Procedure SUBPROC was created as:
DECLARE
v_param VARCHAR2(20) := 'Smith';
BEGIN
subproc(v_param);
END;
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.
Formal and actual parameters must have different names.
A formal parameter is declared within the called procedure, while an actual parameter is declared in the
calling environment. (*)
An actual parameter is declared within the called procedure.
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?
LESSON 3
myproc('Smith',100,5000);
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?
Correct
4. A procedure is invoked by this command:
myproc('Smith',salary=>5000);
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');
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 (*)
R(ead), W(rite), A(ppend)
CONSTANT, VARIABLE, DEFAULT
COPY, NOCOPY, REF
Correct
9. When creating a procedure, where in the code must the parameters be listed? Mark for Review
(1) Points
After the procedure name. (*)
After the keyword IS or AS.
Before the procedure name.
After the keyword PROCEDURE.
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)?