Beruflich Dokumente
Kultur Dokumente
Correct
Correct
None
Four
Two, because the cursor joins two tables
Three (*)
Correct
To display the fetched last name, what should you code at Point
A?
None of these.
v_emp_rec.last_name (*)
v_emp_rec(last_name)
last_name
v_emp_rec
Correct
5. The DEPARTMENTS table contains four columns. Examine the
following code: Mark for Review
(1) Points
DECLARE
CURSOR dept_curs IS
SELECT * FROM departments;
v_dept_rec dept_curs%ROWTYPE;
BEGIN
OPEN dept_curs;
FETCH dept_curs INTO v_dept_rec;
...
Correct
TO_CHAR(salary)
emp_record.salary (*)
emp_cursor.salary
employees.salary
emp_record.employees.salary
Correct
Correct
Correct
C,D,A,B
C,A,B,D
A,C,D,B
C,A,D,B (*)
Correct
Correct
Correct
TRUE
FALSE (*)
13. You want to use explicit cursors to fetch and display all
the countries in a specific region. There are 19 rows in Mark for
the WF_WORLD_REGIONS table. You want to use a Review
different region each time the cursor is opened. How
(1) Points
many cursors should you declare?
Correct
Correct
location_id
LOOP ... END LOOP;
null
p_loc_id
loc_rec.location_id (*)
Correct
16. Which of
the Mark for Review
following (1) Points
is a good
reason to
use two
cursors in
a single
PL/SQL
block?
When two tables are related to each other (often by a foreign key) and
we want to produce a multilevel report using data from both tables. (*)
To allow rows to be locked as they are FETCHed.
It is the only way to declare a cursor with a parameter.
To speed up the execution of the PL/SQL block.
To allow one cursor to be opened twice at the same time.
Correct
Section 6
(Answer all questions in this section)
v_dept_info_rec dept_info_type;
v_emp_dept_rec emp_dept_type;
one
three
two (*)
four
True (*)
False
Correct
Section 7
(Answer all questions in this section)
19. Examine the following code fragment. At Line A, you want to raise an
exception if the fetched salary value is greater than 30000. How can you do Mark for Review
this? (1) Points
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 100;
IF v_salary > 30000 THEN
-- Line A
END IF;
...
Correct
20. 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? Mark for Review
(1) Points
DECLARE
v_mgr_id employees.manager_id%TYPE;
BEGIN
SELECT manager_id INTO v_mgr_id FROM employees
WHERE employee_id = 100;
IF v_mgr_id IS NULL THEN
-- Line A
END IF;
...
TOO_MANY_ROWS (*)
OTHERS
ZERO_DIVIDE (*)
E_INSERT_EXCEP
NO_DATA_FOUND (*)
22. Which of the following are good practice guidelines for exception handling?
(Choose three.) Mark for Review
(1) Points
Correct
24. Examine the following code. Why does this exception handler not follow good
practice guidelines? Mark for Review
(1) Points
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 999;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('An error occurred');
END;
Correct
True
False (*)
TRUE (*)
FALSE
Correct
27. Department-id 99 does not exist. What will be displayed when the following
code is executed? Mark for Review
(1) Points
DECLARE
v_deptname departments.department_name%TYPE;
BEGIN
SELECT department_name INTO v_deptname
FROM departments WHERE department_id = 99;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20201,'Department does not exist');
END;
Correct
28. The following code does not violate any constraints and will not raise an
ORA-02292 error. What will happen when the code is executed? Mark for Review
(1) Points
BEGIN
DECLARE
e_constraint_violation EXCEPTION;
PRAGMA EXCEPTION_INIT(e_constraint_violation, -2292);
BEGIN
DBMS_OUTPUT.PUT_LINE('Inner block message');
END;
EXCEPTION
WHEN e_constraint_violation THEN
DBMS_OUTPUT.PUT_LINE('Outer block message');
END;
Correct
29. No employees exist in department 75. What will be displayed when this code
is executed? Mark for Review
(1) Points
DECLARE
v_last_name employees.last_name%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('A');
BEGIN
SELECT last_name INTO v_last_name
FROM employees WHERE department_id = 75;
DBMS_OUTPUT.PUT_LINE('B');
END;
DBMS_OUTPUT.PUT_LINE('C');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('D');
END;
A
D
(*)
A
None of these.
A
B
D
A
C
D
Section 8
(Answer all questions in this section)
30. A PL/SQL stored procedure can accept one or more input parameters and
can return one or more output values to the calling environment. True or Mark for Review
False? (1) Points
TRUE (*)
FALSE
Correct
31. You are
always able Mark for Review
to view and (1) Points
reload your
PL/SQL
stored
procedure's
code at a
later point
by clicking
on the
History
button in
the APEX
SQL
Commands
window.
True or
False?
True
False (*)
Correct
32. 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
myproc(40);
myproc(C => 25);
None of these. (*)
All of these.
myproc(10, B => 30, 50);
Correct
Correct
36. Procedure
TESTPROC Mark for
accepts Review
one
(1) Points
parameter
P1, whose
value is up
to 1000
characters
in length.
Which one
of the
following
declares
this
parameter
correctly?
(*)
CREATE PROCEDURE testproc
(p1 VARCHAR2(100) )
IS
BEGIN ....
CREATE PROCEDURE testproc
IS
p1 VARCHAR2(100);
BEGIN ....
CREATE PROCEDURE testproc
DECLARE
p1 VARCHAR2(100);
BEGIN ....
CREATE PROCEDURE testproc
p1 VARCHAR2
IS
BEGIN ....
Correct
Section 9
(Answer all questions in this section)
37. Which dictionary view will list all the PL/SQL subprograms in your schema?
Mark for Review
(1) Points
user_procedures
user_dependencies
user_objects (*)
user_source
user_subprograms
Correct
CHILD1 ends abruptly; PARENT handles the exception and then ends;
CHILD2 does not execute. (*)
PARENT handles the exception, and then CHILD1 continues to execute.
PARENT does not compile because you cannot use NULL; in an exception
handler.
CHILD1 ends abruptly, PARENT handles the exception, and then CHILD2
executes.
CHILD1 ends abruptly; PARENT also ends abruptly and returns an
unhandled exception.
Sally also grants EXECUTE privilege on the procedure to CURLY, but no other
privileges. What will happen when Curly executes the procedure?
The procedure will fail because Curly does not have SELECT privilege on
NEWEMP.
The procedure will execute successfully.
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.
Correct
40. 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 Mark for Review
Rights which contains the following code: (1) Points
HARRY now executes the procedure. Which employees table will be queried?
SYS.EMPLOYEES
DICK.EMPLOYEES
None of these.
HARRY.EMPLOYEES (*)
Correct
41. Which of
the Mark for
following Review
is a
(1) Points
benefit of
user-
defined
functions?
(Choose
3)
Correct
Correct
44. Your schema contains two procedures named CHILD1 and CHILD2. You now
create a third procedure by executing: Mark for Review
(1) Points
CREATE OR REPLACE PROCEDURE parent IS
BEGIN
child1;
child2;
END;
You now want user JOE to be able to invoke PARENT. Which of the following
gives JOE the privileges he needs, but no unnecessary privileges?
(*)
45. When a database object is first created, only its owner (creator) and the
Database Administrator are privileged to use it. True or False? Mark for Review
(1) Points
True (*)
False
Correct
46. To create a
function Mark for
successfully, Review
the
(1) Points
following
steps should
be
performed.
A Re-
execute the
code until it
compiles
correctly
B Write
the code
containing
the CREATE
or REPLACE
FUNCTION
followed by
the function
code
C Test the
function
from a SQL
statement
or an
anonymous
block
D If the
function
fails to
compile,
correct the
errors
E Load the
code into
Application
Express
F Execute
the code in
Application
Express
What is the
correct
order to
perform
these steps?
A,B,E,F,D,C
B,E,F,D,A,C (*)
B,C,E,F,D,A
D,B,E,F,A,C
Correct
Which variable is passed to the function and which variable is returned from
the function?
Correct
Correct
49. You want to see the names of all the columns in a table in your schema. You
want to query the Dictionary instead of using the DESCRIBE command. Mark for Review
Which Dictionary view should you query? (1) Points
USER_TAB_COLS (*)
USER_TABLES
USER_OBJECTS
USER_COLUMNS
Correct