Q1. Which guidelines should be considered when designing and using cursors in a PL/SQL block? ? (Choose all that apply.)
A. When fetching from a cursor, fetch into a record.
B. Use parameters with cursors so that the result set for the cursor is not tied to a specific variable in a program.
C. Use the %NOTFOUND attribute in combination with the SELECT INTO statement to check for non existent values.
D. Whenever possible, explicitly declare the cursor and use the OPEN, FETCH and CLOSE statements to manipulate the cursor instead of using cursor FOR loop.
E. When using data manipulation language statements, (DML) reference a SQL cursor attribute immediately after the DML statement executes in the same block.
Answer: A,B,E
Q2. You enabled PL/SQL tracing in a user session using the following command:
SQL> EXECUTE DBMS_TRACE.SET_PLSQL_TRACE(DBMS_TRACE.TRACE_ALL_CALLS);
View Exhibit1 to examine the output. After some time, the query produces a different result as shown in Exhibit2.
What is the cause for the change?
A. The FOO procedure has been executed more than once.
B. The PLSQL_DEBUG parameter is set to FALSE for the user session.
C. The FOO procedure has been compiled with the DEBUG option, and executed.
D. Schema level statistics have been gathered by the database administrator (DBA).
Answer: C
Q3. Examine the structure of the TEST_DETAILS table: Name Null? Type
TEST_ID NUMBER DESCRIPTION CLOB DESCRIPTION data was entered earlier and saved for TEST_ID 12.
You execute this PL/SQL block to add data to the end of the existing data in the DESCRIPTION column for TEST_ID 12:
DECLARE
clob_loc CLOB;
buf CHAR(12);
BEGIN
SELECT description INTO clob_loc FROM test_details WHERE test_id = 12 ;
buf := '0123456789'
DBMS_LOB.WRITEAPPEND(clob_loc,DBMS_LOB.GETLENGTH(buf), buf);
COMMIT;
END;
/
It generates an error on execution.
What correction should you do to achieve the required result?
A. WRITEAPPEND must be replaced with APPEND.
B. The BUF variable data type must be changed to CLOB. C. FOR UPDATE must be added to the SELECT statement.
D. The GETLENGTH routine must be replaced with the LENGTH built-in function in WRITEAPPEND.
Answer: C
Q4. Which two statements correctly describe the features of SecureFiles? (Choose two.)
A. Compression does not entail table or index compression and vice-versa.
B. Encryption stores the encryption keys for the LOB columns inside the database.
C. Encryption stores the encryption keys for the LOB columns outside the database.
D. Compression stores identical data occurring two or more times in the same LOB column as a single copy for the table.
Answer: A,C
Q5. Examine the commands:
CREATE TYPE typ_course_tab IS VARRAY(5) OF VARCHAR2(20)
/ CREATE TYPE typ_course_nst AS TABLE OF typ_course_tab / CREATE TABLE faculty (faculty_id NUMBER(5), faculty_name VARCHAR2(30), courses typ_course_nst) NESTED TABLE courses STORE AS course_stor_tab / INSERT INTO faculty VALUES (101, 'Jones', NULL); UPDATE (SELECT courses FROM faculty WHERE faculty_id=101) SET courses = typ_course_nst(11,'Oracle'); Which statement is true about the execution of these commands?
A. All the commands execute successfully.
B. Only the first two commands execute successfully. C. Only the first four commands execute suc cessfully. D. Only the first three commands execute successfully.
Answer: C
Q6. View Exhibit1 and examine the structure of the EMPLOYEES table.
View the Exhibit2 and examine the PL/SQL block that you execute for displaying the last name and hire date of the employees in department ID 60.
Which statement is true about the outcome?
A. It generates an error because RECORD type cannot be used with varrays.
B. It generates an error because BULK COLLECT cannot be used with varrays.
C. It executes successfully only if department ID 60 has five or less than five employees.
D. It executes successfully even if department ID 60 has more than five employees by dynamically extending the varray.
Answer: C
Q7. Examine the code snippet from the declarative section of a PL/SQL block:
DECLARE
TYPE va1 IS VARRAY(10) OF VARCHAR2(20);
SUBTYPE scale IS NUMBER(1,0);
TYPE tb1 IS TABLE OF departments.department_name%TYPE INDEX BY
departments.department_id%TYPE;
TYPE tb2 IS TABLE OF va1 INDEX BY PLS_INTEGER;
TYPE tb3 IS TABLE OF scale INDEX BY VARCHAR2(10);
TYPE tb4 IS TABLE OF DATE INDEX BY DATE;
TYPE tb5 IS TABLE OF NUMBER INDEX BY CHAR(2);
Which of the above are valid definitions for associative arrays? (Choose all that apply.)
A. tb1
B. tb2
C. tb3
D. tb4
E. tb5
Answer: B,C
Q8. View the Exhibit and examine the code in the PL/SQL block.
The PL/SQL block generates an error on execution. What is the reason?
A. The DELETE(n) method cannot be used with varrays.
B. The DELETE(n) method cannot be used with nested tables.
C. The NEXT method cannot be used with an associative array with VARCHAR2 key values.
D. The NEXT method cannot be used with a nested table from which an element has been deleted.
Answer: A
Q9. In a user session, tracing is enabled as follows: SQL> EXECUTE DBMS_TRACE.SET_PLSQL_TRACE(DBMS_TRACE.TRACE_ENABLED_LINES); PL/SQL procedure successfully completed.
You executed the procedure as follows:
SQL> EXECUTE PROC10
PL/SQL procedure successfully completed.
When you examine the PLSQL_TRACE_EVENTS table, you find that no trace information was written into it.
View the Exhibit.
What is the reason for this?
A. The PROC10 procedure is created with the invoker's right.
B. The PROC10 procedure is not compiled with the DEBUG option.
C. Tracing is not enabled with the TRACE_ENABLED_CALLS option.
D. The TRACE_ENABLED parameter is set to FALSE for the session.
Answer: B
Q10. The user OE is working on an app lication that needs to call an exte rnal C program multiple times in a single session. However, the extproc.exe file on the server gets accidentally deleted after the OE user connected and made calls to the external C program. Wh ich statement is true about the current session by the OE user?
A. The session can continue calling the external C program.
B. The session can call the external C program after republishing it.
C. The session receives an error for the next call to the external C program.
D. The session terminates during the subsequent call to the external C program.
Answer: A
Q11. Match the following external C procedure components with their descriptions:
1. External procedure a. a process that starts the extproc process
2. Shared library b. a session-specific process that executes the external procedure
3. Alias library c. schema object that represents the operating system (OS) shared library
4. The extproc process d. operating system file that stores the external procedure
5. Listener process e. a unit of code written in C
A. 1-e; 2-d; 3-c; 4-b; 5-a
B. 1-c; 2-d; 3-e; 4-b; 5-a
C. 1-e; 2-c; 3-d; 4-b; 5-a
D. 1-a; 2-d; 3-e; 4-c; 5-b
Answer: A
Q12. Examine the following command to create the table EMPLOYEES_TEMP and the PL/SQL block.
CREATE TABLE employees_temp (empid NUMBER(6) NOT NULL,
deptid NUMBER(6) CONSTRAINT c_emp_deptid CHECK (deptid BETWEEN 100 AND 200),
salary Number(8),
deptname VARCHAR2(30) DEFAULT 'Sales')
/
DECLARE
SUBTYPE v_emprec_subtype IS employees_temp%ROWTYPE;
v_emprec v_emprec_subtype;
BEGIN
v_emprec.empid := NULL; v_emprec.salary := 10000.002;
v_emprec.deptid := 50;
DBMS_OUTPUT.PUT_LINE('v_emprec.deptname: ' || v_emprec.deptname);
END;
/
Which statements are true about the above PL/SQL block? (Choose two.)
A. V_EMPREC.DEPTNAME would display a null value because the default value is not inherited.
B. Assigning null to V_EMPREC.EMPID would generate an error because the null constraint is inherited.
C. Assigning the value 1000.002 to V_EMPREC.SALARY would generate an error because of the decimal.
D. Assigning the value 50 to V_EMPREC.DEPTID would work because the check constraint is not inherited.
Answer: A,D
Q13. Which two statements are true about the tuning of PL/SQL code? (Choose two.)
A. Redundant SQL statements in PL/SQL code should be avoided.
B. Implicit data type conversion in PL/SQL code can improve performance.
C. Usage of the NOT NULL constraint in PL/SQL code can degrade performance.
D. If you have one PL/SQL program unit instead of multiple smaller executable sections, performance can be improved.
Answer: A,C
Q14. Examine the following settings for a session:
PLSQL_CODE_TYPE = NATIVE
PLSQL_OPTIMIZE_LEVEL = 3
Which statement would be true in this scenario?
A. The compiler would automatically inline subprograms.
B. The compiler would inline the code for external subroutines.
C. The compiler would inline the code even if the INLINE pragma is set to NO.
D. The compiler would not inline the code unless the INLINE pragma is set to YES.
Answer: A
Q15. Which two statements are true about the SQL Query Result Cache? (Choose two.)
A. It can store the query results for temporary tables.
B. It can be set at the system, session, or query level.
C. It is used only across statements in the same session.
D. Cached query results become invalid when the data accessed by the query is modified.
Answer: B,D
Q16. You created a procedure as follows:
CREATE OR REPLACE PROCEDURE query_prod(twhr VARCHAR2)
IS
stmt VARCHAR2(100);
pname VARCHAR2(20);
BEGIN
stmt:='SELECT product_name FROM products WHERE product_id=:2'
EXECUTE IMMEDIATE stmt INTO pname USING twhr;
DBMS_OUTPUT.PUT_LINE(pname);
END;
/
View the Exhibit to examine the structure of PRODUCTS table.
Which statement is true about the procedure?
A. It produces an error when invoked.
B. It can be invoked only from a PL/SQL block.
C. It reduces the chances of SQL injection by using bind arguments.
D. The values for bind arguments remain persistent in the session after the execution of the procedure.
Answer: C