Documente Academic
Documente Profesional
Documente Cultură
Correct
2. Which one of the following queries would you use to see the detailed code of a Mark for Review
package called EMP_PKG?
(1) Points
Correct
3. When one component of a package is called, all the package's components are Mark for Review
loaded into memory. True or False?
(1) Points
True (*)
False
Correct
4. A local variable defined inside a package procedure is visible to the calling Mark for Review
environment. True or False?
(1) Points
True
False (*)
Correct
5. We want to remove the specification (but not the body) of package BIGPACK Mark for Review
from the database. Which of the following commands will do this?
(1) Points
Correct
Section 10
(Answer all questions in this section)
The package body of TAXPACK also includes a function called TAXFUNC. Which one of
the following statements is NOT true?
(*)
TAXPROC can open the cursor.
The procedure can be invoked by:
BEGIN
taxpack.taxproc;
END;
Correct
7. We need to declare a package variable named MYVAR, which can be referenced by Mark for Review
any subprogram in the package but can NOT be referenced from outside the package.
In the following code, where should MYVAR be declared? (1) Points
CREATE OR REPLACE PACKAGE varpack IS
-- Point A
...
END varpack;
CREATE OR REPLACE PACKAGE BODY varpack IS
-- Point B
PROCEDURE varproc IS
-- Point C
BEGIN
...
END varproc;
PROCEDURE ...
...
-- Point D
END varpack;
Point D
Point C
Point B or Point C, they will both work
Point B (*)
Point A
Correct
The package body of mypack also includes a function called func1. Which of the
following statements are true? (Choose three.)
(*)
The package will not compile because you cannot declare variables in the
specification, only procedures and functions. .
The procedure can be invoked by:
BEGIN
mypack.proc1;
END;
(*)
The variable can be modified by:
BEGIN
mypack.percent_tax := 10;
END;
(*)
The function can be invoked from outside the package.
9. SCOTT's schema contains a package EMP_PKG which contains a public procedure Mark for Review
EMP_SAL which accepts a NUMBER parameter. Which of the following will invoke the
procedure successfully? (0) Points
emp_sal(101);
emp_pkg.emp_sal(101);
All of these.
None of these.
scott.emp_pkg.emp_sal(101): (*)
Correct
10. What will be displayed when a user executes the following statement? Mark for Review
Correct
Section 10
(Answer all questions in this section)
11. A package initialization block is executed automatically every time a user invokes any Mark for Review
procedure or function in the package. True or False?
(1) Points
True
False (*)
Correct
12. An package initialization block automatically executes once and is used to initialize Mark for Review
public and private package variables. True or False?
(1) Points
True (*)
False
13. The following call to the function tax in the taxes_pkg package is invalid for what Mark for Review
reason?
(1) Points
SELECT taxes_pkg.tax(salary), salary, last_name
FROM employees;
14. The following package is valid. True or False? Mark for Review
True (*)
False
Correct
15. Functions called from a SQL query or DML statement must not end the current Mark for Review
transaction, or create or roll back to a savepoint. True or False?
(1) Points
True (*)
False
Correct
Section 10
(Answer all questions in this section)
16. INDEX BY is missing from the emp_tab TYPE declaration. What is the most efficient Mark for Review
declaration?
(1) Points
CREATE OR REPLACE PACKAGE emp_pkg IS
TYPE emp_tab IS TABLE OF employees%ROWTYPE;
PROCEDURE get_employees(p_emp_table OUT emp_tab);
END emp_pkg;
INDEX BY INTEGER
INDEX ALL
INDEX BY BINARY_INTEGER (*)
INDEX BY BINARY
Correct
17. The following example package specification is valid to create a data type ed_type that Mark for Review
can be used in other subprograms. True or False?
(1) Points
CREATE OR REPLACE PACKAGE emp_dept_pkg
IS
TYPE ed_type IS RECORD (f_name employees.first_name%TYPE,
l_name employees.last_name%TYPE,
d_name departments.department_name%TYPE);
PROCEDURE sel_emp_dept
(p_emp_id IN employees.employee_id%TYPE,
p_emp_dept_rec OUT ed_type);
END emp_dept_pkg;
True (*)
False
Correct
18. Package TAXPACK declares a global variable G_TAXRATE NUMBER(2,2). The value of Mark for Review
the tax rate is stored in table TAXTAB in the database. You want to read this value
automatically into G_TAXRATE each time a user session makes its first call to (1) Points
TAXPACK. How would you do this?
(*)
Correct
19. How would you invoke the constant km_to_mile from the global_consts bodiless Mark for Review
package at VARIABLE A?
(1) Points
SELECT trail_name, distance_in_km * VARIABLE A
FROM trails
WHERE park_name = 'YOSEMITE';
global_consts (km_to_mile)
km_to_mile (global_consts)
km_to_mile.global_consts
global_consts.km_to_mile (*)
Correct
20. Package FORWARD_PACK contains two procedures: PROC1 is public while PROC2 is Mark for Review
private (not declared in the package specification). These procedures have no
parameters. Which of the following package bodies will NOT compile successfully? (1) Points
(Choose two.)
(*)
CREATE OR REPLACE PACKAGE BODY forward_pack IS
PROCEDURE proc2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Any message');
END;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
END forward_pack;
CREATE OR REPLACE PACKAGE BODY forward_pack IS
PROCEDURE proc2;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Any message');
END;
END forward_pack;
CREATE OR REPLACE PACKAGE BODY forward_pack IS
PROCEDURE proc1;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
proc1;
END;
END forward_pack;
(*)
CREATE OR REPLACE PACKAGE BODY forward_pack IS
PROCEDURE proc2;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
BEGIN
proc1;
END;
END forward_pack;
Correct
21. The following Mark for Review
package specification
has been created: (1) Points
CREATE OR REPLACE
PACKAGE mypack IS
FUNCTION
myfunc(p_funcparam
DATE) RETURN
BOOLEAN;
PROCEDURE
myproc(p_procparam
IN NUMBER);
END mypack;
Which of the
following will
correctly invoke the
package
subprograms?
(Choose two.)
mypack.myproc(35);
(*)
IF NOT mypack.myfunc(SYSDATE) THEN
DBMS_OUTPUT.PUT_LINE('Message');
END IF;
(*)
v_num := mypack.myproc(22);
mypack.myfunc('22-Jan-2007');
myproc(40);
Correct
22. Package EMP_PACK contains two procedures, DEL_EMP and Mark for Review
SHOW_EMP. You want to write an anonymous block which invokes
these procedures but you have forgotten which parameters they (1) Points
use. Which of the following will give you this information?
DESCRIBE emp_pack.del_emp
DESCRIBE emp_pack.show_emp
DESCRIBE emp_pack(del_emp, show_emp)
DESCRIBE emp_pack
(*)
None of these.
DESCRIBE del_emp
DESCRIBE show_emp
Correct
23. What is wrong with the following syntax for creating a package Mark for Review
specification?
(1) Points
CREATE OR REPLACE mypack IS
g_constant1 NUMBER(6) := 100;
PROCEDURE proc1 (p_param1 IN VARCHAR2);
PROCEDURE proc2;
END mypack;
(*)
You cannot declare constants in the specification.
A package must contain at least one function.
Correct
24. Which of the following statements about packages is NOT true ? Mark for Review
(1) Points
Correct
25. Which one of the following can NOT be part of a Package ? Mark for Review
(1) Points
Explicit cursors
Procedures
Functions
Global variables
Triggers (*)
Correct
Section 10
(Answer all questions in this section)
26. Package Specification DEPT_PACK was created by the following code: Mark for Review
Which of the following are correct syntax for invoking the package subprograms?
(Choose two.)
(*)
BEGIN
dept_pack.get_dept(20);
END;
BEGIN
dept_pack(30);
END;
DECLARE
v_deptname VARCHAR2(20);
BEGIN
v_deptname := get_dept(50);
END;
BEGIN
dept_pack.ins_dept(20);
END;
(*)
Correct
27. To be able to invoke a package subprogram from outside the package, it must be Mark for Review
declared in the package:
(1) Points
Correct
28. In which component of a package is the full definition of a public procedure written? Mark for Review
(1) Points
Specification
Neither the body nor the specification
Both the body and the specification
Body (*)
Correct
Section 11
(Answer all questions in this section)
29. The UTL_FILE package can be used to read and write binary files such as JPEGs as Mark for Review
well as text files. True or False?
(1) Points
True
False (*)
Correct
30. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside stored Mark for Review
subprograms such as procedures?
(1) Points
Correct
Section 11
(Answer all questions in this section)
31. The UTL_MAIL package allows sending email from the Oracle database to remote Mark for Review
recipients.
(1) Points
True (*)
False
Correct
32. DBMS_OUTPUT.PUT_LINE can be invoked from inside a private packaged function. Mark for Review
True or False?
(1) Points
True (*)
False
Correct
33. What will be displayed when the following code is executed? Mark for Review
(*)
I do like
to be
beside the seaside
Correct
34. The DBMS_OUTPUT gives programmers an easy-to-use interface to see, for instance, Mark for Review
the current value of a loop counter, or whether or not a program reaches a particular
branch of an IF statement. (True or False?) (1) Points
True (*)
False
Correct
35. Package CURSPACK declares a global cursor in the package specification. The package Mark for Review
contains three public procedures: OPENPROC opens the cursor; FETCHPROC fetches 5
rows from the cursor's active set; CLOSEPROC closes the cursor. (1) Points
What will happen when a user session executes the following commands in the order
shown?
curspack.openproc; -- line 1
curspack.fetchproc; -- line 2
curspack.fetchproc; -- line 3
curspack.openproc; -- line 4
curspack.fetchproc; -- line 5
curspack.closeproc; -- line 6
Correct
Section 11
(Answer all questions in this section)
36. In the following example, which statement best fits in Line 1? (Choose 1) Mark for Review
Correct
37. A package's state is initialized when the package is first loaded. True or False? Mark for Review
(1) Points
True (*)
False
Correct
38. Package MULTIPACK declares the following global variable: Mark for Review
g_myvar NUMBER;
(1) Points
User DICK executes the following:
multipack.g_myvar := 45;
User HAZEL now connects to the database. Both users immediately execute:
BEGIN
DBMS_OUTPUT.PUT_LINE(multipack.g_myvar);
END;
Correct
Section 12
(Answer all questions in this section)
39. What are benefits of using the NOCOPY hint? (Choose two) Mark for Review
(1) Points
(Choose all correct answers)
Correct
40. In the following example, where do you place the phrase DETERMINISTIC? Mark for Review
Position A
Position B (*)
Position C
Correct
Section 12
(Answer all questions in this section)
41. What is the correct syntax to use the RETURNING phrase at Position A? Mark for Review
42. FORALL can be used with any DML statement. True or False? Mark for Review
(1) Points
True (*)
False
Correct
43. The following example code will compile successfully. True or False? Mark for Review
True (*)
False
44. The following procedure compiles successfully. True or False? Mark for Review
True
False (*)
45. A public packaged procedure contains the following SQL statement: Mark for Review
UPDATE employees
SET salary = salary * 1.1; (1) Points
When is this SQL statement parsed?
Correct
Section 12
(Answer all questions in this section)
46. Only one call to DBMS_SQL is needed in order to drop a table. True or False? Mark for Review
(1) Points
True
False (*)
Correct
47. The following procedure adds a column of datatype DATE to the EMPLOYEES table. Mark for Review
The name of the new column is passed to the procedure as a parameter.
(1) Points
CREATE OR REPLACE PROCEDURE addcol
(p_col_name IN VARCHAR2) IS
v_first_string VARCHAR2(100) := 'ALTER TABLE EMPLOYEES ADD (';
v_second_string VARCHAR2(6) := ' DATE)';
BEGIN
... Line A
END;
Which of the following will work correctly when coded at line A? (Choose two.)
(*)
EXECUTE IMMEDIATE v_first_string || p_col_name || v_second_string;
(*)
v_first_string || p_col_name || v_second_string;
48. For which of the following is it necessary to use Dynamic SQL? (Choose three.) Mark for Review
(1) Points
Correct
49. What will happen when the following procedure is invoked? Mark for Review
Correct
50. Name two reasons for using Dynamic SQL. Mark for Review
(1) Points
Correct