Professional Documents
Culture Documents
DECLARE
v_dept_rec departments%ROWTYPE;
...
(1) Points
True (*)
False
[Correct] Correct
(1) Points
It must contain one or more components, but all the components must have scalar datatypes.
(*)
6 Lesson 1.
3. Which of the following will successfully create a record type containing two
fields, and a record variable of that type? Mark for Review
(1) Points
(l_name VARCHAR2(20),
gender CHAR(1));
(l_name VARCHAR2(20),
gender CHAR(1));
person_rec person_type;
(*)
gender CHAR(1));
gender CHAR(1));
person_rec person_type;
6 Lesson 1.
Section 1
1. To declare an INDEX BY table, we must first declare a type and then declare a
collection variable of that type. True or False? Mark for Review
(1) Points
True (*)
False
6 Lesson 2.
(1) Points
DROP
FIRST (*)
EXISTS (*)
COUNT (*)
PREVIOUS
6 Lesson 2.
(1) Points
DECLARE
INDEX BY BINARY_INTEGER;
(*)
DECLARE
INDEX BY BINARY_INTEGER;
DECLARE
TYPE t_depttab IS TABLE OF departments%ROWTYPE
INDEX BY NUMBER;
DECLARE
INDEX BY BINARY_INTEGER;
6 Lesson 2.
4. What is the largest number of elements (i.e., records) that an INDEX BY table of
records can contain? Mark for Review
(1) Points
100
4096
32767
Many millions of records because a BINARY_INTEGER or PLS_INTEGER can have a very large
value (*)
6 Lesson 2.
5. Which of these PL/SQL data structures could store a complete copy of the
employees table, i.e., 20 complete table rows? Mark for Review
(1) Points
A record
An INDEX BY table
6 Lesson 2.
6. Which of these PL/SQL data structures can NOT store a collection? Mark
for Review
(1) Points
6 Lesson 2.
Section 1
1. Which of the following is NOT a predefined Oracle Server error? Mark for
Review
(1) Points
e_sal_too_high EXCEPTION; (*)
DUP_VAL_ON_INDEX
TOO_MANY_ROWS
ZERO_DIVIDE
NO_DATA_FOUND
7 Lesson 2.
2. Which of the following best describes a predefined Oracle Server error? Mark
for Review
(1) Points
Has a standard Oracle error number and a standard name which can be referenced in the
EXCEPTION section (*)
Has a standard Oracle error number but must be declared and named by the PL/SQL
programmer
Is not raised automatically but must be declared and raised explicitly by the PL/SQL programmer
7 Lesson 2.
3. Which kind of error can NOT be handled by PL/SQL? Mark for Review
(1) Points
User-defined errors
7 Lesson 2.
4. Examine the following code. At Line A, you want to raise an exception if the
employee's manager_id is null. What kind of exception is this?
DECLARE
v_mgr_id employees.manager_id%TYPE;
BEGIN
-- Line A
END IF;
...
(1) Points
A constraint violation
A NO_DATA_FOUND exception
A predefined Oracle Server exception
[Correct] Correct
5. How would you trap Oracle Server exception ORA-01403: no data found?
Mark for Review
(1) Points
6. No employees exist whose salary is less than 2000. Which exception handlers
would successfully trap the exception that will be raised when the following code is executed? (Choose
two.)
DECLARE
v_count NUMBER;
BEGIN
EXCEPTION ...
END;
(1) Points
OTHERS (*)
SQL%ROWCOUNT = 0
NO_DATA_FOUND
ZERO_DIVIDE (*)
OTHER
7 Lesson 2.
(1) Points
DECLARE
e_not_null EXCEPTION;
BEGIN
VALUES(null, 'Marketing');
EXCEPTION
DBMS_OUTPUT.PUT_LINE('Cannot be null');
END;
(1) Points
The code will not execute because PRAGMA EXCEPTION_INIT must be coded in the DECLARE
section. (*)
The code will not execute because the syntax of PRAGMA EXCEPTION_INIT is wrong.
The exception will be raised and "Cannot be null" will be displayed.
The code will not execute because the syntax of the INSERT statement is wrong.
7 Lesson 2.
9. Examine the following code. The UPDATE statement will raise an ORA-02291
exception.
BEGIN
EXCEPTION
END;
(1) Points
The code will execute and insert error number 02291 into error_log_table.
The code will fail because we access error message numbers by using SQLERRNUM, not
SQLCODE.
The code will fail because SQLCODE has not been declared.
The code will fail because we cannot use functions like SQLCODE directly in a SQL statement. (*)
[Correct] Correct
10. Which type of exception MUST be explicitly raised by the PL/SQL programmer?
Mark for Review
(1) Points
11. A PL/SQL block executes and an Oracle Server exception is raised. Which of the
following contains the text message associated with the exception? Mark for Review
(1) Points
SQLCODE
SQLERRM (*)
SQL%MESSAGE
SQL_MESSAGE_TEXT
[Correct] Correct
12. Which one of the following events would implicitly raise an exception? Mark
for Review
(1) Points
7 Lesson 2.
1. Which of the following is NOT an advantage of including an exception handler in a PL/SQL block?
Mark for Review
(1) Points
Code is more readable because error-handling routines can be written in the same block in
which the error occurred
Prevents errors from being propagated back to the calling environment
7 Lesson 1.
(1) Points
A compile-time error occurs because the PL/SQL code references a non-existent table.
An error occurs during the execution of the block, which disrupts the normal operation of the
program. (*)
The programmer forgets to declare a cursor while writing the PL/SQL code.
(1) Points
Any other kind of exception that can occur within the block
7 Lesson 1.
4. Only one exception at a time can be raised during one execution of a PL/SQL
block. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
(1) Points
EXCEPTION
END;
(*)
EXCEPTION
END;
EXCEPTION
END;
EXCEPTION
END;
(*)
EXCEPTION
END;
(*)
7 Lesson 1.
EXCEPTION
THEN statement_1;
statement_2;
WHEN OTHERS
THEN statement_3;
END;
(1) Points
True (*)
False
[Correct] Correct
7. Which of the following are NOT good practice guidelines for exception
handling? (Choose two.) Mark for Review
(1) Points
Include a WHEN OTHERS handler as the first handler in the exception section. (*)
Handle specific named exceptions where possible, instead of relying on WHEN OTHERS.
Test your code with different combinations of data to see what potential errors can happen.
7 Lesson 1.
8. Examine the following code. Why does this exception handler not follow good
practice guidelines? (Choose two.)
DECLARE
v_dept_name departments.department_name%TYPE;
BEGIN
EXCEPTION
END;
(1) Points
The exception section should include a WHEN TOO_MANY_ROWS exception handler. (*)
The exception handler should test for the named exception NO_DATA_FOUND. (*)
7 Lesson 1.
(1) Points
An exception which is not raised automatically by the Oracle server, but must be declared and
raised explicitly by the PL/SQL programmer. (*)
An exception which has a predefined Oracle error number but no predefined name.
An exception handler which the user (the programmer) includes in the EXCEPTION section.
7 Lesson 3.
(1) Points
BOOLEAN
VARCHAR2
EXCEPTION (*)
NUMBER
[Correct] Correct
BEGIN
IF SQL%ROWCOUNT = 0 THEN
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
END;
(1) Points
You cannot explicitly raise predefined Oracle Server errors such as NO_DATA_FOUND.
7 Lesson 3.
DECLARE
e_myexcep EXCEPTION;
BEGIN
DBMS_OUTPUT.PUT_LINE('Message 1');
RAISE e_myexcep;
DBMS_OUTPUT.PUT_LINE('Message 2');
EXCEPTION
DBMS_OUTPUT.PUT_LINE('Message 3');
RAISE e_myexcep;
DBMS_OUTPUT.PUT_LINE('Message 4');
END;
(1) Points
Message 1
Message 3
The code will not execute because it contains at least one syntax error.
The code will execute but will return an unhandled exception to the calling environment.
(*)
Message 1
Message 2
Message 3
Message 4
Message 1
Message 3
Message 4
7 Lesson 3.
(1) Points
True
False (*)
[Correct] Correct
(1) Points
By PRAGMA EXCEPTION_INIT
None of the above. They are raised automatically by the Oracle server.
7 Lesson 3.
(1) Points
Declare, Raise, Handle (*)
7 Lesson 3.
8. You want to display your own error message to the user. What is the correct
syntax to do this? Mark for Review
(1) Points
RAISE application_error;
7 Lesson 3.
(1) Points
True (*)
False
[Correct] Correct
(1) Points
True
False (*)
7 Lesson 4.
DECLARE
e_outer_excep EXCEPTION;
BEGIN
DECLARE
e_inner_excep EXCEPTION;
BEGIN
RAISE e_outer_excep;
END;
EXCEPTION
DBMS_OUTPUT.PUT_LINE('Outer raised');
DBMS_OUTPUT.PUT_LINE('Inner raised');
END;
(1) Points
The code will fail to compile because e_inner_excep was declared but never RAISEd.
The code will fail to compile because e_inner_excep cannot be referenced in the outer block. (*)
The code will execute successfully and 'Outer Raised' will be displayed.
The code will propagate the e_outer_excep back to the calling environment (Application
Express).
[Correct] Correct
DECLARE
e_excep1 EXCEPTION;
e_excep2 EXCEPTION;
BEGIN
RAISE e_excep1;
EXCEPTION
END;
It will fail to compile because you cannot have a subblock inside an exception section.
It will fail to compile because you cannot declare more than one exception in the same block.
It will compile successfully and return an unhandled e_excep2 to the calling environment. (*)
7 Lesson 4.
5. There are three employees in department 90. What will be displayed when this
code is executed?
DECLARE
v_last_name employees.last_name%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('Message 1');
BEGIN
END;
DBMS_OUTPUT.PUT_LINE('Message 3');
EXCEPTION
DBMS_OUTPUT.PUT_LINE('Message 4');
END;
(1) Points
Message 1
Message 3
Message 4
Message 1
Message 4
(*)
Message 1
7 Lesson 4.
<<outer>>
DECLARE
v_myvar NUMBER;
BEGIN
v_myvar := 25;
DECLARE
BEGIN
outer.v_myvar := 30;
v_myvar := v_myvar / 0;
outer.v_myvar := 35;
END;
v_myvar := 40;
EXCEPTION
DBMS_OUTPUT.PUT_LINE(v_myvar);
END;
Mark for Review
(1) Points
30 (*)
100
40
35
25
7 Lesson 4.
Section 1
1. Which of the following are characteristics of anonymous PL/SQL blocks but not
PL/SQL subprograms? (Choose three.) Mark for Review
(1) Points
(Choose all correct answers)
8 Lesson 1.
(1) Points
True
False (*)
8 Lesson 1.
3. Which of the following are benefits of using PL/SQL subprograms rather than
anonymous blocks? (Choose three.) Mark for Review
(1) Points
Stored externally
8 Lesson 1.
4. PL/SQL subprograms, unlike anonymous blocks, are compiled each time they
are executed. True or False? Mark for Review
(1) Points
True
False (*)
8 Lesson 1.
(1) Points
A SELECT statement
An action (*)
A return of values
[Correct] Correct
v_empid employees.empid%TYPE;
BEGIN
(1) Points
The statement will fail because you cannot declare variables such as v_empid inside a
procedure.
The statement will fail because the last line of code should be END my_proc; (*)
The statement will raise a NO_DATA_FOUND exception because region_id 999 does not exist.
[Correct] Correct
(1) Points
REPLACE
END (*)
BEGIN (*)
DECLARE
EXCEPTION
8 Lesson 1.
A calling application
A SELECT statement
(1) Points
A and C
A, B, and D (*)
A and B
A only
B and C
[Correct] Correct
BEGIN
add_dept;
END;
(1) Points
True (*)
False
[Correct] Correct
10. 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) Points
11. When modifying procedure code, the procedure code statement must be re-
executed to validate and store it in the database. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. A nested subprogram can be called from the main procedure or from the calling
environment. True or False? Mark for Review
(1) Points
True
False (*)
8 Lesson 1.
...
IS
...
BEGIN
...
subproc (...);
...
END;
(1) Points
8 Lesson 1.
1. Which of the following best describes the difference between a parameter and
an argument? Mark for Review
(1) Points
They are both names of variables. A parameter is passed into the procedure, while an argument
is passed out of the procedure.
A parameter is the name of a variable, while an argument is the datatype of that variable.
A parameter is a variable that accepts a value that is passed to it, while an argument is the value
that is passed. (*)
8 Lesson 2.
2. What is the correct syntax to create procedure MYPROC that accepts two
number parameters X and Y? Mark for Review
(1) Points
8 Lesson 2.
(1) Points
An expression
8 Lesson 2.
IS BEGIN ....
You want to call the procedure from an anonymous block. Which of the following calls is valid?
(1) Points
myproc(p_left, p_right);
myproc(v_left, v_right);
myproc(v_left, 30);
8 Lesson 2.
(1) Points
They allow values to be passed between the calling environment and the procedure. (*)
8 Lesson 2.
(p_param VARCHAR2)
IS BEGIN ...
DECLARE
BEGIN
subproc(v_param);
END;
(1) Points
p_param
v_param (*)
Smith'
8 Lesson 2.
7. Which one of the following statements about formal and actual parameters is
true? Mark for Review
(1) Points
A formal parameter is declared within the called procedure, while an actual parameter is
declared in the calling environment. (*)
An actual parameter is declared within the called procedure.
8 Lesson 2.
(1) Points
(p1 VARCHAR2(100) )
IS
BEGIN ....
IS
p1 VARCHAR2(100);
BEGIN ....
p1 VARCHAR2(100);
BEGIN ....
p1 VARCHAR2
IS
BEGIN ....
(p1 VARCHAR2)
IS
BEGIN ....
(*)
8 Lesson 2.
(1) Points
(v_num NUMBER(6,2))
(v_num)
(v_num NUMBER(4,2))
[Correct] Correct
1. What are the three parameter modes for procedures? Mark for Review
(1) Points
8 Lesson 3.
2. 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)
8 Lesson 3.
3. Which of the following statements about IN OUT parameters are true? (Choose
two.) Mark for Review
(1) Points
The parameter value passed into the subprogram is always returned unchanged 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 the procedure. (*)
8 Lesson 3.
4. When creating a procedure, where in the code must the parameters be listed?
Mark for Review
(1) Points
8 Lesson 3.
myproc('Smith',100,5000);
(1) Points
Positional (*)
Named
8 Lesson 3.
myproc('Smith',salary=>5000);
(1) Points
Positional
Named
[Correct] Correct
(1) Points
OUT (*)
IN
CONSTANT
R(ead)
W(rite)
8 Lesson 3.
IS BEGIN ...
Which one of the following calls to the procedure will NOT work?
(1) Points
myproc(80, 'Smith');
8 Lesson 3.
(p_name VARCHAR2 ,
add_employee('Jones');
(1) Points
NULL
1000 (*)
The procedure will not compile because P_SALARY should have been coded as DEFAULT 1000
The call will fail because P_SALARY is a required parameter
8 Lesson 3.
10. What will happen when the following procedure is called as format_phone
(8005551234)?
BEGIN
p_phone_no := SUBSTR(p_phone_no,1,3) ||
'.' || SUBSTR(p_phone_no,4,3) ||
'.' || SUBSTR(p_phone_no,7);
END format_phone;
(1) Points
The procedure does not execute because the input variable is not properly declared.
8 Lesson 3.
You want to call the procedure, passing arguments of 10 for X and 20 for Z. Which one of the following
calls is correct?
(1) Points
numproc(10,,20);
numproc(x=10,z=20);
numproc(10,z=>20); (*)
numproc(x=>10,20);
8 Lesson 3.
(1) Points
9 Lesson 1.
2. A PL/SQL function can have IN OUT parameters. True or False? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
RETURN number
IS
v_sal employees.salary%TYPE := 0;
BEGIN
FROM employees
RETURN v_sal;
END get_sal;
Which variable is passed to the function and which variable is returned from the function?
9 Lesson 1.
(1) Points
v_name := get_country_name(100);
DBMS_OUTPUT.PUT_LINE(get_country_name(100));
SELECT get_country_name(100) FROM dual;
[Correct] Correct
(p_emp_id IN employees.employee_id%TYPE)
DECLARE
v_mynum NUMBER(6,2);
v_mydate DATE;
BEGIN
... Line A
END;
find_sal(100,v_mynum);
v_mydate := find_sal(100);
find_sal(v_mynum,100);
9 Lesson 1.
(1) Points
DBMS_OUTPUT.PUT_LINE(get_job(100));
v_job_id := get_job(100);
9 Lesson 1.
7. Function MYFUNC1 has been created, but has failed to compile because it
contains syntax errors. We now try to create procedure MYPROC1 which invokes this function. Which of
the following statements is true? Mark for Review
(1) Points
MYPROC1 will compile and execute successfully, except that the call to MYFUNC1 will be treated
as a comment and ignored.
9 Lesson 1.
(1) Points
An exception section
IN parameters
[Correct] Correct
(1) Points
p1 can be invoked from an anonymous block but f1 cannot.
p1 can have as many IN parameters as needed but f1 cannot have more than two IN
parameters.
There is no difference because they both return a single value of the same datatype.
9 Lesson 1.
(sal employees.salary%TYPE,
comm_pct IN employees.commission%TYPE)
RETURN NUMBER(5,2)
IS
BEGIN
END annual_comp;
9 Lesson 1.
(sal employees.salary%type,
comm_pct In employees.commission%type)
...
(1) Points
Execute dbms_output.put_line(annual_comp (1000,.2));
from employees;
Declare
Begin
...
Ann_comp := annual_comp(1000,.2);
...
End;
9 Lesson 1.
(1) Points
B,E,F,D,A,C (*)
D,B,E,F,A,C
B,C,E,F,D,A
A,B,E,F,D,C
[Correct] Correct
13. When using Invoker's rights, the invoker needs privileges on the database
objects referenced within the subprogram, as well as GRANT privilege on the procedure. True or False?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
PROCEDURE at_proc IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
UPDATE
INSERT
END at_proc;
(1) Points
The subprogram will work without errors
The subprogram will fail because of an error in the SELECT statement. (*)
9 Lesson 6.
15. A function may execute more than one RETURN statement found in the body of
that function. True or False? Mark for Review
(1) Points
True
False (*)
9 Lesson 6.
1. Which of the following is NOT a benefit of user-defined functions? Mark for Review
(1) Points
They can add business rules to the database and can be reused many times.
They can do the same job as built-in system functions such as UPPER and ROUND. (*)
9 Lesson 2.
2. User-defined functions can extend the power of SQL statements where Oracle
does not provide ready-made functions such as UPPER and LOWER. True or False? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
3. Which of the following is NOT a legal location for a function call in a SQL
statement? Mark for Review
(1) Points
[Correct] Correct
4. The following function has been created:
(p_dept_id IN departments.department_id%TYPE)
RETURN NUMBER IS
BEGIN
RETURN p_dept_id;
END;
(1) Points
SELECT upd_dept(department_id)
FROM employees;
SELECT upd_dept(80)
FROM dual;
[Correct] Correct
5. You want to create a function which can be used in a SQL statement. Which one
of the following can be coded within your function? Mark for Review
(1) Points
RETURN BOOLEAN
Onqters (*)
An OUT parameter
COMMIT;
9 Lesson 2.
(1) Points
9 Lesson 2.
1. Which of the following best describes the Data Dictionary? Mark for Review
(1) Points
It is a set of tables which can be updated by any user who has the necessary privileges.
It is an automatically managed master catalog of all the objects stored in the database. (*)
It contains a list of all database tables which are not in any schema.
[Correct] Correct
2. Which of the following is NOT a benefit of the Data Dictionary? Mark for
Review
(1) Points
It allows us to remind ourselves of the names of our tables, in case we have fogotten them.
It allows us to check which system privileges have been granted to us.
It will speed up the execution of SELECT statements in which the WHERE clause column is not
indexed. (*)
It allows the PL/SQL compiler to check for object existence; for example, when creating a
procedure which references a table, the PL/SQL compiler can check that the table exists.
9 Lesson 3.
3. User BOB is not a database administrator. BOB wants to see the names of all the
tables in his schema, as well as all the tables in other users' schemas which he has privileges to use.
Which Data Dictionary view would BOB query to do this? Mark for Review
(1) Points
USER_TABLES
ALL_TABLES (*)
DBA_TABLES
USER_TAB_COLUMNS
9 Lesson 3.
(1) Points
SELECT index_name
FROM user_indexes
(1) Points
fn_index
FN_INDEX
fn_index FN_INDEX
6. Which of the following will display how many objects of each type are in a user's
schema? Mark for Review
(1) Points
SELECT COUNT(*)
FROM user_objects;
FROM user_objects
GROUP BY object_type;
(*)
FROM all_objects
GROUP BY object_type;
DESCRIBE user_objects
GROUP BY object_type;
9 Lesson 3.
(1) Points
We can use it like a Web search engine to remind ourselves of the names of dictionary views.
8. You have forgotten the name of the Dictionary view USER_TABLES. Which of the
following statements is the best and quickest way to remind yourself? Mark for Review
(1) Points
(*)
[Correct] Correct
v_last_name employees.last_name%TYPE;
BEGIN
/* This SELECT will raise an exception because employee_id 999 does not exist */
END;
BEGIN
proc_a;
EXCEPTION
END;
What will be displayed when proc_b is executed?
(1) Points
An exception occurred
(*)
An exception occurred
BEGIN
EXCEPTION
END;
When call_ins_emp is executed, assuming AutoCommit is turned on, which rows will be inserted into
the EMPLOYEES table?
(1) Points
99 only (*)
99 and 999
All three rows will be inserted
999 only
9 Lesson 4.
3. The database administrator has granted the DROP ANY PROCEDURE privilege to
user KIM. This allows Kim to remove other users' procedures and functions from the database. How
would Kim now drop function GET_EMP, which is owned by user MEHMET? Mark for Review
(1) Points
9 Lesson 4.
4. You need to remove procedure BADPROC from your schema. What is the
correct syntax to do this? Mark for Review
(1) Points
9 Lesson 4.
5. Which view would you query to see the detailed code of a procedure? Mark
for Review
(1) Points
user_source (*)
user_procedures
user_objects
user_dependencies
user_errors
9 Lesson 4.
6. Which dictionary view will list all the PL/SQL subprograms in your schema?
Mark for Review
(1) Points
user_source
user_procedures
user_objects (*)
1. Procedure GET_EMPS includes a SELECTFROM EMPLOYEES. The procedure was created using
Invoker's Rights. Which of the following statements are true? (Choose three.) Mark for Review
(1) Points
The user who executes the procedure needs EXECUTE privilege on the procedure. (*)
The user who executes the procedure does not need any privileges.
The user who executes the procedure needs SELECT privilege on EMPLOYEES. (*)
9 Lesson 6.
(1) Points
AUTHID CURRENT_USER
BEGIN ...
AUTHID CURRENT_USER IS
BEGIN ...
(*)
BEGIN ...
BEGIN
AUTHID CURRENT_USER ...
[Correct] Correct
3. User SALLY's schema contains a NEWEMP table. Sally uses Invoker's rights to
create procedure GET_NEWEMP which includes the line:
Sally also grants EXECUTE privilege on the procedure to CURLY, but no other privileges. What will
happen when Curly executes the procedure?
(1) Points
The procedure will fail because Curly does not have SELECT privilege on NEWEMP.
The procedure will fail because there is no NEWEMP table in Curly's schema. (*)
The procedure will fail because Curly does not have the EXECUTE ANY PROCEDURE system
privilege.
9 Lesson 6.
4. Users SYS (the DBA), TOM, DICK, and HARRY each have an EMPLOYEES table in
their schemas. SYS creates a procedure DICK.SEL_EMP using Invoker's Rights which contains the
following code:
HARRY now executes the procedure. Which employees table will be queried?
(1) Points
SYS.EMPLOYEES
DICK.EMPLOYEES
HARRY.EMPLOYEES (*)
5. When using Invoker's rights, the invoker needs privileges on the database
objects referenced within the subprogram, as well as GRANT privilege on the procedure. True or False?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
PROCEDURE at_proc IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
UPDATE ...
INSERT ...
COMMIT;
END at_proc;
(1) Points
9 Lesson 6.
(1) Points
True
False (*)
9 Lesson 6.
1. User SVETLANA creates a view called EMP_VIEW that is based on a SELECT from her EMPLOYEES
table. Svetlana now wants user PHIL to be able to query the view. What is the smallest set of object
privileges that Svetlana must grant to Phil? Mark for Review
(1) Points
[Correct] Correct
2. User COLLEEN owns an EMPLOYEES table and wants to allow user AYSE to
create indexes on the table. Which object privilege must Colleen grant to Ayse? Mark for Review
(1) Points
SELECT on EMPLOYEES
ALTER on EMPLOYEES
CREATE on EMPLOYEES
9 Lesson 5.
3. User FRED creates a procedure called DEL_DEPT using Definer's Rights, which
deletes a row from Fred's DEPARTMENTS table. What privilege(s) will user BOB need to be able to
execute Fred's procedure? Mark for Review
(1) Points
EXECUTE on DEL_DEPT (*)
DELETE on FRED.DEPARTMENTS
9 Lesson 5.
USERC needs to execute UserB's procedure. What privileges are needed for this to work correctly?
(Choose two.)
(1) Points
9 Lesson 5.
5. User DIANE owns a DEPARTMENTS table. User JOEL needs to update the
location_id column of Diane's table, but no other columns. Which SQL statement should Diane execute
to allow this? Mark for Review
(1) Points
9 Lesson 5.
6. User TOM needs to grant both SELECT and INSERT privileges on both his
EMPLOYEES and DEPARTMENTS tables to both DICK and HARRY. What is the smallest number of GRANT
statements needed to do this? Mark for Review
(1) Points
2 (*)
3
[Correct] Correct
user_dependencies
user_subprograms
9 Lesson 4.
(1) Points
procedures
variables
PL/SQL types
Exceptions
10 Lesson 1.
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, applications which invoke the package do not need to be
recompiled.
[Correct] Correct
(1) Points
Body (*)
Specification
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
10 Lesson 1.
(1) Points
Body
Specification
Body and the specification (*)
[Correct] Correct
(1) Points
True
False (*)
[Correct] Correct
END dept_pack;
Which of the following are correct syntax for invoking the package subprograms? (Choose two.)
(1) Points
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;
10 Lesson 1.
(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
10 Lesson 1.
(1) Points
True (*)
False
[Correct] Correct
(1) Points
True
False (*)
10 Lesson 2.
PROCEDURE proc1;
END mypack;
The package body of mypack also includes a function called func1. Which of the following statements
are true? (Choose three.)
(1) Points
(*)
The package will not compile because you cannot declare variables in the specification, only
procedures and functions. .
BEGIN
mypack.percent_tax := 10;
END;
(*)
The function can be invoked from outside the package.
BEGIN
mypack.proc1;
END;
(*)
10 Lesson 2.
4. We want to remove both the specification and the body of package CO_PACK
from the database. Which of the following commands will do this? Mark for Review
(1) Points
10 Lesson 2.
5. Which one of the following queries would you use to see the detailed code of a
package called EMP_PKG? Mark for Review
(1) Points
SELECT text FROM user_source WHERE name = 'EMP_PKG' AND type = 'PACKAGE' ORDER BY
line;
SELECT source FROM user_packages WHERE name = 'EMP_PKG' AND type = 'PACKAGE BODY'
ORDER BY line;
SELECT text FROM all_source WHERE name = 'EMP_PKG' AND type = 'PACKAGE' ORDER BY line;
SELECT text FROM user_source WHERE name = 'EMP_PKG' AND type = 'PACKAGE BODY' ORDER
BY line; (*)
[Correct] Correct
(0) Points
The names of all package specifications and package bodies in the user's schema (*)
The parameters which must be used when invoking all packaged subprograms in the user's
schema
[Correct] Correct
7. 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
10 Lesson 2.
(1) Points
True
False (*)
[Correct] Correct
9. 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 (*)
10 Lesson 2.
(0) Points
emp_pkg.emp_sal(101);
scott.emp_pkg.emp_sal(101): (*)
emp_sal(101);
[Correct] Correct
Section 1
1. Which two of these functions could not be in the same package? 1. FUNCTION
get_emp (p1 DATE) RETURN VARCHAR2; 2. FUNCTION get_emp (p1 DATE, p2 NUMBER) RETURN
VARCHAR2; 3. FUNCTION get_emp (p1 DATE, p2 NUMBER) RETURN NUMBER; 4. FUNCTION get_emp
(p1 NUMBER, p2 DATE) RETURN VARCHAR2; Mark for Review
(1) Points
1 and 2
1 and 4
2 and 4
2 and 3 (*)
3 and 4
10 Lesson 3.
END over_pack;
over_pack.do_work1('Smith',20);
over_pack.do_work2('Smith',20); (*)
over_pack.do_work1(p1=>'Smith',p2=>20); (*)
over_pack.do_work1(param1=>'Smith');
10 Lesson 3.
(1) Points
True (*)
False
10 Lesson 3.
(1) Points
True
False (*)
10 Lesson 3.
(1) Points
The function can include a COMMIT.
10 Lesson 3.
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
(1) Points
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Any message');
END;
END forward_pack;
(*)
PROCEDURE proc2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Any message');
END;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
END forward_pack;
PROCEDURE proc2;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Any message');
END;
END forward_pack;
PROCEDURE proc1;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
proc1;
END;
END forward_pack;
(*)
PROCEDURE proc2;
PROCEDURE proc1 IS
BEGIN
proc2;
END;
PROCEDURE proc2 IS
BEGIN
proc1;
END;
END forward_pack;
10 Lesson 3.
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.
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. (*)
Because it is an anonymous block, it cannot be invoked and therefore will never execute. It is
treated as a set of comments.
10 Lesson 3.
(1) Points
Procedures only
Functions only
10 Lesson 3.
e_cons_violation EXCEPTION;
e_value_too_large EXCEPTION;
END exceptions_pkg;
(1) Points
True (*)
False
[Correct] Correct
11. How would you invoke the constant km_to_mile from the global_consts
bodiless package at VARIABLE A?
FROM trails
(1) Points
km_to_mile.global_consts
km_to_mile (global_consts)
global_consts.km_to_mile (*)
global_consts (km_to_mile)
10 Lesson 3.
12. When using a package function in DML statements, which rules must you
follow? (Choose three) Mark for Review
(1) Points
Can read or modify the table being changed by that DML statement
Changes to a package variable could have an impact on another stored function (*)
10 Lesson 3.
13. The following example package specification is valid to create a data type
ed_type that can be used in other subprograms. True or False?
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
14. INDEX BY is missing from the empt_tab TYPE declaration. What is the most
efficient declaration?
CREATE OR REPLACE PACKAGE emp_pkg IS
END emp_pkg;
(1) Points
INDEX BY INTEGER
INDEX BY BINARY
INDEX ALL
10 Lesson 3.