You are on page 1of 5

Test: Quiz: Passing Parameters 1. 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 2. Which of the following statements about IN OUT parameters is true? (Cho ose 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 unchan ged 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 th e procedure. (*)

Correct 3. When creating a procedure, where in the code must the parameters be lis ted? Mark for Review (1) Points After the procedure name. (*) After the keyword IS or AS.

Before the procedure name. After the keyword PROCEDURE.

Correct 4. Which kind of parameters cannot have a DEFAULT value? Mark for Review (1) Points OUT (*) IN CONSTANT R(ead) W(rite)

Correct 5. Procedure NUMPROC has been created as: CREATE PROCEDURE numproc (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. Whic h one of the following calls is correct? Mark for Review (1) Points numproc(10,,20); numproc(x=10,z=20); numproc(10,z=>20); (*) numproc(x=>10,20);

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? Mark for Review (1) Points myproc(80, 'Smith'); myproc(p_p1 => 80, 'Smith'); (*) myproc(80, p_p2 => 'Smith'); myproc(p_p1 => 80, p_p2 => 'Smith');

Correct 7. What are the three parameter modes for procedures? (1) Points IN, OUT, IN OUT (*) R(ead), W(rite), A(ppend) CONSTANT, VARIABLE, DEFAULT COPY, NOCOPY, REF Mark for Review

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) || '.' || SUBSTR(p_phone_no,4,3) || '.' || SUBSTR(p_phone_no,7); END format_phone; Mark for Review (1) Points The phone number 800.555.1234 is printed to the screen. The phone number (800) 555-1234 is printed to the screen.

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 properl y declared.

Correct 9. 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: add_employee('Jones'); What is the value of P_SALARY when the procedure starts to execute? Mark for Review (1) Points NULL 1000 (*) The procedure will not compile because P_SALARY should have been coded a s DEFAULT 1000 The call will fail because P_SALARY is a required parameter

Correct 10. A procedure is invoked by this command: myproc('Smith',salary=>5000); What is the method of passing parameters used here? Mark for Review (1) Points Positional Named A combination of positional and named (*)

None of the above

Correct 11. A procedure is invoked by this command: myproc('Smith',100,5000); What is the method of passing parameters used here? Mark for Review (1) Points Positional (*) Named A combination of positional and named. None of the above

Correct

You might also like