Quiz 8
Quiz 8
DECLARE
v_param NUMBER := 20;
BEGIN
smallproc(v_param);
END;
(1) Points
p_param is a formal parameter and v_param is an actual parameter (*)
p_param is an actual parameter and v_param is a formal parameter
p_param is a parameter and v_param is an argument
p_param and v_param are both formal parameters, while 20 is an actual
parameter
p_param is a formal parameter and 20 is an actual parameter
Correct
(1) Points
An expression
None of these.
A literal value
All of these. (*)
The name of a variable
Correct
3. You have created procedure MYPROC with a single parameter PARM1
NUMBER. Now you want to add a second parameter to the procedure. Which
of the following will change the procedure successfully?
Mark for Review
(1) Points
CREATE OR REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ... (*)
REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ...
The procedure cannot be modified. Once a procedure has been created, the
number of parameters cannot be changed.
ALTER PROCEDURE myproc ADD (parm2 NUMBER);
CREATE OR REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER);
(You do not need to repeat the detailed code of the procedure, only the
header)
Correct
4. What is the correct syntax to create procedure MYPROC that accepts two
number parameters X and Y?
Mark for Review
(1) Points
CREATE PROCEDURE (x NUMBER, y NUMBER) myproc IS ...
CREATE PROCEDURE IS myproc (x NUMBER, y NUMBER) …
CREATE PROCEDURE myproc IS (x NUMBER, y NUMBER) ...
CREATE PROCEDURE myproc (x NUMBER, y NUMBER) IS ... (*)
Correct
(1) Points
None of these.
p_param
v_param (*)
Smith'
Correct
6. When creating a procedure, where in the code must the parameters be
listed?
Mark for Review
(1) Points
After the procedure name (*)
Before the procedure name
After the keyword PROCEDURE
After the keyword IS or AS
Correct
(1) Points
Positional
A combination of positional and named (*)
None of these.
Named
Correct
8. Suppose you set up a parameter with an explicit OUT mode. What is true
about that parameter?
Mark for Review
(1) Points
It must be the same type as the matching IN parameter.
It cannot have a DEFAULT value. (*)
It inherits its type from the matching IN parameter.
It must have a DEFAULT value.
It acts like a constant (its value cannot be changed inside the subprogram).
(1) Points
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. (*)
The parameter value passed into the subprogram is always returned
unchanged to the calling environment.
The data type for the parameter must be VARCHAR2.
Correct
(1) Points
IN, OUT, IN OUT (*)
CONSTANT, VARIABLE, DEFAULT
R(ead), W(rite), A(ppend)
COPY, NOCOPY, REF
Correct
Previous
11. The following are the steps involved in creating, and later modifying and
re-creating, a PL/SQL procedure in Application Express. Which step is
missing?
(1) Points
Enter parameters and data type
Invoke the procedure from an anonymous block
Execute the procedure from USER_SOURCE data dictionary view
Execute the code to create the procedure (*)
Correct
(1) Points
EXECUTE my_proc1;
CREATE OR REPLACE PROCEDURE my_proc2 IS
BEGIN
my_proc1;
END my_proc2; (*)
SELECT my_proc1 FROM DUAL;
BEGIN
my_proc1;
END; (*)
DECLARE
v_var1 NUMBER := 20;
BEGIN
my_proc1(v_var1);
END;
Incorrect. Refer to Section 8 Lesson 1.
13. A PL/SQL procedure named MYPROC has already been created and
stored in the database. Which of the following will successfully re-create the
procedure after some changes have been made to the code?
Mark for Review
(1) Points
UPDATE PROCEDURE myproc IS ...
None of these, because the procedure must be dropped before it can be re-
created.
CREATE PROCEDURE myproc IS ...
CREATE OR REPLACE PROCEDURE myproc IS .... (*)
ALTER PROCEDURE myproc IS ...
Correct
(1) Points
END (*)
BEGIN (*)
REPLACE
DECLARE
EXCEPTION
Correct
(1) Points
True
False (*)
Correct
2. A stored PL/SQL procedure can be invoked from which of the following?
(1) Points
A only
B and C
A and C
A, B, and D (*)
A and B
Correct
3. A nested subprogram can only be invoked from the main subprogram.
True or False?
Mark for Review
(1) Points
True (*)
False
Correct
4. The following are the steps involved in creating, and later modifying and
re-creating, a PL/SQL procedure in Application Express. In what sequence
should these steps be performed?
(1) Points
E,D,F,C,A,B
F,C,A,B,E,D
F,B,D,E,A,C
F,B,D,A,E,C (*)
F,B,C,D,E,A
Correct
(1) Points
END (*)
REPLACE
BEGIN (*)
EXCEPTION
DECLARE
Correct
6. The following procedure has been created:
CREATE OR REPLACE PROCEDURE myproc
(p_p1 NUMBER, p_p2 VARCHAR2)
IS BEGIN ...
Which one of the following calls to the procedure will NOT work?
(1) Points
myproc(p_p1 => 80, 'Smith'); (*)
myproc(80, 'Smith');
myproc(p_p1 => 80, p_p2 => 'Smith');
myproc(80, p_p2 => 'Smith');
Correct
(1) Points
A combination of positional and named (*)
Positional
None of these.
Named
Correct
(1) Points
Before the procedure name
After the procedure name (*)
After the keyword PROCEDURE
After the keyword IS or AS
Correct
(1) Points
W(rite)
IN
OUT (*)
R(ead)
CONSTANT
Correct
Previous
11. A procedure has been created as:
CREATE PROCEDURE myproc
(p_left NUMBER, p_right NUMBER)
IS BEGIN ....
You want to call the procedure from an anonymous block. Which of the
following calls is valid?
(1) Points
myproc(p_left, p_right);
myproc(v_left, 30);
All of the above (*)
myproc(v_left, v_right);
Correct
(1) Points
The datatypes of an actual parameter and its formal parameter must be
compatible.
An actual parameter can have a Boolean datatype.
An actual parameter can have a TIMESTAMP datatype.
An actual parameter must be the name of a variable. (*)
An actual parameter is declared in the calling environment, not in the called
procedure.
Correct
(1) Points
(p_param IN VARCHAR2)
(p_param employees.last_name%TYPE)
(p_param IN NUMBER)
(p_param VARCHAR2(50)) (*)
(p_param VARCHAR2)
Correct
(1) Points
True (*)
False
Correct
(1) Points
CREATE OR REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER);
(You do not need to repeat the detailed code of the procedure, only the
header)
CREATE OR REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ... (*)
ALTER PROCEDURE myproc ADD (parm2 NUMBER);
REPLACE PROCEDURE myproc
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ...
The procedure cannot be modified. Once a procedure has been created, the
number of parameters cannot be changed.
Correct
Previous