Professional Documents
Culture Documents
Section 10
Section 10
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
(1) Points
True (*)
False
Correct Correct
PROCEDURE proc2;
END mypack;
(1) Points
(*)
END dept_pack;
Which of the following are correct syntax for invoking the package subprograms? (Choose two.)
(1) Points
v_deptname VARCHAR2(20);
BEGIN
v_deptname := dept_pack.get_dept(40);
END;
(*)
BEGIN
dept_pack.get_dept(20);
END;
BEGIN
dept_pack.ins_dept(20);
END;
(*)
DECLARE
v_deptname VARCHAR2(20);
BEGIN
v_deptname := get_dept(50);
END;
BEGIN
dept_pack(30);
END;
END mypack;
Which of the following will correctly invoke the package subprograms? (Choose two.)
(1) Points
v_num := mypack.myproc(22);
DBMS_OUTPUT.PUT_LINE('Message');
END IF;
(*)
myproc(40);
mypack.myproc(35);
(*)
mypack.myfunc('22-Jan-2007');
(1) Points
Body (*)
Specification
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
6. The package name must be included when calling a package function from a
SELECT statement executed outside the package. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. Functions called from a SQL query or DML statement must not end the
current transaction, or create or roll back to a savepoint. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
8. INDEX BY is missing from the emp_tab TYPE declaration. What is the most
efficient declaration?
END emp_pkg;
(1) Points
INDEX BY BINARY
INDEX ALL
Correct Correct
e_cons_violation EXCEPTION;
e_value_too_large EXCEPTION;
END exceptions_pkg;
(1) Points
True (*)
False
Correct Correct
10. Which of the following are not allowed in a bodiless package? (Choose
three) Mark for Review
(1) Points
User-defined exceptions
Global variables
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
11. A local variable defined inside a package procedure is visible to the calling
environment. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 10 Lesson 2.
12. When one component of a package is called, all the package's components
are loaded into memory. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. A package contains both public and private subprograms. Which one of the
following statements is true? Mark for Review
(1) Points
If three users invoke three different subprograms in the package, there will be three copies
of the code in memory.
The whole package is loaded into memory when the first call is made to any subprogram in
the package. (*)
The public subprograms are all loaded into memory at the same time, but the private
subprograms are loaded into memory one at a time as they are invoked.
(1) Points
True
False (*)
(0) Points
emp_sal(101);
None of these.
All of these.
scott.emp_pkg.emp_sal(101): (*)
emp_pkg.emp_sal(101);
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
(1) Points
None of these.
Specification
Body
Correct Correct
END mypack;
Which of the following will correctly invoke the package subprograms? (Choose two.)
(1) Points
myproc(40);
DBMS_OUTPUT.PUT_LINE('Message');
END IF;
(*)
mypack.myproc(35);
(*)
v_num := mypack.myproc(22);
mypack.myfunc('22-Jan-2007');
(1) Points
procedures
variables
Exceptions
PL/SQL types
(1) Points
DESCRIBE del_emp
DESCRIBE show_emp
DESCRIBE emp_pack.del_emp
DESCRIBE emp_pack.show_emp
None of these.
DESCRIBE emp_pack
(*)
(1) Points
True (*)
False
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
6. Suppose you want to automatically execute some code every time you make
the first call to a package in your session? For example, you want to automatically load a tax rate
into a package variable.
(1) Points
forward declaration
None of these.
bodiless package
Incorrect Incorrect. Refer to Section 10 Lesson 3.
IS
l_name employees.last_name%TYPE,
d_name departments.department_name%TYPE);
PROCEDURE sel_emp_dept
(p_emp_id IN employees.employee_id%TYPE,
END emp_dept_pkg;
(1) Points
True (*)
False
Correct Correct
8. What is the correct format to declare a variable using the following
emp_pkg package composite data type? TYPE emprec_type IS TABLE OF employees%ROWTYPE
INDEX BY BINARY_INTEGER; Mark for Review
(1) Points
v_emp_table emprec_type.emp_pkg;
None of these.
emprec_type.emp_pkg;
emp_pkg.emprec_type;
9. How would you invoke the constant km_to_mile from the global_consts
bodiless package at VARIABLE A?
SELECT trail_name, distance_in_km * VARIABLE A
FROM trails
(1) Points
global_consts.km_to_mile (*)
km_to_mile.global_consts
global_consts (km_to_mile)
km_to_mile (global_consts)
10. When using a package function in DML statements, which rules must you
follow? (Choose three) Mark for Review
(1) Points
Changes to a package variable could have an impact on another stored function (*)
Can read or modify the table being changed by that DML statement
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
(1) Points
True
False (*)
Correct Correct
12. When one component of a package is called, all the package's components
are loaded into memory. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
(0) Points
All of these.
emp_sal(101);
None of these.
scott.emp_pkg.emp_sal(101): (*)
emp_pkg.emp_sal(101);
Correct Correct
14. Your schema contains a package called EMP_PKG. You want to remove the
package body but not the specification. The correct syntax to do this is: DROP BODY emp_pkg; True
or False? Mark for Review
(1) Points
True
False (*)
(1) Points
True
False (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
1. Suppose you want to automatically execute some code every time you make
the first call to a package in your session? For example, you want to automatically load a tax rate
into a package variable.
(1) Points
None of these.
forward declaration
bodiless package
Correct Correct
(1) Points
1 and 4
3 and 4
1 and 3 (*)
2 and 3
1 and 2
Correct Correct
END emppack;
-- Line A
BEGIN
RAISE_APPLICATION_ERROR(-20201,'Invalid salary');
END IF;
END upd_emp;
BEGIN
END IF;
END sal_ok;
END emppack;
What must be coded at Line A for this package to compile successfully?
(1) Points
FUNCTION sal_ok;
Correct Correct
(1) Points
True
False (*)
Correct Correct
(1) Points
It is an anonymous block at the end of a package body which executes automatically the first
time each user session invokes a subprogram in the package. (*)
It is a named procedure in a package which must be invoked by a user before any other part
of the package can be invoked.
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 10 Quiz
(1) Points
None of these.
DESCRIBE emp_pack
(*)
DESCRIBE emp_pack.del_emp
DESCRIBE emp_pack.show_emp
DESCRIBE del_emp
DESCRIBE show_emp
Correct Correct
7. Which of the following statements about packages is NOT true ? Mark for
Review
(1) Points
Correct Correct
END dept_pack;
Which of the following are correct syntax for invoking the package subprograms? (Choose two.)
DECLARE
v_deptname VARCHAR2(20);
BEGIN
v_deptname := get_dept(50);
END;
BEGIN
dept_pack.get_dept(20);
END;
v_deptname VARCHAR2(20);
BEGIN
v_deptname := dept_pack.get_dept(40);
END;
(*)
BEGIN
dept_pack(30);
END;
BEGIN
dept_pack.ins_dept(20);
END;
(*)
Correct Correct
(1) Points
Specification
Body
None of these.
Correct Correct
10. 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 Correct
Section 10 Quiz
11. A package contains both public and private subprograms. Which one of the
following statements is true? Mark for Review
(1) Points
The whole package is loaded into memory when the first call is made to any subprogram in
the package. (*)
The public subprograms are all loaded into memory at the same time, but the private
subprograms are loaded into memory one at a time as they are invoked.
If three users invoke three different subprograms in the package, there will be three copies
of the code in memory.
Correct Correct
12. Your schema contains a package called EMP_PKG. You want to remove the
package body but not the specification. The correct syntax to do this is: DROP BODY emp_pkg; True
or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
(0) Points
scott.emp_pkg.emp_sal(101): (*)
None of these.
emp_pkg.emp_sal(101);
All of these.
emp_sal(101);
Correct Correct
14. Your schema contains four packages, each having a specification and a body.
You have also been granted privileges to access three packages (and their bodies) in other users'
schemas. What will be displayed by the following query?
(1) Points
6 (*)
14
7
Correct Correct
15. Package OLDPACK is in your schema. What will happen when the following
statement is executed?
(1) Points
Correct Correct