Section 8 5659af320768b
Section 8 5659af320768b
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Which of the following are characteristics of anonymous PL/SQL blocks but
not PL/SQL subprograms? (Choose three.)
Mark for
Review
(1) Points
Correct
2. Which of the following keywords MUST be included in every PL/SQL
procedure definition? (Choose two.)
Mark for
Review
(1) Points
Correct
3. PL/SQL subprograms, unlike anonymous blocks, are compiled each time
they are executed. True or False?
Mark for
Review
(1) Points
True
False (*)
Correct
4. Which of the following are benefits of using PL/SQL subprograms rather than
anonymous blocks? (Choose three.)
Mark for
Review
(1) Points
Correct
5. A stored procedure add_dept may be invoked by the following command in
Application Express. True or False?
BEGIN
add_dept;
END;
Mark for
Review
(1) Points
True (*)
False
Correct
6. The following are the steps involved in creating, and later modifying and recreating, a PL/SQL procedure in Application Express. Which step is missing?
1.
2.
3.
4.
Mark for
Review
(1) Points
5.
Correct
7. Subprograms and anonymous blocks can be called by other applications.
True or False?
Mark for
Review
(1) Points
True
False (*)
Correct
8. 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
9. When modifying procedure code, the procedure code statement must be reexecuted to validate and store it in the database. True or False?
Mark for
Review
(1) Points
True
False (*)
Correct
10. A programmer wants to create a PL/SQL procedure named MY_PROC. What
will happen when the following code is executed?
CREATE OR REPLACE PROCEDURE my_proc IS
v_empid employees.empid%TYPE;
BEGIN
SELECT employee_id INTO v_empid FROM employees
WHERE region_id = 999;
DBMS_OUTPUT.PUT_LINE('The salary is: ' || v_salary);
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True
False (*)
Correct
12. Why will the following procedure fail?
CREATE OR REPLACE PROCEDURE mainproc
...
IS
PROCEDURE subproc (...) IS BEGIN
...
BEGIN
...
subproc (...);
...
END;
Mark for
Review
(1) Points
Correct
13. A stored PL/SQL procedure can be invoked from which of the following?
1.
2.
A calling application
3.
A SELECT statement
4.
Mark for
Review
(1) Points
A only
A and B
A and C
A, B and D (*)
B and C
Correct
myproc(p_left, p_right);
myproc(v_left, v_right);
Mark for
Review
(1) Points
myproc(v_left, 30);
All of the above. (*)
Mark for
Review
(1) Points
Correct
3. What is the correct syntax to create procedure MYPROC that accepts two
number parameters X and Y?
Mark for
Review
(1) Points
Correct
4. What is the purpose of using parameters with stored procedures?
Mark for
Review
(1) Points
Correct
5. Which of the following best describes the difference between a parameter
and an argument?
Mark for
Review
(1) Points
Correct
Test: Quiz: Passing Parameters
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. Three IN parameters for procedure ADD_EMPLOYEE are defined as:
(p_name VARCHAR2 ,
p_salary NUMBER := 1000,
p_hired DATE DEFAULT SYSDATE)
The procedure is invoked by:
Mark for
Review
(1) Points
add_employee('Jones');
What is the value of P_SALARY when the procedure starts to execute?
NULL
1000 (*)
The procedure will not compile because P_SALARY should have been
coded as DEFAULT 1000
The call will fail because P_SALARY is a required parameter
Correct
2. When creating a procedure, where in the code must the parameters be
listed?
Mark for
Review
(1) Points
Correct
3. A procedure is invoked by this command:
Mark for
myproc('Smith',salary=>5000);
What is the method of passing parameters used here?
Review
(1) Points
Positional
Named
A combination of positional and named (*)
None of the above
Correct
4. Procedure NUMPROC has been created as:
CREATE PROCEDURE numproc
(x NUMBER, y NUMBER := 100, z NUMBER) IS BEGIN ....
Mark for
Review
(1) Points
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(10,,20);
numproc(x=10,z=20);
numproc(10,z=>20); (*)
numproc(x=>10,20);
Correct
5. Which of the following statements about IN OUT parameters is true?
(Choose two.)
Mark for
Review
(1) Points
Mark for
myproc('Smith',100,5000);
What is the method of passing parameters used here?
Review
(1) Points
Positional (*)
Named
A combination of positional and named.
None of the above
Correct
7. What are the three parameter modes for procedures?
Mark for
Review
(1) Points
Correct
8. 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) ||
Mark for
Review
(1) Points
'.' || SUBSTR(p_phone_no,4,3) ||
'.' || SUBSTR(p_phone_no,7);
END format_phone;
Mark for
Review
(1) Points
OUT
IN (*)
COPY
DEFAULT
R(ead)
Correct
10. Which kind of parameters cannot have a DEFAULT value?
Mark for
Review
(1) Points
OUT (*)
IN
CONSTANT
R(ead)
W(rite)
Correct
myproc(80, 'Smith');
myproc(p_p1 => 80, 'Smith'); (*)
myproc(80, p_p2 => 'Smith');
myproc(p_p1 => 80, p_p2 => 'Smith');
Correct
Mark for
Review
(1) Points