latihan 8 (Quiz 8) ilearning oracle






1. A nested subprogram can be called from the main procedure or from the calling environment. True or False?
  •  True
  •  False (*)

2. Which of the following keywords MUST be included in every PL/SQL procedure definition? (Choose three.)
  • END (*)            
  • DECLARE    
  • IS or AS (*)        
  • BEGIN (*)             
  • REPLACE 
3. 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           
  • CREATE OR REPLACE PROCEDURE myproc IS .... (*)            
  • CREATE PROCEDURE myproc IS ...            
  • ALTER PROCEDURE myproc IS ...
  • UPDATE PROCEDURE myproc IS ...
  • None of these, because the procedure must be dropped before it can be re-created.     
4. 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. 1.    Type the procedure code in the SQL Commands window
  2. 2.    Click on the "Save" button and save the procedure code
  3. 3.    Retrieve the saved code from "Saved SQL" in SQL Commands
  4. 4.    Modify the code in the SQL Commands window
  5. 5.    Execute the code to re-create the procedure     

  • Invoke the procedure from an anonymous block              
  • Execute the code to create the procedure (*)
  • Enter parameters and data type
  • Execute the procedure from USER_SOURCE data dictionary view
5. Which of the following are benefits of using PL/SQL subprograms rather than anonymous blocks? (Choose three.)
              
  • Easier code maintenance (*)
  • Code reuse (*)
  • Stored externally
  • Do not need to define exceptions
  • Better data security (*)
6. Which one of the following statements about formal and actual parameters is true?  
  • An actual parameter is declared within the called procedure.
  • A formal parameter is declared within the called procedure, while an actual parameter is declared in the calling environment. (*)
  • Formal and actual parameters must have the same name.
  • Formal and actual parameters must have different names.
    
7. 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)
    IS
    BEGIN .... (*)
  •  CREATE PROCEDURE testproc
      p1 VARCHAR2
    IS
    BEGIN ....
         
  • CREATE PROCEDURE testproc
      (p1 VARCHAR2(100) )
    IS
    BEGIN .... 
  •  CREATE PROCEDURE testproc
    DECLARE
      p1 VARCHAR2(100);
    BEGIN ....
  •  CREATE PROCEDURE testproc
    IS
      p1 VARCHAR2(100);
    BEGIN ....
          
8. 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? 
  • myproc(v_left, v_right);
  • myproc(p_left, p_right);
  • All of the above (*)
  • myproc(v_left, 30);
9. Procedure SUBPROC was created as:
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?     
  • p_param
  • None of these.
  • v_param (*)
  • Smith'
     

10. Which of the following statements about actual parameters is NOT true?   
  • An actual parameter is declared in the calling environment, not in the called procedure.
  • An actual parameter must be the name of a variable. (*)
  • An actual parameter can have a TIMESTAMP datatype.
  • An actual parameter can have a Boolean datatype.
  • The datatypes of an actual parameter and its formal parameter must be compatible.
     

11. 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?   
              
  • NULL
  • 1000 (*)
  • 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
    
12. What are the three parameter modes for procedures?      Mark for Review
(1) Points
                        
              
  • CONSTANT, VARIABLE, DEFAULT
  • R(ead), W(rite), A(ppend)
  • IN, OUT, IN OUT (*)
  • COPY, NOCOPY, REF
13. Suppose you set up a parameter with an explicit IN mode. What is true about that parameter?    
                        
              
  • It acts like a constant (its value cannot be changed inside the subprogram). (*)
  • It must have a DEFAULT value.
  • It must be the same type as the matching OUT parameter.
  • It inherits its type from the matching OUT parameter.      
  • It cannot have a DEFAULT value.
14. 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
                        
              
  • Named
  • A combination of positional and named (*)   
  • None of these.    
  • Positional
15 . Which parameter mode is the default?    
              
  • IN (*)         
  • CONSTANT         
  • NUMBER     
  • VARIABLE 
  • OUT