1.  Which of the following can be included in a package?  Mark for Review 
(1) Points 
      
    procedures 
  
    variables 
  
    PL/SQL types 
  
    Exceptions 
  
    All of the above (*) 
  
      
      Correct  
  
     
2.  Which of the following are good reasons to group a set of procedures and functions into a package?  Mark for Review 
(1) Points 
      
    Application developers do not need to know the details of the package body code. 
  
    Related subprograms and variables can be grouped together for easier management and maintenance. 
  
    If the detailed code is changed, aplications which invoke the package do not need to be recompiled. 
  
    All of the above. (*) 

3.  In which component of a package is the full definition of a public procedure written?  Mark for Review 
(1) Points 
      
    Body (*) 
  
    Specification 
  
    Both the body and the specification 
  
    Neither the body nor the specification 
  
      
      Correct  
  
     4.  The two parts of a package are stored as separate objects in the database. True or False?  Mark for Review 
(1) Points 
      
    True (*) 
  
    False 
  
      
      Correct  
 
  5.  To be able to invoke a package subprogram from outside the package, it must be declared in the package:  Mark for Review 
(1) Points 
      
    Body 
  
    Specification (*) 
  
    Both the body and the specification 
  
    Neither the body nor the specification 
  
      
      Correct  
 
 6.  A number variable declared in a package is initialized to 0 unless assigned another value. True or False?  Mark for Review 
(1) Points 
      
    True 
  
    False (*) 
  
      
      Correct  
 
7.  Package Specification DEPT_PACK was created by the following code: 
CREATE OR REPLACE PACKAGE dept_pack IS 
    PROCEDURE ins_dept(p_deptno IN NUMBER); 
    FUNCTION get_dept(p_deptno IN NUMBER) RETURN VARCHAR2;
END dept_pack;

Which of the following are correct syntax for invoking the package subprograms? (Choose two.) 
 Mark for Review 
(1) Points 
      
   (Choose all correct answers)  
      
    BEGIN 
    dept_pack.ins_dept(20);
END;
(*)
 
  
    BEGIN 
    dept_pack.get_dept(20);
END;
 
  
    DECLARE 
    v_deptname VARCHAR2(20);
BEGIN
    v_deptname := get_dept(50);
END;
 
  
    CREATE PROCEDURE dept_proc IS
    v_deptname VARCHAR2(20);
BEGIN
    v_deptname := dept_pack.get_dept(40);
END;
(*)
 
  
    BEGIN 
    dept_pack(30);
END;
 
  
      
      Incorrect. Refer to Section 9.  
 
8.  Package EMP_PACK contains two procedures, DEL_EMP and SHOW_EMP. You want to write an anonymous block which invokes these procedures but you have forgotten which parameters they use. Which of the following will give you this information?  Mark for Review 
(1) Points 
      
    DESCRIBE del_emp 
DESCRIBE show_emp
 
  
    DESCRIBE emp_pack(del_emp, show_emp) 
 
  
    DESCRIBE emp_pack 
(*)
 
  
    DESCRIBE emp_pack.del_emp 
DESCRIBE emp_pack.show_emp 
 
  
    None of the above 
  
      
      Incorrect. Refer to Section 9.  
 
 

  
      
      Incorrect. Refer to Section 9.  
 
2.  Examine the following package code: 
CREATE OR REPLACE PACKAGE over_pack IS 
    PROCEDURE do_work1 (p1 IN VARCHAR2, p2 IN NUMBER); 
    PROCEDURE do_work2 (p1 IN VARCHAR2, p2 IN NUMBER); 
    PROCEDURE do_work1 (param1 IN CHAR, param2 IN NUMBER); 
    FUNCTION do_work2 (param1 IN VARCHAR2, param2 IN NUMBER) RETURN DATE; 
END over_pack; 

Which of the following calls will be successful? (Choose three.) 
 Mark for Review 
(1) Points 
      
   (Choose all correct answers)  
      
    over_pack.do_work1('Smith',20); 
  
    v_date := over_pack.do_work2('Smith',20); (*) 
  
    over_pack.do_work2('Smith',20); (*) 
  
    over_pack.do_work1(p1=>'Smith',p2=>20); (*) 
  
    over_pack.do_work1(param1=>'Smith'); 
  
      
      Incorrect. Refer to Section 9.  
 
5.  Which statement about the UTL_FILE package is NOT true?  Mark for Review 
(1) Points 
      
    It can be used to read and write text files stored outside the database. 
  
    It can access files which are pointed to be a CREATE DIRECTORY statement. 
  
    It can be used to access binary files such as JPEGs, MP3s, moview clips and so on. (*) 
  
    We can use UTL_FILE for both writing and reading within the same PL/SQL procedure. 
  
      
      Incorrect. Refer to Section 9.  
 1.  What happens when a SQL statement is parsed? (Choose three.)  Mark for Review 
(1) Points 
      
   (Choose all correct answers)  
      
    The user's required privileges are checked. (*) 
  
    The syntax of the statement is checked. (*) 
  
    The statement is executed. 
  
    The results of the statement are returned to the user. 
  
    Oracle queries the Data Dictionary to make sure that the tables referenced in the SQL statement exist. (*) 
  
      
      Incorrect. Refer to Section 9.  
 
3.  A programmer wants to code a procedure which will create a table with a single column. The datatype of the column will be chosen by the user who invokes the procedure. The programmer writes the following code: 
CREATE OR REPLACE PROCEDURE create_tab 
    (p_col_datatype IN VARCHAR2) IS 
BEGIN 
    CREATE TABLE newtab (only_col p_col_datatype); 
END; 

Why will this procedure not compile successfully? 
 Mark for Review 
(1) Points 
      
    Because you cannot create a table inside a procedure 
  
    Because the invoking user may not have CREATE TABLE privilege 
  
    Because when the procedure is compiled, Oracle cannot check if the parameter value passed into the procedure is a valid column datatype (*) 
  
    Because table NEWTAB may already exist 
  
    None of the above; the procedure will compile successfully 
  
      
      Incorrect. Refer to Section 9 
 

