You are on page 1of 17

Oracle

F
1Z0-149

PD
Oracle Database 19c: Program with PL/SQL

QUESTION & ANSWERS


LE
Demo Version
AC
R
O

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
QUESTION 1

Which of the following statements is true about implicit cursors?

A. Implicit cursors are used for SQL statements that are not named.
B. Developers should use implicit cursors with great care.
C. Implicit cursors are used in cursor for loops to handle data processing.
D. Implicit cursors are no longer a feature in Oracle.

Correct Answer: A

F
PD
QUESTION 2

List the correct sequence of commands to process a set of records when using explicit cursors
A. INITIALIZE, GET, CLOSE
B. CURSOR, GET, FETCH, CLOSE
C. OPEN, FETCH, CLOSE
LE
D. CURSOR, FETCH, CLOSE
E. GET, SEEK, HIDE

Correct Answer: C
AC

QUESTION 3
R

Which subprogram acts like new expressions and operators?


A. Procedures
O

B. Functions
C. Both A & B
D. None of the above

Correct Answer: B

QUESTION 4

Which of the following is not true about PL/SQL collections?


A. A collection is an ordered group of elements having the same data type.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
B. A collection is an ordered group of elements having different data type.
C. Each element is identified by a unique subscript that represents its position in the collection.
D. Nested tables and Varrays are types of PL/SQL collections.

Correct Answer: A

QUESTION 5

Which of the following is true about PL/SQL nested tables?

F
A. Nested tables are like one-dimensional arrays with arbitrary number of elements.
B. Unlike arrays a nested table doesn’t have declared number of elements. The size of a nested table

PD
can increase dynamically.
C. Initially a nested array has consecutive subscripts or dense, but it can become sparse when
elements are deleted from it.
D. All of the above.
LE
Correct Answer: D

QUESTION 6
AC

You execute the following block of code:


R
O

Which statement is true about the outcome?


A. Both Output statements show different values.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
B. Both output statements show exactly the same values.
C. It gives an error because the nested blocks are not labeled
D. It gives an error because the V_CUSTOMER variable have different types in the nested blocks

Correct Answer: A

QUESTION 7

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

F
to security attacks?
A. Include the AUTHID DEFINER clause in stored program units.

PD
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.
LE
Correct Answer: B,D

QUESTION 8
AC

Which two statements are correct about PL/SQL package components? (Choose two)
A. A package must have both specification and body.
B. A package body can exist without the package specification.
C. A package specification can exist without the package body
R

D. When a packaged public variable is called for the first time in a session, the entire package is
loaded into memory.
O

Correct Answer: C,D

Explanation/Reference:

https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/packages.htm#LNPLS00904
“The first time you invoke a package subprogram, Oracle Database loads the whole package into
memory. Subsequent invocations of other subprograms in same the package require no disk I/O.”

QUESTION 9

Examine the incomplete code:

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
F
PD
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);
LE
C. src_cur= NUMBER;
D. curid NUMBER;
E. curid SYS_FEFCURSOR;
F. src_cur SYS_REFCURSOR;
AC

Correct Answer: B,D,F


R

QUESTION 10

Examine this code executed in the ORA1 schema:


O

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
F
A. It will fail with a compile-time error.
PD
What is the result of executing this query in the DBA_USER schema?
LE
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.
D. It will execute successfully, return the date and the DBA role will be granted to ORA1.
AC

Correct Answer: C

QUESTION 11
R

Examine the following PL/SQL code:


O

The server output is on for the session. Which statement is true about the execution of the
code?
A. It displays null if no employee with employee_id 123 exists.
B. It produces the ora-01403: no data found error if no employee with employee_id 123 exists.
C. It displays an error because the select into clause cannot be used to populate the PL/SQL record
type.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
D. The code executes successfully even if no employee with employee_id 123 exists and displays
Record Not Found

Correct Answer: B

Explanation/Reference:

https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/13_elems48.htm

QUESTION 12

F
Which two statements are true about triggers? (Choose two.)

PD
A. All the triggers that are created on a table cannot be disabled simultaneously.
B. Any user who has the alter privilege on a table can create a trigger using that table.
C. Oracle provides a two-phase commit process whether a trigger updates tables in the local
database or remote tables in a distributed database.
D. Triggers become invalid if a dependent object, such as 3 stored subprogram that is invoked from
the trigger body is modified, and have to be manually recompiled before the next invocation.
LE
Correct Answer: B,D
AC

Explanation/Reference:

Not A:
https://docs.oracle.com/cd/B28359_01/server.111/b28310/general004.htm#ADMIN11534
Not C:
R

https://docs.oracle.com/cd/B28359_01/server.111/b28318/triggers.htm#CNCPT1681
O

QUESTION 13

Examine this PL/SQL function:

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
F
What happens when the function is created with PLSQL_WARNINGS set to ENABLE: ALL?

PD
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.
LE
Correct Answer: C
AC

Explanation/Reference:

http://psoug.org/reference/plsql_warnings.html

QUESTION 14
R

Which of the following collections can be stored in the database?


A. Associative array and Varray
O

B. Varray and nested table


C. Associative array and nested table
D. Associative array, Varray and nested table

Correct Answer: B

QUESTION 15

Which two statements are true about anonymous blocks and named subprograms?
(Choose two)

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
A. Subprograms are by default executed with definer's rights.
B. The declare section is optional for both anonymous blocks and subprograms.
C. Both anonymous blocks and subprograms execute by default with invoker's rights.
D. The declare section is mandatory for anonymous blocks and optional for subprograms

Correct Answer: A,B

Explanation/Reference:

https://docs.oracle.com/database/121/DBSEG/dr_ir.htm#DBSEG659

F
QUESTION 16

PD
User SCOTT has been granted CREATE ANY TRIGGER AND ALTER ANY TABLE by the DBA. HR is an
existing schema in the database.
SCOTT creates the following trigger:
LE
SCOTT does not grant the execute privilege on this trigger to any other users.
AC

For which user(s) would this trigger fire by default when they drop an object in the hr schema?
A. Only HR
B. SCOTT and HR
C. Only SCOTT
D. SCOTT, HR, and SYS
R

Correct Answer: A
O

Explanation/Reference:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/lnpls/plsql-triggers.html#GUID-
6CF3A208-0BE7-45FF-928C-A755526933D0
9.5.1 SCHEMA Triggers
A SCHEMA trigger is created on a schema and fires whenever the user who owns it is the current user
and initiates the triggering event.

QUESTION 17

Identify the scenario in which you would use the current of clause for an update or delete

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
statement to rows fetched from a cursor.
A. When you want to lock the rows fetched by the cursor
B. When you want to update or delete the result set without affecting the rows in the table
C. When you want the database not to wait if the requested rows are locked by another user
D. When you want to ensure that the current rows fetched by the cursor are updated or deleted

Correct Answer: D

Explanation/Reference:

F
http://oraclexpert.com/basic-oracle-dba/sql/for-update-clause-in-a-select-statement/http://sql-
plsql.blogspot.com/2007/05/oracle-plsql-where-current-of-for.html

PD
The WHERE CURRENT OF clause in an UPDATE or DELETE statement states that the most recent row
fetched from the table should be updated or deleted. We must declare the cursor with the FOR
UPDATEclause to use this feature.”
NOTE to A: Row lock is not purpose, but side effect of using cursor for update.

QUESTION 18
LE
Which three of the following are implicit cursor attributes?
A. %found
B. %too_many_rows
C. %notfound
AC

D. %rowcount
E. %rowtype

Correct Answer: A,C,D


R
O

Explanation/Reference:

https://docs.oracle.com/database/121/LNPLS/implicit_cursor_attribute.htm#LNPLS01348

QUESTION 19

View Exhibit and examine the structure of the employees table.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
Examine the code.

F
PD
LE
AC
R
O

What would be the outcome when the code is executed?


A. It executes successfully.
B. It gives an error because the SAL variable is not visible in the increase function.
C. It gives an error because the increase function cannot be called from the RAISE_SALARY
procedure.
D. It gives an error because the increase function and the RAISE_SALARY procedure should be
declared at the beginning of the declare section before all the other declarations

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
Correct Answer: A

QUESTION 20

Which two statements are true about the usage of the cursor for loops? (Choose two.)
A. The cursor needs to be closed after the iteration is complete.
B. The implicit open, fetch, exit, and close of the cursor happen
C. The record type must be explicitly declared to control the loop.
D. The PL/SQL creates a record variable with the fields corresponding to the columns of the cursor
result set.

F
PD
Correct Answer: B,D

Explanation/Reference:

https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/cursor_for_loop_statement.htm#LNPLS115
LE
5

QUESTION 21

Which identifier is valid?


AC

A. customer_12
B. loop
C. customer@orgA
D. 12customer
R

Correct Answer: A
O

QUESTION 22

A transaction ends when


A. A COMMIT or a ROLLBACK statement is issued.
B. A DDL statement, like CREATE TABLE statement, is issued; because in that case a COMMIT is
automatically performed.
C. A DCL statement, such as a GRANT statement, is issued; because in that case a COMMIT is
automatically performed.
D. All of the above.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
Correct Answer: B

QUESTION 23

Assuming the date and time is 09/09/2009 09:09:09, what value will the following statement return
SELECT TO_CHAR(TRUNC(SYSDATE),'MM/DD/YYYY HH24:MI:SS') FROM dual;
A. 09/09/2009 09:09:09
B. 09/09/2009 09:09:09AM
C. 09/09/2009
D. 09/09/2009 00:00:00

F
E. None of the above

PD
Correct Answer: D

Explanation/Reference:
LE
Time will be truncated and then added due to the format as 00:00:00.

QUESTION 24

A transaction starts when


AC

A. The first SQL statement is performed after connecting to the database.


B. At each new SQL statement issued after a transaction is completed.
C. None of the above.
D. Both A and B.
R

Correct Answer: D
O

QUESTION 25

Select the invalid PL/SQL looping construct.

A.

B.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
C.

D.

E. None of the above. All are valid.

Correct Answer: D

F
PD
Explanation/Reference:

You would use an emulated REPEAT UNTIL Loop when you do not know how many times you want the
loop body to execute. The REPEAT UNTIL Loop would terminate when a certain condition was met.

QUESTION 26
LE
SELECT INTO statement, which does not return any rows is?
A. A runtime error
B. A syntax error
C. Both A & BS
AC

D. None of the above

Correct Answer: A
R
O

QUESTION 27

Examine the following block of code:

CREATE OR REPLACE FUNCTION del_rows


(p_table_name VARCHAR2, p_empno NUMBER)
RETURN NUMBER IS
BEGIN
EXECUTE IMMEDIATE ‘DELETE FROM ‘ || p_table_name || ‘ WHERE empno = ‘||p_empno;
RETURN SQL%ROWCOUNT;
END;
/
FUNCTION CREATED

Which two statements are correct about the code above? (Choose two.)

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
A. The function goes through only the parse and executes phases.
B. The function goes through the parse, bind, and execute phases.
C. The function goes through the parse, bind, execute, and fetch phases.
D. All the processing phases for the function are performed only at run time.
E. Only the EXECUTE IMMEDIATE statement inside the function is parsed at run time.

Correct Answer: A,E

Explanation/Reference:

F
PD
The execution of DDL statements differs from the execution of DML statements and queries, because
the success of a DDL statement requires write access to the data dictionary. For these statements,
parsing (Stage 2) actually includes parsing, data dictionary lookup, and execution.
B, C are not correct because:
“If the statement is a query, fetch its rows.” – Delete doesn’t require fetch
p_table_name and p_empno are not bind variables
LE
QUESTION 28

Which two statements are true about statement-level and row-level triggers? (Choose two.)
A. A row trigger fires once even if no rows are affected.
B. A statement trigger fires once even if no rows are affected
AC

C. Row triggers are useful if the trigger action depends on the data of rows that are affected or on
data that is provided by the triggering event itself
D. Statement triggers are useful if the trigger action depends on the data of rows that are affected or
on data that is provided by the triggering event itself.
R

Correct Answer: B,C


O

Explanation/Reference:

http://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj43125.html
statement triggers
A statement trigger fires once per triggering event and regardless of whether any rows are modified
by the insert, update, or delete event.
row triggers
A row trigger fires once for each row affected by the triggering event. If no rows are affected, the
trigger does not fire.

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
QUESTION 29

Which of the following is not a grouping function.


A. COUNT
B. SUM
C. DISTINCT
D. MIN
E. All of the above.

Correct Answer: C

F
PD
LE
AC
R
O

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html
F
PD
LE
AC
R
O

https://www.oraclepdf.com/1Z0-149-pdf-dumps.html

You might also like