Q1. You have an external C procedure stored in a dynamic-link library (DLL).
The C procedure takes an integer as argument and returns an integer. You want to invoke the C procedure through a PL/SQL program.
View the Exhibit.
Which statement is true about the C_OUTPUT PL/SQL program?
A. It invokes the external C procedure.
B. It only publishes the external C procedure.
C. It fails because the external C procedure is not published.
D. It fails because the input data type is BINARY_INTEGER and the external C procedure expects an integer.
Answer: C
Q2. 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
Q3. Which statements are true about temporary LOBs? (Choose all that apply.)
A. They can be created only for CLOB and NCLOB data.
B. They can be accessed only by the user who creates them.
C. They generate more redo information than persistent LOBs.
D. They exist for the duration of the session in which they are created.
E. They are stored temporarily in the default tablespace of the user who creates them.
Answer: B,D
Q4. View Exhibit1 and examine the structure of the EMPLOYEES and DEPARTMENTS tables existing in your schema.
View Exhibit2 and examine the PL/SQL block that you execute to display the department-wise incremented salary for all the departments in your company.
The code generates an error on execution.
What correction should be done to ensure the code executes successfully?
A. The cursor variable parameter should be passed in IN OUT mode.
B. The cursor variable should be defined as a strong REF CURSOR type.
C. The cursor variable name passed as actual and formal parameters should be identical.
D. The %NOTFOUND cursor attribute cannot be used with the cursor variables and should be replaced with a user defined exception.
Answer: A
Q5. There is a Java class file in your system and you publish it using the following command:
CREATE OR REPLACE PROCEDURE ccformat
(x IN OUT VARCHAR2)
AS LANGUAGE JAVA
NAME 'FormatCreditCardNo.formatCard(java.lang.String[])'
However, you receive the following error when executing the CCFORMAT procedure:
ERROR at line 1:
ORA-29540: class FormatCreditCardNo does not exist
ORA-06512: at "SH.CCFORMAT", line 1
ORA-06512: at line 1
What would you do to execute the procedure successfully?
A. Change the listener configuration.
B. Create a directory object and link it to the Java class file.
C. Rebuild the Java class file when the database instance is running.
D. Use the loadjava utility to load the Java class file into the database.
Answer: D
Q6. Which two are major approaches that can be used to reduce the SQL injection by limiting user input? (Choose two.)
A. Restrict users accessing specified web page.
B. Use NUMBER data type if only positive integers are needed.
C. Use dynamic SQL and construct it through concatenation of input values.
D. In PL/SQL API, expose only those routines that are intended for customer use.
Answer: A,D
Q7. View the Exhibit and examine the procedure to create a trigger name based on the table name supplied to the procedure.
Which three statements are appropriate for protecting the code in the procedure from SQL injection? (Choose three.)
A. Explicitly validate the identifier length limit.
B. Add AUTHID DEFINER to the definition of the procedure.
C. Use PRAGMA RESTRICT_REFERENCES in the procedure.
D. Filter out control characters in user-supplied identifier names.
E. Use the object ID of the table from the data dictionary to build the trigger name.
Answer: A,D,E
Q8. Examine the following settings for a session:
PLSQL_CODE_TYPE = NATIVE
View the Exhibit and examine the PL/SQL code.
You compile the program with the following attributes:
SQL> ALTER PROCEDURE proc1 COMPILE PLSQL_OPTIMIZE_LEVEL = 1;
Which statement is true about the execution of the PROC1 procedure in this scenario?
A. The FUNC1 function would be called inline because PRAGMA INLINE forces a specific call to be inlined.
B. The FUNC1 function would be inlined because the value set for the PLSQL_CODE_TYPE parameter is set to NATIVE.
C. The FUNC1 function would be called inline irrespective of the value set for the PLSQL_OPTIMIZE_LEVEL parameter.
D. The FUNC1 function would not be called inline because the value for the PLSQL_OPTIMIZE_LEVEL parameter is set to a lower value.
Answer: D
Q9. View the Exhibit and examine the structure of the EMPLOYEES table.
Examine the following PL/SQL block for storing the salary of all sales representatives from the
EMPLOYEES table in an associative array:
1 DECLARE
2 emp_cv SYS_REFCURSOR;
3 TYPE list IS TABLE OF emp_cv;
4 sals list;
5 BEGIN
6 OPEN emp_cv FOR SELECT salary FROM employees
7 WHERE job_id = 'SA_REP'
8 FETCH emp_cv BULK COLLECT INTO sals;
9 CLOSE emp_cv;
10 END;
What should you correct in the above code to ensure that it executes successfully?
A. Replace EMP_CV in line 3 with employees.salary%TYPE.
B. Replace line 2 with TYPE refcur IS REF CURSOR; emp_cv refcur;.
C. Replace BULK COLLECT in line 8 with the OPEN, FETCH, LOOP, and CLOSE statements.
D. Replace line 2 with TYPE refcur IS REF CURSOR RETURN employees.salary%TYPE; emp_cv refcur;.
Answer: A
Q10. View the Exhibit and examine the structure of the EMPLOYEES table.
Examine the following PL/SQL block for storing the salary of all sales representatives from the
EMPLOYEES table in an associative array:
1 DECLARE
2 emp_cv SYS_REFCURSOR;
3 TYPE list IS TABLE OF emp_cv;
4 sals list;
5 BEGIN
6 OPEN emp_cv FOR SELECT salary FROM employees
7 WHERE job_id = 'SA_REP'
8 FETCH emp_cv BULK COLLECT INTO sals;
9 CLOSE emp_cv;
10 END;
What should you correct in the above code to ensure that it executes successfully?
A. Replace EMP_CV in line 3 with employees.salary%TYPE.
B. Replace line 2 with TYPE refcur IS REF CURSOR; emp_cv refcur;.
C. Replace BULK COLLECT in line 8 with the OPEN, FETCH, LOOP, and CLOSE statements.
D. Replace line 2 with TYPE refcur IS REF CURSOR RETURN employees.salary%TYPE; emp_cv refcur;.
Answer: A