Vous êtes sur la page 1sur 6

1.

A procedure is invoked by
this command: Mark for Review
(1) Points
myproc('Smith',100,5000);

What is the method of


passing parameters used
here?

Positional (*)

A combination of positional and named

Named

None of these.

Correct

2. The following procedure has been created:


Mark for Review
CREATE OR REPLACE PROCEDURE myproc (1) Points
(p_p1 NUMBER, p_p2 VARCHAR2)
IS BEGIN ...

Which one of the following calls to the procedure will NOT work?

myproc(80, p_p2 => 'Smith');

myproc(p_p1 => 80, p_p2 => 'Smith');

myproc(80, 'Smith');

myproc(p_p1 => 80, 'Smith'); (*)

Correct

3. Which parameter mode is the default?


Mark for Review
(1) Points

VARIABLE

NUMBER

CONSTANT

OUT

IN (*)

Incorrect. Refer to Section 8 Lesson 3.

4. Three IN parameters for procedure ADD_EMPLOYEE are defined as:


(p_name VARCHAR2 , Mark for Review
p_salary NUMBER := 1000,
(1) Points
p_hired DATE DEFAULT SYSDATE)
The procedure is invoked by:

add_employee('Jones');

What is the value of P_SALARY when the procedure starts to execute?

1000 (*)

NULL

The call will fail because P_SALARY is a required parameter

The procedure will not compile because P_SALARY should have been coded
as DEFAULT 1000

Correct

5. Procedure NUMPROC has been created as:


Mark for Review
CREATE PROCEDURE numproc (1) Points
(x NUMBER, y NUMBER := 100, z NUMBER) IS BEGIN ....

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);

numproc(10,,20);

Correct
6. Procedure SUBPROC
was created as: Mark for Review
(1) Points
CREATE
PROCEDURE
subproc
(p_param
VARCHAR2)
IS BEGIN ...

You invoke the


procedure by:

DECLARE
v_param
VARCHAR2(20) :=
'Smith';
BEGIN
subproc(v_param);
END;

Which of the
following is the
actual parameter?
Smith'

p_param

v_param (*)

None of these.

Correct

7. A procedure will execute faster if it has at least one parameter.


Mark for Review
(1) Points

True

False (*)

Correct

8. Parameters are a special form of a variable, whose input values are


initialized by the calling environment when the subprogram is called, Mark for Review
and whose output values are returned to the calling environment
(1) Points
when the subprogram returns control to the caller.

True (*)

False

Correct

9. Which of the following can NOT be used as the datatype of a


procedure parameter? Mark for Review
(1) Points

The name of another procedure (*)

A large object datatype such as CLOB

A PLSQL record defined using %ROWTYPE

A non-SQL datatype such as BOOLEAN

Correct

10. Which of the following is NOT correct coding for a procedure


parameter? Mark for Review
(1) Points

(p_param IN VARCHAR2)

(p_param VARCHAR2(50)) (*)

(p_param employees.last_name%TYPE)
(p_param VARCHAR2)

(p_param IN NUMBER)

Correct

11. The following are the steps


involved in creating, and later Mark for Review
modifying and re-creating, a
(1) Points
PL/SQL procedure in Application
Express. Which step is missing?

1. Type the procedure code


in the SQL Commands
window
2. Click on the "Save"
button and save the
procedure code
3. Retrieve the saved code
from "Saved SQL" in SQL
Commands
4. Modify the code in the
SQL Commands window
5. Execute the code to re-
create the procedure

Execute the procedure from


USER_SOURCE data
dictionary view
Enter parameters and data
type
Execute the code to create
the procedure (*)
Invoke the procedure from
an anonymous block

Correct

12. Which of the following keywords


MUST be included in every PL/SQL Mark for Review
procedure definition? (Choose
(1) Points
two.)

(Choose all correct answers)

DECLARE

END (*)

EXCEPTION

REPLACE

BEGIN (*)

Correct
13. A PL/SQL stored procedure can
accept one or more input Mark for Review
parameters and can return one or
(1) Points
more output values to the calling
environment. True or False?

TRUE (*)

FALSE

Correct

14. A programmer wants to create a


PL/SQL procedure named Mark for Review
EMP_PROC. What will happen
(1) Points
when the following code is
executed?

CREATE OR REPLACE PROCEDURE


emp_proc IS
v_salary
employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary
FROM employees
WHERE employee_id = 999;
DBMS_OUTPUT.PUT_LINE('The
salary is: ' || v_salary);
END;

The statement will raise a


NO_DATA_FOUND exception
because employee_id 999
does not exist.
The statement will fail
because the last line of code
should be END emp_proc;
The statement will fail
because the procedure does
not have any parameters.
The procedure will be
created successfully. (*)
The statement will fail
because you cannot declare
variables such as v_salary
inside a procedure.

Correct

15. Which of the following are benefits


of using PL/SQL subprograms Mark for Review
rather than anonymous blocks?
(1) Points
(Choose three.)

(Choose all correct answers)

Easier code maintenance (*)

Do not need to declare


variables
Easier to write

Faster performance (*)

Better data security (*)

Correct

Vous aimerez peut-être aussi