You are on page 1of 55

s@lm@n

Oracle
Exam 1z0-148
Oracle Database 12c: Advanced Pl/SQL
Version: 7.0

[ Total Questions: 75 ]
Oracle 1z0-148 : Practice Test
Question No : 1

Examine this PL/SQL function:

What happens when the function is created with PLSQL_WARNINGS set to ‘ENABLE:
ALL’?

A. There are no compilation warnings or errors.


B. It fails compilation.
C. An information compilation warning is generated.
D. A performance compilation warning is generated.
E. A severe compilation warning is generated.

Answer: E

Question No : 2

Which two statements are true regarding edition-based redefinition (EBR)?

2
Oracle 1z0-148 : Practice Test
A. There is no default edition defined in the database.
B. EBR does not let you upgrade the database components of an application while in use.
C. You never use EBR to copy the database objects and redefine the copied objects in
isolation.
D. Editions are non-schema objects.
E. When you change an editioned object, all of its dependents remain valid.
F. Tables are not editionable objects.

Answer: E,F
Explanation: References:

Question No : 3

Examine the test_tbl table and its contents:

Examine this code:

3
Oracle 1z0-148 : Practice Test

What is the outcome of this anonymous PL/SQL block?

A. “It was updated” is displayed.


B. Successful completion without printing “It was updated”.
C. A NO_DATA_FOUND exception is thrown.
D. ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified
E. ORA-22920: row containing the LOB value is not locked

Answer: D

Question No : 4

Which three statements are correct with reference to intra unit inlining?

A. Inlining will always decrease the size of a unit.


B. Setting PLSQL_OPTIMIZE_LEVEL to 2 means automatic inlining is attempted.
C. You cannot inline an external subroutine.
D. Programs that make use of smaller helper subroutines are good candidates for inlining.
E. Pragmas apply only to calls in the next statement following the pragma.
F. You cannot inline local subroutines.

Answer: C,D,E
Explanation: References:

Question No : 5

4
Oracle 1z0-148 : Practice Test
You are logged on to the SCOTT schema and the schema has EMP and DEPT tables
already created:

Examine this PL/SQL procedure:

Which PL/SQL block will raise an exception?

A. EXEC get_tab_row_count (‘emp’);


B. EXEC get_tab_row_count (‘SCOTT.EMP’);
C. EXEC get_tab_row_count (‘ “EMP” ’);
D. EXEC get_tab_row_count (‘DEPT’);
E. EXEC get_tab_row_count (‘DEPT, EMP’)

Answer: C

Question No : 6

Which two can be used to find details of parameters for overloaded PL/SQL routines?

A. ALL-DEPENDENCIES
B. ALL_PROCEDURES
C. ALL_DESCRIBE
D. ALL_SOURCE
E. ALL_ARGUMENTS

Answer: D,E
Explanation: References:

Question No : 7

5
Oracle 1z0-148 : Practice Test
Identify the two correct scenarios where a function can be optimized using the function
result cache feature.

A. A function which inserts multiple records into a DEPARTMENTS table as part of one-
time data setup for an HR application.
B. A function which accesses multiple tables and calculates the commission to be given to
a sales representative based on the number of products sold by that representative.
C. A function which deletes all the records from an EMPLOYEES_AUDIT table based on
their LOG_DATE.
D. A function which updates the SALARY of all the employees in an EMPLOYEES table by
a fixed percentage based on their DESIGNATION.
E. A function which calculates the factorial of a given number without accessing any table.

Answer: D,E

Question No : 8

Which statement is true about internal and external LOBs?

A. An external LOB can be loaded into an internal LOB variable using the DBMS_LOB
package.
B. A NOEXIST_DIRECTORY exception can be raised when using internal and external
LOBs.
C. Internal and external LOBs can be written using DBMS_LOB.
D. After an exception transfers program control outside a PL/SQL block, all references to
open external LOBs are lost.
E. When using DBMS_LOB.INSTR for internal and external LOBs, DBMS_LOB.OPEN
should be called for each LOB.

Answer: D,E
Explanation: References:

Question No : 9

Examine the structure of the DEPT table which exists in both BRANCH1 and BRANCH2
schemas:

6
Oracle 1z0-148 : Practice Test

Examine this code:

Which three modifications must be done to endure the anonymous block displays the
output form the BRANCH2.DEF DEPT table?

A. Change the IF condition in the anonymous block to 1_dept IS EMPTY.


B. Change the IF condition in the anonymous block to CARDINALITY (1_dept) IS NULL.
C. Add BEQUEATH DEFINER to the EMP_COUNT_VW view.
D. Add BEQUEATH CURRENT_USER to the EMP_COUNTS_VW view.

7
Oracle 1z0-148 : Practice Test
E. IN BRANCH2 execute GRANT INHERIT PRIVILEGES ON USER branch2 TO branch1;
F. Add AUTHID CURRENT_USER to the EMP_COUNT function.

Answer: B,D,E

Question No : 10

Examine this function call:

cur_num := DBMS_SQL.TO_CURSOR_NUMBER (cur_val);

Which two statements are true?

A. CUR_VAL must be opened after this line is executed in the PL/SQL block.
B. CUR_VAL must be a weakly typed cursor variable.
C. CUR_VAL can be either a strongly or weakly typed cursor variable.
D. CUR_VAL must be opened before this line is executed in the PL/SQL block.
E. The PL/SQL block can continue to use the cursor variable after this line is executed.

Answer: B,C

Question No : 11

Examine this code:

8
Oracle 1z0-148 : Practice Test
What is the correct statement to get the value of attribute ACCOUNT_MGR after the
procedure has been executed?

A. SELECT USERENV (‘ACCOUNT_MGR’) FROM dual;


B. SELECT SYS_CONTEXT (‘USERENV’, ‘ACCOUNT_MGR’) FROM dual;
C. SELECT SYS_CONTEXT (‘ORDER_CTX’, ‘ACCOUNT_MGR’) FROM dual;
D. SELECT SYS_CONTEXT (‘ACCOUNT_MGR’, ‘ORDER_CTX’) FROM dual;
E. SELECT USERENV (‘ORDER_CTX’) FROM dual;

Answer: B

Question No : 12

Which two statements are true about the DBMS_ LOB package?

A. DBMS_LOB.COMPARE can compare parts of two LOBs.


B. DBMS_LOB.COMPARE returns the size difference of the compared LOBs.
C. DBMS_LOB.COMPARE is overloaded and can compare CLOBs with BLOBs.
D. If the destination LOB is a temporary LOB, the row must be locked before calling
DBMS_LOB.CONVERTTOBLOB.
E. Before calling DBMS_LOB.CONVERTTOBLOB, both the source and destination LOB
instances must exist.

Answer: D,E
Explanation: References:

Question No : 13

Which three commands can be used to set PL/SQL conditional compilation inquiry directive
MODE?

A. ALTER SESSION SET PLSQL_CCFLAGS = ‘mode: FALSE’;


B. ALTER SESSION SET PLSQL_CCFLAGS= ‘mode: NULL’;
C. ALTER SESSION SET PLSQL_CCFLAGS= ‘mode: Level 1’;
D. ALTER SESSION SET PLSQL_CCFLAGS= ‘mode: Level1’;
E. ALTER SESSION SET PLSQL_CCFLAGS= ‘mode: 1’

Answer: A,C,E

9
Oracle 1z0-148 : Practice Test

Question No : 14

Examine this function header:

FUNCTION calc_new_sal (emp_id NUMBER) RETURN NUMBER;

You want to ensure that whenever this PL/SQL function is invoked with the same
parameter value across active sessions, the result is not recomputed.

If a DML statement is modifying a table which this function depends upon, the function
result must be recomputed at that point in time for all sessions calling this function.

Which two actions should you perform?

A. Ensure RESULT_CACHE_MAX_SIZE is greater than 0.


B. Enable the result cache by using DBMS_RESULT_CACHE.BYPASS (FALSE).
C. Add the deterministic clause to the function definition.
D. Add the RELIES_ON clause to the function definition.
E. Add the RESULT_CACHE clause to the function definition.

Answer: A,C

Question No : 15

Which two statements are correct for collecting data about identifiers in PL/SQL source
code?

A. CREATE < function/Procedure> PLSCOPE_SETTINGS = ‘IDENTIFIERS: ALL’ AS …


B. ALTER SYSTEM SET PLSCOPE_SETTINGS = ‘IDENTIFIERS: NONE’
C. ALTER SESSION SET PLSCOPE_SETTINGS = ‘IDENTIFIERS: NONE’
D. ALTER SESSION SET PLSCOPE_SETTINGS = ‘IDENTIFIERS: ALL’
E. ALTER <function/Procedure> COMPILE PLSCOPE_SETTINGS = ‘IDENTIFIERS: ALL’

Answer: A,D

10
Oracle 1z0-148 : Practice Test
Question No : 16

Examine this query executed as SYS and its output:

Which two observations are true based on the output?

A. The client-side result cache and the server-side result cache are enabled.
B. All distinct query results are cached for the duration of a SYS user session.
C. Repetitive SQL queries and PL/SQL function results are cached and automatically used
from the cache across all SYS user sessions.
D. The result cache exists but which SQL queries are cached depends on the value of the
RESULT_CACHE_MODE parameter.
E. Repetitive SQL queries executed on permanent non-dictionary objects may have faster
response times.

Answer: C,D

Question No : 17

Examine this code:

11
Oracle 1z0-148 : Practice Test

Which two are valid correlations to the code to avoid or mitigate SQL Injection?

A. CREATE PROCEDURE list_products_dynamic (p_product_name VARCHAR2


DEFAULT NULL) ASTYPE cv_pordtyp IS REF CURSOR;cv cv_prodtyp;v_prodname
prod_info.name%TYPE;v_listprice prod_info.price%TYPE;v_bind VARCHAR2
(400);BEGINv_bind := ‘%’ | | p_product_name | | ‘%’;OPEN cv FOR ‘SELECT name, price
FROM prod_info WHERE name LIKE :b’ USING v_bind;LOOPFETCH cv INTO
v_prodname, v_listprice;EXIT WHEN cv%NOTFOUND;DBMS_OUTPU.PUT_LINE
(‘Product Info: ‘ | | v_prodname | | ‘,’ | | v_listprice);END LOOP;CLOSE cv;END;
B. CREATE PROCEDURE list_products_dynamic (p_product_name VARCHAR2
DEFAULT NULL) ASv_bind VARCHAR2 (400);BEGINv_bind := ‘%’ | | p_prodname | |
‘%’;FOR rec IN (‘SELECT name, price FROM prod_info WHERE name like ‘ | | v_bind)
LOOPDBMS_OUTPUT.PUT_LINE (‘Product Info: ’ | | rec.name | | ‘,’ | | rec.price);END
LOOP;END;
C. CREATE PROCEDURE list_products_dynamic (p_product_name VARCHAR2
DEFAULT NULL) ASTYPE cv_pordtyp IS REF CURSOR;cv cv_prodtyp;v_prodname
prod_info.name%TYPE;v_listprice prod_info.price%TYPE;v_bind VARCHAR2
(400);BEGINv_bind := ’’’%’ | | p_product_name | | ‘%’’’;OPEN cv FOR ‘SELECT name,
price FROM prod_info WHERE name LIKE ’ | | v_bind;LOOPFETCH cv INTO v_prodname,
v_listprice;EXIT WHEN cv%NOTFOUND;DBMS_OUTPU.PUT_LINE (‘Product Info: ‘ | |
v_prodname | | ‘,’ | | v_listprice);END LOOP;CLOSE cv;END;
D. CREATE PROCEDURE list_products_dynamic (p_product_name VARCHAR2
DEFAULT NULL) ASTYPE cv_pordtyp IS REF CURSOR;cv cv_prodtyp;v_prodname
prod_info.name%TYPE;v_listprice prod_info.price%TYPE;v_bind VARCHAR2
(400);BEGINv_bind := ‘%’ | | p_product_name | | ‘%’;OPEN cv FOR ‘SELECT name, price
FROM prod_info WHERE name LIKE ’ | | v_bind;LOOPFETCH cv INTO v_prodname,
v_listprice;EXIT WHEN cv%NOTFOUND;DBMS_OUTPU.PUT_LINE (‘Product Info: ‘ | |
v_prodname | | ‘,’ | | v_listprice);END LOOP;CLOSE cv;END;
E. CREATE PROCEDURE list_products_dynamic (p_product_name VARCHAR2
DEFAULT NULL) ASTYPE cv_pordtyp IS REF CURSOR;cv cv_prodtyp;v_prodname
prod_info.name%TYPE;v_listprice prod_info.price%TYPE;v_bind VARCHAR2
(400);BEGINv_bind := DBMS_ASSERT.ENQUOTE_LITERAL (‘%’ | | p_product_name | |
‘%’);OPEN cv FOR ‘SELECT name, price FROM prod_info WHERE name LIKE ’ | |
v_bind;LOOPFETCH cv INTO v_prodname, v_listprice;EXIT WHEN
cv%NOTFOUND;DBMS_OUTPU.PUT_LINE (‘Product Info: ‘ | | v_prodname | | ‘,’ | |
v_listprice);END LOOP;CLOSE cv;END;

Answer: B,D

Question No : 18

12
Oracle 1z0-148 : Practice Test
Your company decided to update its employees’ contact information as a one-time event.

With thousands of employees’ records to be updated, the project manager hoped to


achieve substantial performance gains using the DBMS_PARALLEL_EXECUTE package
and identified these four actions to be executed.

1) dbms_parallel_execute.create_task

2) GRANT system privilege CREATE JOB to the user executing this task

3) dbms_parallel_execute.run_task

4) dbms_parallel_execute.create_chunks_by_rowid

Select the correct order of actions to implement the parallel execution of PL/SQL blocks.

A. 2, 1, 3 and 4
B. 1, 2, 4 and 3
C. 2, 1, 4 and 3
D. 1, 2, 3 and 4
E. 2, 4, 1 and 3

Answer: E

Question No : 19

Which tablespace is used to store the data collected by PL/Scope?

A. UNDOTBS1
B. SYSAUX
C. SYSTEM
D. TEMP
E. USERS

Answer: B
Explanation: References:

Question No : 20

13
Oracle 1z0-148 : Practice Test
Examine these program units:

14
Oracle 1z0-148 : Practice Test
Which two blocks will execute successfully?

A. BEGINMy_proc;END;
B. BEGINpkg2.proc3;END;
C. BEGINpkg2.proc2;END;
D. BEGINpkg1.proc1a;END;
E. BEGINpkg1.proc1b;END;

Answer: B,D

Question No : 21

Which two blocks of code execute successfully?

A. DECLARESUBTYPE new_one IS BINARY_INTERGER RANGE 0..9;my_val


new_one;BEGINmy_val :=0;END;
B. DECLARESUBTYPE new_string IS VARCHAR2 (5) NOT
NULL;my_str_new_string;BEGINmy_str := ‘abc’;END;
C. DECLARESUBTYPE new_one IS NUMBER (2, 1);my_val new_one;BEGINmy_val
:=12.5;END;
D. DECLARESUBTYPE new_one IS INTEGER RANGE 1..10 NOT NULL;my_val
new_one;BEGINmy_val :=2;END;
E. DECLARESUBTYPE new_one IS NUMBER (1, 0);my_val new_one;BEGINmy_val := -
1;END;

Answer: A,D

Question No : 22

Examine this external function declaration:

Which C function does it publish?

15
Oracle 1z0-148 : Practice Test
A. OCINumber * compareAndSum (OCIExtProcContext *ctx, OCINumber *p1, OCINumber
*p2, OCINumber *p3);
B. OCINumber compareAndSum (OCIExtProcContext *ctx, OCINumber p1, OCINumber
p2, OCINumber *p3);
C. int compareAndSum (OCIExtProcContext *ctx, int p1, int p2, OCINumber *p3);
D. int compareAndSum (OCIExtProcContext *ctx, int p1, int p2, OCINumber p3);
E. int compareAndSum (OCIExtProcContext *ctx, int p1, int p2, int p3);
F. int compareAndSum (OCIExtProcContext *ctx, int p1, int p2, int* p3);
G. OCINumber compareAndSum (OCIExtProcContext *ctx, OCINumber p1, OCINumber
p2, OCINumber p3);

Answer: F

Question No : 23

You created a PL/SQL function with the RESULT_CACHE clause, which calculates a
percentage of total marks for each student by querying the MARKS table.

Under which two circumstances will the cache for this function not be used and the function
body be executed instead?

A. When a user fixes incorrect marks for a student, with an update to the MARKS table,
and then executes the function in the same session
B. When the amount of memory allocated for the result cache is increased
C. When the function is executed in a session frequently with the same parameter value
D. When the database administrator disables the result cache during ongoing application
patching
E. When the maximum amount of server result cache memory that can be used for a single
result is set to 0.

Answer: D,E

Question No : 24

Examine this block of code used to calculate the price increase for all the productivity by
1% and then by 2%.

16
Oracle 1z0-148 : Practice Test

What will be the outcome on execution?

A. It will give an error because the calculated column in the cursor is not using a column
alias in this block.
B. It will go into an endless loop because the loop exist condition is missing.
C. It will display the price increase by 1% only for all the products.
D. It will display the price increase by 1% only for the first product.
E. It will give an error because PDT_REC is not declared.

Answer: B

Question No : 25

Which two PL/SQL blocks give the output “this is a test message”?

A. BEGINDBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘this is a test


message’, TRUE));END;
B. BEGINDBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘this is a “
“test” ” message’, TRUE));END;
C. BEGINDBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘ “this is a
“test” message” ’, TRUE));END;
D. BEGINDBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘ “this is a
test message” ’, TRUE));END;
E. BEGINDBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘this is a test
message ’, FALSE));END;

Answer: A,C

17
Oracle 1z0-148 : Practice Test
Question No : 26

Which two statements are correct about the collections before v3. DELETE is executed?

A. The values of v3(31) (2) and v3 (33) (2) are identical.


B. The value of v3 (31) (3) is 6.
C. The value of v3 (31) (1) and v3 (33) (3) are identical,
D. The value of v3 (31) (1) is “hello”.
E. The values of v3 (32) (2) and v1 (2) are identical.

Answer: A,D

Question No : 27

Which data dictionary view contains the list of procedures and functions defined within
package specification that you can execute?

A. ALL_SOURCE
B. ALL_DEPENDENCIES
C. ALL_OBJECTS
D. ALL_PROCEDURES
E. ALL_PLSQL_OBJECT_SETTINGS

Answer: D

18
Oracle 1z0-148 : Practice Test
Question No : 28

Which codes executes successfully?

A. CREATE PACKAGE pkg ASTYPE rec_typ IS RECORD (price NUMBER, inc_pct


NUMBER);PROCEDURE calc_price (price_rec IN OUT rec_typ);END pkg;/CREATE
PACAKGE BODY pkg ASPROCEDURE calc_price (price_rec IN OUT rec_typ)
ASBEGINprice_rec.price := price_rec.price + (price_rec.price * price_rec.inc_pct)/100;END
calc_price;END pkg;/DECLARE1_rec pkg. rec_typ;BEGIN1_rec_price :=100;1_rec.inc_pct
:=50;EXECUTE IMMEDIATE ‘BEGIN pkg. calc_price (:rec); END;’ USING IN OUT
1_rec;END;
B. CREATE PACKAGE pkg ASTYPE rec_typ IS RECORD (price NUMBER, inc_pct
NUMBER);END pkg;/CREATE PROCEDURE calc_price (price_rec IN OUT pkg. rec_typ)
ASBEGINprice_rec.price := price_rec.price + (price_rec.price *
price_rec.inc_pct)/100;END/DECLARE1_rec pkg.rec_typ;BEGINEXECUTE IMMEDIATE
‘BEGIN calc_price (:rec); END;’ USING IN OUT 1_rec (100, 50);END;
C. CREATE PACKAGE pkg ASTYPE rec_typ IS RECORD (price NUMBER, inc_pct
NUMBER);END pkg;/CREATE PROCEDURE calc_price (price_rec IN OUT pkg. rec_typ)
ASBEGINprice_rec.price := price_rec.price + (price_rec.price * price_rec.inc_pct)/100;END
;/DECLARE1_rec pkg. rec_typ;BEGIN1_rec_price :=100;1_rec.inc_pct :=50;EXECUTE
IMMEDIATE ‘BEGIN calc_price (1_rec); END;’;END;
D. DECLARETYPE rec_typ IS RECORD (price NUMBER, inc_pct NUMBER);1_rec rec-
typ;PROCEDURE calc_price (price_rec IN OUT rec_typ) ASBEGINprice_rec.price := price-
rec.price+ (price_rec.price * price_rec.inc_pct)/100;END;BEGIN1_rec_price
:=100;1_rec.inc_pct :=50;EXECUTE IMMEDIATE ‘BEGIN calc_price (:rec); END;’ USING
IN OUT 1_rec;END;

Answer: B

Question No : 29

You are designing and developing a complex database application and implementing fine-
grained access control using security policies.

Which statement is true with respect to attaching security policies to database objects?

A. You can use different security policies for SELECT, INSERT, UPDATE, INDEX and
DELETE statements.
B. You can use only one security policy per database object.
C. You implement security policies through database procedures.
D. Column-masking policies can be applied to SELECT, INSERT, UPDATE and DELETE

19
Oracle 1z0-148 : Practice Test
statements.

Answer: D

Question No : 30

Consider a function totalEmp () which takes a number as an input parameter and returns
the total number of employees who have a salary higher than that parameter.

Examine this PL/SQL package AS

Which two definitions of totalEmp () result in an implicit conversion by Oracle Database on


executing this PL/SQL block?

A. CREATE FUNCTION totalEmp (sal IN NUMBER) RETURN NUMBER IStotal NUMBER


:=0;BEGIN…RETUNRN total;END;/
B. CREATE FUNCTION totalEmp (sal IN NUMBER) RETURN NUMBER IStotal NUMBER
:=0;BEGIN…RETUNRN total;END;/
C. CREATE FUNCTION totalEmp (sal IN PLS_INTEGER) RETURN NUMBER IStotal
NUMBER :=0;BEGIN…RETUNRN total;END;/
D. CREATE FUNCTION totalEmp (sal IN BINARY_FLOAT) RETURN NUMBER IStotal
NUMBER :=0;BEGIN…RETUNRN total;END;/
E. CREATE FUNCTION totalEmp (sal IN POSITIVEN) RETURN NUMBER IStotal

20
Oracle 1z0-148 : Practice Test
NUMBER :=0;BEGIN…RETUNRN total;END;/

Answer: B,C

Question No : 31

A products TABLE exists with a PROD_ID column.

Examine this PL/SQL block:

Which statement is true?

A. It executes successfully only if v_ref_cur := DBMS_SQL.TO_REFCURSOR (V_CUR); is


added before the FETCH statement.
B. It executes successfully.
C. It executes successfully only if v_ref_cur: = DBMS_SQL.TO_CURSOR_NUMBER
(v_cur); is added before the FETCH statement.
D. It executes successfully only if the FETCH statement is replaced by
DBMS_SQL.RETURN_RESULT (v_ref_cur);
E. It executes successfully only if the FETCH statement is replaced by
DBMS_SQL.FETCH_ROWS (v_cur);

Answer: C,D

Question No : 32

21
Oracle 1z0-148 : Practice Test
Examine the code:

Which two subprograms will be created successfully?

A. CREATE FUNCTION p4 (y pkg.tab_typ) RETURN pkg.tab_typ ISBEGINEXECUTE


IMMEDIATE ‘SELECT pdt_id, pdt_name FROM TABLE (:b)’BULT COLLECT INTO pkg.x
USING y;RETURN pkg.x;END p4;
B. CREATE PROCEDURE p1 (y IN OUT pkg.tab_typ) ISBEGINEXECUTE IMMEDIATE
‘SELECT f (:b) FROM DUAL’ INTO y USING pkg.x;END p1;
C. CREATE PROCEDURE p2 (v IN OUT VARCHAR2) ISBEGINEXECUTE IMMEDIATE
‘SELECT f (:b) FROM DUAL’ INTO v USING pkg.x;END p2;
D. CREATE FUNCTION p3 RETURN pkg. tab_typ ISBEGINEXECUTE IMMEDIATE
‘SELECT f (:b) FROM DUAL’ INTO pkg.x;END p3;
E. CREATE PROCEDURE p5 (y pkg. rec_typ) ISBEGINEXECUTE IMMEDIATE ‘SELECT
pdt_name FROM TABLE (:b)’ BULK COLLECT INTO y USING pkg.x;END p5;

Answer: A,C

Question No : 33

22
Oracle 1z0-148 : Practice Test

Examine this code:

You want to display the contents of CREATE_LIST.

Which two lines need to be corrected in the PL/SQL block?

A. Line 2
B. Line 3
C. Line 5

23
Oracle 1z0-148 : Practice Test
D. Line 6
E. Line 7

Answer: B,D

Question No : 34

Examine this code executed in the ORA1 schema:

Examine this code executed by DBA_USER who has been granted the DBA role:

REVOKE INHERIT PRIVILEGES ON USER dba_user FROM PUBLIC;

Examine this query:

SELECT return_date (1) FROM dual;

What is the result of executing this query in the DBA_USER schema?

A. It will fail with a compile-time error.


B. It will execute successfully and return the date but the DBA role will not be granted to
ORA1.
C. It will fail with a runtime error complaining of insufficient INHERIT PRIVILEGES.

24
Oracle 1z0-148 : Practice Test
D. It will execute successfully, return the date and the DBA role will be granted to ORA1.

Answer: D

Question No : 35

Which two statements are true with respect to fine-grained access control?

A. It is implemented by end users.


B. It can be used to implement column masking.
C. It implements security rules through functions and associates these security rules with
tables, views or synonyms.
D. Separate policies are required for queries versus INSERT/UPDATE/DELETE
statements.
E. The DBMS_FGA package is used to set up fine-grained access control.

Answer: C,D
Explanation: References:

Question No : 36

Select the correct statement regarding BEQUEATH CURRENT_USER.

A. If a view references a PL/SQL function then BEQUEATH CURRENT_USER allows the


function to execute with DBA privileges, regardless of the invoking user’s privileges.
B. The BEQUEATH CURRENT_USER clause allows invoker’s rights functions referenced
in a view to execute with the privileges of the invoking user.
C. Any view calling a PL/SQL function with BEQUEATH CURRENT_USER in effect will
execute with the privileges of the function owner.
D. With the BEQUEATH CURRENT_USER clause, a definer’s rights function referenced in
a view executes with the privileges of the view owner, not the function owner.

Answer: B
Explanation: References:

Question No : 37
25
Oracle 1z0-148 : Practice Test
Examine this code:

The anonymous block fails with:

ERROR at line 1:

ORA-01403: no data found

ORA-06512: at line 5

Which two are valid options to prevent this error from occurring?

A. Line 5 should be replaced with:DBMS_LOB.CREATETEMPORARY (pdatabuf (1),


TRUE, DBMS_LOB.CALL);
B. Line 5 should be replaced with:DBMS_LOB.CREATETEMPORARY (pdatabuf (1),
FALSE, DBMS_LOB.SESSION);
C. Rewrite the block as:DECLARETYPE databuf_arr IS TABLE OF CLOB INDEX BY
BINATY_INTEGER;pdatabuf databuf_arr;PROCEDURE mytemplob (x OUT CLOB)
ISBEGINDBMS_LOB.CREATETEMPORARY (x, TRUE, DBMS_LOB,
SESSION);END;BEGINmytemplob (pdatabuf (1));END;/
D. pdatabuf (1) := NULL; should be added after line 4.
E. Line 5 should be replaced with:DBMS_LOB.CREATETEMPORARY (pdatabuf, TRUE,
DBMS_LOB.SESSION);

Answer: C,E

Question No : 38

Examine the EMPLOYEE_IDS table its data:

26
Oracle 1z0-148 : Practice Test

Examine this PL/SQL block:

What is the result of executing this PL/SQL block with SERVEROUTPUT enabled?

A. It executes successfully and outputs:Fetched: 1011, JJONES, 3789Fetched: 1012,


SSMITH, -1
B. Compilation fails saying EMP_TAXID must be declared.
C. An exception is thrown at runtime saying EMP_TAXID is not visible.
D. It executes successfully and outputs:Fetched: 1011, JJONES,Fetched: 1012, SSMITH,
E. It executes successfully and outputs:Fetched: 1011, JJONES, -1Fetched: 1012,
SSMITH, -1

Answer: D

27
Oracle 1z0-148 : Practice Test
Question No : 39

Which two blocks of code execute successfully?

A. DECLARETYPE tab_type IS TABLE OF NUMBER;my_tab tab_type;BEGINmy_tab (1)


:=1;END;
B. DECLARETYPE tab_type IS TABLE OF NUMBER;my_tab tab_type :=
tab_type(2);BEGINmy_tab(1) :=55;END;
C. DECLARETYPE tab_type IS TABLE OF NUMBER;my_tab tab_type;BEGINmy_tab.
EXTEND (2);my_tab (1) := 55;END;
D. DECLARETYPE tab_type IS TABLE OF NUMBER;my_tab tab_type;BEGINmy_tab :=
tab_type ();my_tab (1) := 55;END;
E. DECLARETYPE tab_type IS TABLE OF NUMBERmy_tab tab_type := tab_type (2,
NULL, 50);BEGINmy_tab.EXTEND (3, 2);END;

Answer: B,D

Question No : 40

You are designing and developing a complex database application built using many
dynamic SQL statements. Which option could expose your code to SQL injection attacks?

A. Using bind variables instead of directly concatenating parameters into dynamic SQL
statements
B. Using automated tools to generate code
C. Not validating parameters which are concatenated into dynamic SQL statements
D. Validating parameters before concatenating them into dynamic SQL statements
E. Having excess database privileges

Answer: A
Explanation: References:

Question No : 41

Which two statements about the PL/SQL hierarchical profiler are true?

A. Access it using the DBMS_PROFILER package.


B. Access it using the DBMS_HPROF package.

28
Oracle 1z0-148 : Practice Test
C. Profiler data is recorded in tables and published in HTML reports.
D. It is only accessible after a grant of the CREATE PROFILE privilege.
E. It helps you identify subprograms that are causing bottlenecks in application
performance.

Answer: B,E
Explanation: References:

Question No : 42

Examine this code:

Users of this function may set different date formats in their sessions.

Which two modifications must be made to allow the use of your session’s date format when
outputting the cached result of this function?

A. Change the RETURN type to DATE.


B. Change AUTHID to CURRENT_USER.
C. Use the TO_CHAR function around SYSDATE, that is, 1_date := TO_CHAR
(SYSDATE).
D. Change the data type of 1_date to DATE.
E. Set NLS_DATE_FORMAT to ‘DD-MM-YY’ at the instance level.
F. Set the RESULT_CACHE_MODE parameter to FORCE.

Answer: D,F

29
Oracle 1z0-148 : Practice Test
Question No : 43

Select a valid reason for using VARRAYS.

A. When the amount of data to be held in the collection is widely variable.


B. As a column in a table when you want to retrieve the collection data for certain rows by
ranges of values.
C. When you want to delete elements from the middle of the collection.
D. As a column in a table when you want to store no more than 10 elements in each row’s
collection.

Answer: B
Explanation:
Referencehttps://www.go4expert.com/articles/oracle-nested-tables-varrays-t20494/

Question No : 44

Examine this function:

Execute the query:

SELECT remap_schema FROM dual;

30
Oracle 1z0-148 : Practice Test
Which is the correct output from the query?

A. CREATE TABLE “EMP” (“EMPNO” NUMBER (4,0), “ENAME” VARCHAR2 (10), “JOB”
VARCHAR2 (9), “MGR” NUMBER (4,0), “HIREDATE”DATE, “SAL” NUMBER (7,2) ,
“COMM” NUMBER (7,2), “DEPTNO” NUMBER (2,0),CONSTRAINT “PK_EMP” PRIMARY
KEY (“EMPNO”)USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2417483645PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1BUFFER_POOL
DEFAULT FLASH_CHACHE DEFAULT CELL_FLASH_CACHE DEFAULT)TABLESPACE
“USERS” ENABLE,CONSTRAINT “FK_DEPTNO” FOREIGN KEY
(“DEPTNO”)REFERENCES “DEPT” (“DEPTNO”) ENABLE) SEGMENT CREATION
IMMEDIATEPCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255NOCOMPRESS
LOGGINGSTORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1BUFFER_POOL
DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)TABLESPACE
“USERS”
B. CREATE TABLE “EMP” (“EMPNO” NUMBER (4, 0), “ENAME” VARCHAR2 (10), “JOB”
VARCHAR2 (9), “MGR” NUMBER (4, 0), “HIREDATE” DATE, “SAL” NUMBER (7, 2),
“COMM” NUMBER (7, 2), “DEPTNO” NUMBER (2, 0),CONSTRAINT “PK_EMP” PRIMARY
KEY (“EMPNO”)USING INDEX ENABLE,CONSTRAINT “FK_DEPTNO” FOREIGN KEY
(“DEPTNO”)REFERENCES “DEPT” (“DEPTNO”) ENABLE)
C. CREATE TABLE “SCOTT”. “EMP” (“EMPNO” NUMBER (4, 0), “ENAME” VARCHAR2
(10), “JOB” VARCHAR2 (9), “MGR” NUMBER (4, 0), “HIREDATE” DATE, “SAL” NUMBER
(7, 2), “COMM” NUMBER (7, 2), “DEPTNO” NUMBER (2, 0),CONSTRAINT “PK_EMP”
PRIMARY KEY (“EMPNO”)USING INDEX ENABLE,CONSTRAINT “FK_DEPTNO”
FOREIGN KEY (“DEPTNO”)REFERENCES “DEPT” (“DEPTNO”) ENABLE)
D. CREATE TABLE “EMP” (“EMPNO” NUMBER (4,0), “ENAME” VARCHAR2 (10), “JOB”
VARCHAR2 (9), “MGR” NUMBER (4,0), “HIREDATE”DATE, “SAL” NUMBER (7, 2) ,
“COMM” NUMBER (7, 2), “DEPTNO” NUMBER (2,0),CONSTRAINT “PK_EMP” PRIMARY
KEY (“EMPNO”)USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2417483645PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1BUFFER_POOL
DEFAULT FLASH_CHACHE DEFAULT CELL_FLASH_CACHE DEFAULT)TABLESPACE
“SYSAUX” ENABLE,CONSTRAINT “FK_DEPTNO” FOREIGN KEY
(“DEPTNO”)REFERENCES “DEPT” (“DEPTNO”) ENABLE) SEGMENT CREATION
IMMEDIATEPCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255NOCOMPRESS
LOGGINGSTORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1BUFFER_POOL
DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)TABLESPACE
“SYSAUX”

Answer: B

31
Oracle 1z0-148 : Practice Test
Question No : 45

Which two statements describe actions developers can take to make their application less
vulnerable to security attacks?

A. Include the AUTHID DEFINER clause in stored program units.


B. Do not concatenate unchecked user input into dynamically constructed SQL statements.
C. Switch from using DBMS_SQL to EXECUTE IMMEDIATE.
D. Include the AUTHID CURRENT_USER clause in stored program units.
E. Increase the amount of code that is accessible to users by default.

Answer: B,D

Question No : 46

Examine this code:

32
Oracle 1z0-148 : Practice Test

The anonymous block fails this error stack:

Which two changes, when separately applied, would prevent these errors from occurring?

A. Define v2 as employees%ROWTYPE.
B. Initialize v1 and v2 with appropriate constructor functions.
C. Define v2 as pkg. rec.
D. Nothing because using the function TABLE (V1) is prohibited.
E. Define v1 as employees%ROWTYPE.

Answer: B,E

Question No : 47

Examine this code:

33
Oracle 1z0-148 : Practice Test

Which two corrections must be applied for this anonymous block to execute successfully?

A. Change RETURN p_tab.LAST to RETURN p_tab.COUNT.


B. Declare the collection type inside the function.
C. Declare the collection type at the schema level instead of the package.
D. Define the function as stand-alone instead of in a package body.
E. Change the INDEX BY clause from VARCHAR2 to PLS_INTEGER.
F. Modify the function return type to return a scalar, VARCHAR2.

Answer: D,E

Question No : 48

You execute this PL/SQL block:

34
Oracle 1z0-148 : Practice Test

What will be the outcome?

A. It will fail compile because of errors at lines 11 and 12.


B. It will fail compile because of errors at lines 6 and 12.
C. It will fail compile because of error at line 7.
D. It will fail compile and execute successfully.
E. It will fail compile because of errors at lines 5 and 6.

Answer: C

Question No : 49

Examine this code executed as SYS:

Examine this code executed as SPIDER and the error message received upon execution:

35
Oracle 1z0-148 : Practice Test

What is the reason for this error?

A. The procedure needs to be granted the DYNAMIC_TABLE_ROLE role.


B. The EXECUTE IMMEDIATE clause is not supported with roles.
C. Privileges granted through roles are never in effect when running definer’s rights
procedures.
D. The user SPIDER needs to be granted the CREATE TABLE privilege and the procedure
needs to be granted the DYNAMIC_TABLE_ROLE.

Answer: C

Question No : 50

Examine this code (all compiled into schema HR):

36
Oracle 1z0-148 : Practice Test

Execute this code:

SET SERVEROUTPUT ON;

EXEC test_pkg.do_stuff

What is the correct output?

A. LexDepth Dynamic Depth Name----------- ------------------- ------------------------------------------


-0 6 ___anonymous_block1 5 package body HR.TEST_PKG2 4 package body
HR.TEST_PKG3 3 package body HR.TEST_PKG4 2 package body HR.TEST_PKG0 1
procedure HR. FORMAT_CALL_STACK_12C
B. LexDepth Dynamic Depth Name----------- ------------------- ------------------------------------------

37
Oracle 1z0-148 : Practice Test
-0 6 ___anonymous_block1 5 TEST_PKG.DO_STUFF2 4 TEST_PKG.DO_STUFF.NP12 3
TEST_PKG.DO_STUFF.NP1.NP22 2 TEST_PKG.DO_STUFF.NP1.NP2.NP30 1
FORMAT_CALL_STACK_12C
C. LexDepth Dynamic Depth Name----------- ------------------- ------------------------------------------
-0 6 ___anonymous_block1 5 TEST_PKG.DO_STUFF2 4 TEST_PKG.DO_STUFF.NP13 3
TEST_PKG.DO_STUFF.NP1.NP24 2 TEST_PKG.DO_STUFF.NP1.NP2.NP30 1
FORMAT_CALL_STACK_12C
D. LexDepth Dynamic Depth Name----------- ------------------- ------------------------------------------
-0 6 ___anonymous_block1 5 DO_STUFF2 4 NP13 3 NP24 2 NP30 1
FORMAT_CALL_STACK_12C
E. .LexDepth Dynamic Depth Name----------- ------------------- ------------------------------------------
-0 6 ___anonymous_block1 5 package body HR.TEST_PKG2 4 package body
HR.TEST_PKG2 3 package body HR.TEST_PKG2 2 package body HR.TEST_PKG0 1
procedure HR. FORMAT_CALL_STACK_12C

Answer: E

Question No : 51

This result cache is enabled for the database instance.

Examine this code for a PL/SQL function:

Which two actions would ensure that the same result will be consistently returned for any
session when the same input value is passed to the function?

A. Add a parameter, fmt, and change the RETURN statement to:RETURN TO_CHAR
(date_hired, fmt);
B. Set the RESULT_CACHE_MODE parameter to FORCE.
C. Increase the value for the RESULT_CACHE_MAX_SIZE parameter.

38
Oracle 1z0-148 : Practice Test
D. Change the return type of GET_HIRE_DATE to DATE and have each session invoke
the TO_CHAR function.
E. Set the RESULT_CACHE_MAX_RESULT parameter to 0.

Answer: B,D

Question No : 52

Examine the structure and data in the CUSTOMERS table:

39
Oracle 1z0-148 : Practice Test

Examine this code:

What is the outcome on execution with SERVEROUTPUT enabled?

A. It throws a NO_DATA_FOUND exception.


B. It displays 3 for both the row count and the total.
C. It throws a PL/SQL: numeric or value error: NULL index table key value exception.
D. It displays 3 for the row count and 2 for the total.

Answer: B

Question No : 53

Which two statements are correct in Oracle Database 12c?

A. For native compilation, PLSQL_OPTIMIZE_LEWVEL should be set to 2.


B. Native compilation is the default compilation method
C. Native compilation should be used during development.
D. Natively compiles code is stored in the SYSTEM tablespace.
E. To change a PL/SQL object from interpreted to native code, set the
PLSQL_CODE_TYPE to NATIVE and recompile it.

Answer: D,E
Explanation: References:

40
Oracle 1z0-148 : Practice Test

Question No : 54

Which statement is correct about DBMS_LOB.SETOPTIONS and


DBMS_LOB.GETOPTIONS for SecureFiles?

A. DBMS_LOB.GETOPTIONS can only be used for BLOB data types.


B. DBMS_LOB.SETOPTIONS can perform operations on individual SecureFiles but not an
entire column.
C. DBMS_LOB. SETOPTIONS can set option types COMPRESS, DUPLICATE, and
ENCRYPT.
D. If a table was not created with compression specified in the store as securefile clause
then DBMS_LOB.SETOPTIONS can be used to enable it later.

Answer: D
Explanation: References:

Question No : 55

Examine this Java method in class Employee, loaded into the Oracle database:

Public static int updateSalary (String name, float salary) {…}

Which PL/SQL specification can be used to publish this method?

A. CREATE FUNCTION update_salary (p_nm VARCHAR2, p_sal NUMBER)RETURN


PLS_INTEGER AS LANGUAGE JAVALIBRARY “Employee” NAME
“updateSalary”PARAMETERS (p_nm java.lang. String, p_sal float, RETURN int);
B. CREATE FUNCTION update_salary (p_nm VARCHAR2, p_sal NUMBER)RETURN
PLS_INTEGER AS LANGUAGE JAVANAME “Employee.updateSalary”PARAMETERS
(p_nm java.lang.String, p_sal float, RETURN int);
C. CREATE FUNCTION update_salary (p_nm VARCHAR2, p_sal NUMBER)RETURN
PLS_INTEGER AS LANGUAGE JAVANAME “Employee.updateSalary”PARAMETERS
(“name” java.lang.String, “salary” float, RETURN int);
D. CREATE FUNCTION update_salary (p_nm VARCHAR2, p_sal NUMBER)RETURN
PLS_INTEGER AS LANGUAGE JAVANAME ‘Employee.updateSalary (java.lang.String,

41
Oracle 1z0-148 : Practice Test
float) return int’;
E. CREATE FUNCTION update_salary (p_nm VARCHAR2, p_sal NUMBER)RETURN
PLS_INTEGER AS LANGUAGE JAVANAME ‘int Employee.updateSalary (java.lang.String,
float)’;

Answer: C

Question No : 56

Examine this declaration section:

Which two executable sections will display the message ‘Summary is null’?

A. BEGIN1_rec := NULL;1_emp := emp_typ (1_rec);IF 1_emp (1).expr_summary IS


EMPTY THENDBMS_OUTPUT.PUT_LINE (‘Summary is null’);END IF;END;
B. BEGIN1_rec.emp_id :=1;1_rec.expr_summary := NULL;1_emp :=emp_typ (1_rec);IF
1_emp(1).expr_summary IS NULL THENDBMS_OUTPUT.PUT_LINE (‘Summary is
null’);END IF;END;
C. BEGIN1_rec.emp_id :=1;1_rec.expr_summary := EMPTY_CLOB ();1_emp := emp_typ
(1_rec);IF 1_emp(1).expr_summary IS NULL THENDBMS_OUTPUT.PUT_LINE
(‘Summary is null’);END IFEND;
D. BEGIN1_emp := emp_typ ();IF NOT 1_emp. EXISTS (1)
THENDBMS_OUTPUT.PUT_LINE (‘Summary is null’);END IFEND;
E. BEGIN1_emp. EXTEND;IF NOT 1_emp. EXISTS (1) THENDBMS_OUTPUT.PUT_LINE
(‘Summary is null’);END IFEND;

Answer: D,E

Question No : 57

42
Oracle 1z0-148 : Practice Test
The STUDENTS table exists in your schema.

Examine the DECLARE section of a PL/SQL block:

Which two blocks are valid?

A. BEGINOPEN cursor3 FOR SELECT * FROM students;cursor1 :=cursor3;END;


B. BEGINOPEN stcur;cursor1 :=stcur;END;
C. BEGINOPEN cursor1 FOR SELECT * FROM students;stcur :=cursor1;END;
D. BEGINOPEN stcur;cursor3 :=stcur;END;
E. BEGINOPEN cursor1 FOR SELECT * FROM students;cursor2 :=cursor1;END;

Answer: D,E

Question No : 58

Examine these statements:

43
Oracle 1z0-148 : Practice Test

Which two corrections will allow this anonymous block to execute successfully?

A. Add wk# .NEXT; before the 7thline.


B. Add i PLS_INTEGER; before the 3rdline.
C. Add wk#. EXTEND (1); before the 5thline.
D. Change line #2 to wk# tp_test# := tp_test# (tp_rec# ());
E. Replace lines 5 and 6 with wk# (i) := tp_rec# (i, i);

Answer: C,E

Question No : 59

Which must be true in order to add RESULT_CACHE to a function header and have it
compile successfully?

A. The IN parameters must not include BLOB, CLOB, collection or record data types.
B. The function must be created with invoker’s rights or in an anonymous block.
C. The function must be declared as a pipelined table function.
D. The function must have an OUT or an IN OUT parameter.

Answer: C
Explanation: References:

44
Oracle 1z0-148 : Practice Test

Question No : 60

Examine the structure of the EMP table:

Name Null? Type

------------------ -------------- ---------------------

EMPNO NOT NULL NUMBER (4)

ENAME VARCHAR2 (10)

SAL NUMBER (7, 2)

Examine this code:

Which code should be inserted to display the collection contents?

A. 1_indx := 1_list.FIRST;WHILE (1_indx IS NOT NULL)


LOOPDBMS_OUTPUT.PUT_LINE (1_indx || ‘ ’ || 1_list (1_indx));1_indx := 1_emp.NEXT
(1_indx);END LOOP;
B. FOR indx IN 1_list. COUNT .. -1 LOOPDBMS_OUTPUT.PUT_LINE (indx | | ‘ ’ | | 1_list
(indx));END LOOP;

45
Oracle 1z0-148 : Practice Test
C. FOR indx IN -1 .. 1_list.LIMIT LOOPDBMS_OUTPUT.PUT_LINE (indx | | ‘ ’ | | 1_list
(indx) );END LOOP;
D. FOR indx IN 1_list.FIRST . . 1_list.LAST LOOPDBMS_OUTPUT.PUT_LINE (indx | | ‘ ’ | |
1_list (indx));END LOOP;

Answer: C

Question No : 61

In your schema, the DEPARTMENTS table contains the columns DEPARTMENT_ID and
DEPARTMENT_NAME.

You want to display the department name for existing department id 10.

With SERVEROUTPUT enabled, which two blocks of code will give the required output?

A. DECLARETYPE dept_cur IS REF CURSOR;cv1 dept_cur;v_dept_name departments.


department_name%TYPE;BEGINOPEN cv1 FOR SELECT department_name FROM
departments WHERE department_id=10;IF cv1 IS NOT NULL THENFETCH cv1 INTO
v_dept_name;DBMS_OUTPUT.PUT_LINE (v_dept_name);END IFCLOSE cv1;END;
B. DECLARETYPE dept_cur IS REF CURSOR RETURN departments%ROWTYPE;cv1
dept_cur;v_dept_name departments.department_name%TYPE;BEGINOPEN cv1 FOR
SELECT * FROM departments WHERE department_id=10;FETCH cv1. department_name
INTO v_dept_name;DBMS_OUTPUT.PUT_LINE (v_dept_name);CLOSE cv1;END;
C. DECLARETYPE names_t IS TABLE OF SYS_REFCURSOR INDEX BY
PLS_INTEGER;cv1 names_t;v_dept_name
departments.department_name%TYPE;BEGINOPEN cv1 FOR SELECT
department_name FROM departments WHERE department_id=10;FETCH cv1 INTO
v_dept_name;DBMS_OUTPUT.PUT_LINE (v_dept_name);CLOSE cv1;END;
D. DECLAREcv1 SYS_REFCURSOR;v_dept_name
departments.department_name%TYPE;BEGINEXECUTE IMMEDIATE ‘BEGIN OPEN: cv1
FORSELECT department_name FROM departmnets WHERE department_id=10:
END;’USING IN cv1;FETCH cv1 INTO v_dept_name;DBMS_OUTPUT.PUT_LINE
(v_dept_name);CLOSE cv1;END;

Answer: C,D

Question No : 62

46
Oracle 1z0-148 : Practice Test
Examine the incomplete code:

Which three lines of code must be added for it to successfully compile?

A. curid := DBMS_SQL.TO_CURSOR_NUMBER (src_cur);


B. src_cur := DBMS_SQL.TO_REFCURSOR (curid);
C. src_cur= NUMBER;
D. curid NUMBER;
E. curid SYS_FEFCURSOR;
F. src_cur SYS_REFCURSOR;

Answer: B,C,F

Question No : 63

Examine this code:

47
Oracle 1z0-148 : Practice Test

Examine this DML statement executed in the SCOTT schema:

UPDATE emp SET comm = 1000 WHERE deptno= 20;

What is the outcome after executing this statement?

A. COMM is set to 1000 for all records in the EMP table where DEPTNO = 30.
B. The statement executes successfully but no rows are updated.
C. COMM is set to 1000 for all records in the EMP table where DEPTNO=20.
D. The statement fails with error ORA-28115: policy with check option violation.

Answer: D

Question No : 64

Which two are correct when migrating BasicFile LOBs to SecureFile LOBs by
DBMS_REDEFINITION?

A. Online redefinition can be done only at the table level.


B. Specify only BasicFiles LOB and SecureFiles LOB column names in parameter
col_mapping of DBMS_REDEFINITION.START_REDEF_TABLE.
C. Set the database initialization parameter db_securefile to NEVER.

48
Oracle 1z0-148 : Practice Test
D. During migration, specify the NOLOGGING storage parameter for any new SecureFiles
LOB columns.
E. Online redefinition is the recommended method for migration of BasicFile LOBs to
Secure LOBs.

Answer: B,E

Question No : 65

Examine this block:

Which two will be correct after line 5?

A. va. LAST and va. LIMIT will return the same value.
B. va. LAST and va. COUNT will return the same value.
C. va. LIMIT and va. COUNT will return the same value.
D. va. LIMIT and va. NEXT (199) will return the same value.
E. va. LAST will return 200.
F. va. NEXT (199) will return NULL.

Answer: A,C

Question No : 66

Refer to the Exhibit.

49
Oracle 1z0-148 : Practice Test

Examine this procedure created in a session where PLSQL_OPTIMIZE_LEVEL =2:

PL/SQL tracing in enabled in a user session using this command:

EXEC DBMS_TRACE.SET_PLSQL_TRACE (DBMS_TRACE.TRACE_ENABLED_LINES)

The procedure is executed using this command:

EXEC PRC_1

Examine the exhibit for the content of the PLSQL_TRACE_EVENTS table.

Why is tracing excluded from the PLSQL_TRACE_EVENTS table?

A. DBMS_TRACE.TRACE_ENABLED_LINES traces only exceptions in subprograms.


B. PRC_1 is not compiled with debugging information.
C. Tracing is not enabled with the TRACE_ENABLED_CALLS option.
D. PRC_1 is compiled with the default AUTHID DEFINER clause.
E. Tracing will be enabled only for the second execution of PRC_1.

Answer: B,E

50
Oracle 1z0-148 : Practice Test
Question No : 67

Which statement is true about the DBMS_PARALLEL_EXECUTE package?

A. DBMS_PARALLEL_EXECUTE is a SYS-owned package and can be accessed only by


a user with DBA privileges.
B. To execute chunks in parallel, users must have CREATE JOB system privilege.
C. No specific system privileges are required to create or run parallel execution tasks.
D. Only DBAs can create or run parallel execution tasks.
E. Users with CREATE TASK privilege can create or run parallel execution tasks.

Answer: B
Explanation:
Referencehttps://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_parallel_ex.htm#A
RPLS67331(security model)

Question No : 68

Examine the following SQL statement:

ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=3;

What is the result of executing this statements?

A. The PL/SQL optimize level for some existing PL/SQL units will be changed as an
immediate result.
B. The PL/SQL optimize level for subsequently complied PL/SQL units will be set to 3 and
inlining will be enabled.
C. The PL/SQL optimize level for subsequently compiled PL/SQL units will be set to 3 and
inlining will be disabled.
D. This statement will fail because PLSQL_OPTIMIZE_LEVEL can only be set at the
system level,

Answer: C

Question No : 69
51
Oracle 1z0-148 : Practice Test
Examine this code:

CREATE TYPE list_typ IS TABLE OF NUMBER;

DECLARE

l_list list_typ := list_typ ();

Which two executable sections will display the message TRUE?

A. BEGINIF l_list.LIMIT IS NOT NULL THENDBMS_OUTPUT.PUT_LINE (‘TRUE’);END


IF;END;
B. BEGINl_list.EXTEND;IF l_list.PRIOR (1_list.FIRST) IS NULL
THENDBMS_OUTPUT.PUT_LINE (‘TRUE’);END IF;END;
C. BEGINl_list.EXTEND;IF l_list IS EMPTY THENDBMS_OUTPUT.PUT_LINE
(‘TRUE’);END IF;END;
D. BEGINIF l_list.FIRST IS NULL THENDBMS_OUTPUT.PUT_LINE (‘TRUE’);END
IF;END;
E. BEGINIF l_list.FIRST =1 THENDBMS_OUTPUT.PUT_LINE (‘TRUE’);END IF;END;

Answer: B,E

Question No : 70

Examine this function body:

Which two headers will allow this function to compile successfully and take advantage of
both invoker’s rights and function result caching?

A. CREATE FUNCTION get_hire_date (emp_id NUMBER) RETURN


VARCHAR2RESULT_CACHE RELIES_ON (departments)AUTHID
CURRENT_USERISdate_hired DATE;
B. CREATE FUNCTION get_hire_date (emp_id NUMBER) RETURN
VARCHAR2RESULT_CACHEAUTHID CURRENT_USERISdate_hired DATE;

52
Oracle 1z0-148 : Practice Test
C. CREATE FUNCTION get_hire_date (emp_id NUMBER) RETURN
VARCHAR2RESULT_CACHEAUTHID DEFINERISdate_hired DATE;
D. CREATE FUNCTION get_hire_date (emp_id NUMBER) RETURN
VARCHAR2RESULT_CACHE RELIES_ON (employees)AUTHID
CURRENT_USERISdate_hired DATE;
E. CREATE FUNCTION get_hire_date (emp_id NUMBER) RETURN VARCHAR2AUTHID
DEFINERISdate_hired DATE;

Answer: D,E

Question No : 71

The STUDENTS table with column LAST_NAME of data type VARCHAR2 exists in your
database schema.

Examine this PL/SQL block:

Which two actions must you perform for this PL/SQL block to execute successfully?

A. Replace the FOR loop with FOR name_rec IN names_varray.FIRST ..


names_varray.LAST LOOP.
B. Replace the L_NAME_TYPE declaration with TYPE 1_name_type IS VARRAY (25) OF
SYS_REFCURSOR;
C. Add name_rec name_cur%ROWTYPE; at the end of the DECLARE section.
D. Replace the NAMES_VARRAY declaration with names_varray 1_name_type :=
1_name_type ();
E. Replace the NAMES_VARRAY declaration with names_varray 1_name_type := null;

53
Oracle 1z0-148 : Practice Test
F. Add names_varray.EXTEND after the FOR …LOOP statement.

Answer: E,F

Question No : 72

Which two statements are true about PL/SQL AOIs for SecureFiles?

A. DBMS_LOB can be used to compress SecureFiles columns.


B. When using DBMS_DATAPUMP, if SecureFiles LOB data needs to be encrypted then
ENCRYPTION=ALL must be specified.
C. If a BasicFiles LOB locator is passed to DBMS_LOB.ISSECUREFILE, an exception will
be raised.D An online redefinition of SecureFiles by DBMS_REDEFINIITON can be
performed with PDML (Parallel DML).

Answer: B,C

Question No : 73

Examine the section of code taken from a PL/SQL program:

PLSQL_OPTIMIZE_LEVEL PARAMETER is set to 3.

Which two statements are true?

A. Calls to TESTPROC will always be inlined as it is compiled with


PLSQL_OPTIMIZE_LEVEL=3.
B. Calls to TESTPROC are never inlined in both lines commented as Call1 and Call 2.

54
Oracle 1z0-148 : Practice Test
C. Calls to TESTPROC are not inlined in the line commented as Call 1.
D. Calls to TESTPROC are inlined in both lines commented as Call 1 and Call 2.
E. Calls to TESTPROC might be inlined in the line commented as Call 2.

Answer: A,E
Explanation: References:

Question No : 74

Which PRAGMA statement may enable associated PL/SQL functions to run more
efficiently when called from SQL?

A. PRAGMA SERIALLY_REUSABLE;
B. PRAGMA UDF;
C. PRAGMA INLINE (‘<function_name>’, ‘YES’);
D. PRAGMA AUTONOMOUS_TRANSACTION;

Answer: B
Explanation: References:

Question No : 75

In which situation will cached results become invalid?

A. When the memory allocated to the server result cache is increased using the
RESULT_CACHE_MAX_SIZE initialization parameter
B. When a session executes an insert, update, or delete statement on a table or view that
is queried by the result-cached function
C. When a session on this database instance invokes the function with the same parameter
values
D. When the RESULT_CACHE_MODE parameter is set to FORCE.
E. When a new session is opened to invoke the function which is already cached

Answer: C,D
Explanation: References:

55

You might also like