Oracle Database 11g: Program with PL/SQL

QUESTION NO: 1

View the Exhibit to examine the PL/SQL code:

SREVROUPUT is on for the session. Which statement Is true about the output of the PL/SQL block?

A. The output is x = y.

B. It produces an error.

C. The output Is x != y.

D. The output Is Can't tell if x and y are equal or not.

Answer: D

Explanation:

References:

QUESTION NO: 2

Examine the following command:

SQL>ALTER SESSION

SET plsql_warnings *

'enable: severe',

'enable: performance',

'ERROR: 05003';

What is the implication of the above command?

A. It issues a warning whenever ERROR: 05003 occur during compilation.

B. It causes the compilation to fail whenever the warning ERROR.05003 occurs.

C. It issues warnings whenever the code causes an unexpected action or wrong results performance problems.

D. It causes the compilation to fail whenever the code gives wrong results or contains statements that are never executed.

Answer: B

Explanation:

References:

QUESTION NO: 3

View the exhibit and examine the structure of the products table.

Examine the following code

Which statement is true when the procedure DELETE_DETAILS is invoked?

A. It executes successfully but no error messages get recorded in the DEBUG_OUTPUT table

B. It executes successfully and any error messages get recorded in the DEBUG_OUTPUT table.

C. It gives an error because PRAGMA AUTONOMOUS_TRANSACTION can be used only in packaged procedures.

D. It gives an error because procedures containing PRAGMA AUTONOMOUS_TRANSACTION cannot be called from the exception section.

Answer: A

Explanation:

In this case, the debug output will only occur if there is an exception.

QUESTION NO: 4

Which two tasks should be created as functions instead of as procedures? (Choose two.)

A. Reference host or bind variables in a PL7SQL block of code

B. Tasks that compute and return multiple values to the calling environment

C. Tasks that compute a value that must be returned to the calling environment

D. Tasks performed in SQL that increase data independence by processing complex data analysis within the Oracle server, rather than by retrieving the data into an application

Answer: C,D

Explanation:

QUESTION NO: 5

View Exhibit1 and examine the structure of the employees table.

View Exhibit2 and examine the code.

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.

Answer: A

Explanation:

QUESTION NO: 6

What is the correct definition of the persistent state of a packaged variable?

A. It is a private variable defined in a procedure or function within a package body whose value is consistent within a user session.

B. It is a public variable in a package specification whose value is consistent within a user session.

C. It is a private variable in a package body whose value is consistent across all current active sessions.

D. It is a public variable in a package specification whose value is always consistent across all current active sessions.

Answer: B

Explanation:

QUESTION NO: 7

Examine the following block of code:

Which line in the above code would result in errors upon execution?

A. line 5

B. line 8

C. line 2

D. line 7

Answer: B

Explanation:

QUESTION NO: 8

View the Exhibit and examine the structure of the customer table.

Examine the following trigger code:

What is the outcome when the above trigger is compiled?

A. It compiles successfully.

B. It gives an error because the when condition is not valid.

C. It gives an error because when cannot be used for row-level triggers.

D. It gives an error because the statements under updating are not valid.

E. It gives an error because the new qualifier in the when clause requires a colon prefix.

Answer: A

Explanation:

QUESTION NO: 9

Which statements are true about PL/SQL procedures? (Choose all that apply.)

A. Users with definer's rights who are granted access to a procedure that updates a table must be granted access to the table itself.

B. Reuse of parsed PL/SQL code that becomes available in the shared SQL area of the server avoids the parsing overhead of SQL statements at run time.

C. Depending on the number of calls, multiple copies of the procedure are loaded into memory for execution by multiple users to speed up performance.

D. A PL/SQL procedure executing on the Oracle database can call an external procedure or function that is written in a different programming language, such as C or Java.

Answer: B,D

Explanation:

QUESTION NO: 10

The STRING_TAB table has the following structure:

View the Exhibit and examine the code.

What is the outcome on execution?

A. It displaysOutput buffer not long enough.This is my test string.-.

B. It displays onlyOutput buffer not long enough, and exits the anonymous block.

C. It displays onlyThis is my test string. - Because EXCEPTION should have been defined in the anonymous block to get the error message.

D. It does not display any of the MEMS_PUTPUT messages and gives an error because a transaction control statement cannot be used in the exception section of a procedure.

Answer: A

Explanation:

QUESTION NO: 11

Identify two situations where the DBMS_SQL package should be used. (Choose two.)

A. The SELECT list is not known until run time.

B. The dynamic SQL statement retrieves rows into records.

C. You do not know how many columns a select statement will return, or what their data types will.

D. You must use the %found SQL cursor attribute after issuing a dynamic SQL statement that is an insert or update statement.

Answer: A,C

Explanation:

QUESTION NO: 12

View the Exhibit and examine the code.

Why does the code give an error on execution?

A. because the WORD_LIST variable is not visible in procedure wording

B. because the lexicon variable is not visible in procedure ADD_ENTRY

C. because the lexicon variable is not initialized in procedure wording

D. because the WORD_LIST parameter in out mode cannot be of a record data type

Answer: A

Explanation:

QUESTION NO: 13

View the Exhibit and examine the structure of the EMP table.

Which stages are performed when the above block is executed? (Choose all that apply)

A. Bind

B. Parse

C. Fetch

D. Execute

Answer: B,C,D

Explanation:

QUESTION NO: 14

View the Exhibit and examine the structure of the EMP table.

You want to create two procedures using the overloading feature to search for employee details based on either the employee name or employee number.

Which two rules should you apply to ensure that the overloading feature is used successfully? (Choose two.)

A. The procedures can be either stand-alone or packaged.

B. The procedures should be created only as packaged subprograms

C. The procedures should be created only as stand-alone subprograms

D. Each subprogram's formal parameters should differ in both name and data type.

E. The formal parameters of each subprogram should differ in data type but can use the same names.

Answer: B,E

Explanation:

QUESTION NO: 15

Which two statements are true about the instead of triggers? (Choose two.)

A. Delete operations cannot be performed using the instead of triggers.

B. The instead or triggers must be created to add or modify data through any view.

C. The instead of triggers can be written only for views, and the before and after timing options are not valid.

D. The check option for views is not enforced when Insertions or updates to the view are performed by using the instead of trigger.

Answer: C,D

Explanation:

References:

QUESTION NO: 16

Which two statements are correct about the usage of parameters in functions? (Choose two.)

A. Functions can have only in mode parameters.

B. Functions called in SQL statements cannot have out or in out mode parameters.

C. Functions having in, out, or in out parameters can be called only in named PL/SQL subprograms

D. Functions having in, out, or in out parameters can be called In PL/SQL procedures and anonymous blocks.

Answer: B,D

Explanation:

QUESTION NO: 17

View the Exhibit and examine the structure of the employees table.

Examine the following block of code:

What is the outcome when the above code is executed?

A. It executes successfully.

B. It gives an error because decode cannot be used in a PL/SQL block.

C. It gives an error because the AVG function cannot be used in a PL/SQL block

D. It gives an error because the MONTHS_BETWEEN function cannot be used in a PL/SQL block.

E. It gives an error because both the AVG and decode functions cannot be used in a PL/SQL block.

Answer: A

Explanation:

QUESTION NO: 18

Examine the following code:

Which two statements are true about the above function? (Choose two.)

A. It can be used only in a parallelized query.

B. It can be used in both a parallelized query and a parallelized DML statement.

C. It can be used only in a parallelized data manipulation language (DML) statement.

D. It can have a separate copy run in each of the multiple processes when called from a SQL statement that is run in parallel.

E. It requires a PRAGMA RESTRICT_REFERENCES declaration with RNDS, WNDS, RNPS, and WNPS specified in order to use parallel optimization.

Answer: B,D

Explanation:

References:

QUESTION NO: 19

/temp/my_files is an existing folder in the server, facultylist.txt is an existing text file in this folder

Examine the following commands that are executed by the DBA:

SQL>CREATE DIRECTION my_dir AS ‘ /temp/my_files’:

SQL>GRANT READ ON DIRECTORY my_dir To pubiic:

View the Exhibit and examine the procedure created by user SCOTT to read the list of faculty names from the text file.

SCOTT executes the procedure as follows:

SQL>SET SERVEROUTPUT ON

SQL>EXEC read_file (‘MY_DIR’, FACULTYLIST.TXT’)

What is the outcome?

A. It goes into an infinite loop.

B. It executes successfully and displays only the list of faculty names.

C. It does not execute and displays an error message because the end-of-file condition is not taken care of.

D. It executes successfully and displays the list of faculty names followed by a "no data found” error message.

Answer: D

Explanation:

References:

QUESTION NO: 20

View the Exhibit to examine the PL/SQL block.

Which statement is true about the execution of the PL/SQL block?

A. It executes successfully and gives the desired output.

B. It does not execute because the definition of type population is indexed by VARCHAR2.

C. It executes, and the string keys of an associative array are not stored in creation order, but in sorted order.

D. It does not execute because the value that is once assigned to the element of the associative array cannot be changed.

Answer: C

Explanation:

References:

QUESTION NO: 21

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:

CREATE OR REPLACE TRIGGER drop_trigger

BEFORE DROP ON hr.SCHEMA

BEGIN

RAISE_APPLICATION_ERROR (-20000, ‘Cannot drop object');

END:

SCOTT does not grant the execute privilege on this trigger to any other users.

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

Answer: A

Explanation:

QUESTION NO: 22

Which two statements are true about the continue statement? (Choose two.)

A. The PL/SQL block execution terminates immediately.

B. The CONTINUE statement cannot appear outside a loop.

C. The loop completes immediately and control passes to the statement after end loop.

D. The statements after the continue statement in the iteration are executed before terminating the LOOP.

E. The current iteration of the loop completes immediately and control passes to the next iteration of the loop

Answer: B,E

Explanation:

QUESTION NO: 23

View the Exhibit and examine the code and its outcome on execution:

What would be the effect on the two procedures if the value of debug is set to false? (Choose two.)

A. MY_PROC2 is not recompiled.

B. MY_PROC1 is recompiled but remains unchanged.

C. MY_PROC2 is recompiled but remains unchanged.

D. MY_PROC1 is recompiled without the debugging code.

Answer: C,D

Explanation:

References:

QUESTION NO: 24

View Exhibit1 and examine the structure of the DO table.

View Exhibit2 and examine the code.

The anonymous block gives an error on execution. What is the reason?

A. The assignment in line 7 is not valid.

B. The SQL does not support the Boolean data type.

C. A null value cannot be applied to the bind arguments in the using clause in line 10

D. The names of bind variables must be the same as the using clause bind arguments in line 10

Answer: B

Explanation:

QUESTION NO: 25

View the Exhibit and examine the structure of the departments table in SCOTT’s schema.

Examine the following block of code:

CREATE OR REPLACE PROCEDURE add_dept(

p_id NUMBER, p_name VARCHAR2) IS

BEGIN

INSERT INTO departments VALUES <p_id, p_name, NULL, NULL);

END;

/

The above procedure is created by user SCOTT. Another user JONES needs to use the procedure.

Which two statements are true in the above scenario? (Choose two.)

A. JONES executes the procedure with definer's rights.

B. JONES executes the procedure with invoker's rights.

C. SCOTT should grant only the execute privilege for the procedure to JONES.

D. SCOTT should grant both the BXKCOTE privilege for the procedure and insert privilege for the table to

Answer: A,C

Explanation:

QUESTION NO: 26

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.

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.

Answer: B,C

Explanation:

QUESTION NO: 27

Identify two features of obfuscation. (Choose two.)

A. The Import and Export utilities accept wrapped files.

B. SQL' Plus cannot process the obfuscated source files.

C. Only the wrap utility can obfuscate multiple programs at a time.

D. Both the DBMS_DDL package and the Wrap utility can obfuscate multiple programs at a time.

E. The source code is visible only through the DBA_SOURCE view and not through the USER_SOURCE or ALL_SOURCE View

Answer: A,C

Explanation:

QUESTION NO: 28

You create the following table and execute the following code:

Which statement is true about the outcome of the above code?

A. It executes successfully and all the rows are updated.

B. It gives an error but saves the inserted rows and the update to the first row.

C. It gives an error but saves the inserted rows; however, no rows are updated.

D. It gives an error and all the data manipulation language (DML) statements are rolled back

Answer: B

Explanation:

QUESTION NO: 29

You want to create a trigger that fires whenever rows are deleted from the customer table and that displays the number of rows remaining in the table.

Which two statements are correct about the trigger to be created for the above requirement? (Choose two.)

A. It should be an after trigger.

B. It should be a before trigger.

C. It should be a row-level trigger.

D. It should be a statement-level trigger.

E. It can be a before or an after trigger.

Answer: A,D

Explanation:

QUESTION NO: 30

Examine the following code that you plan to execute:

What correction should be performed in the above code?

A. The PROC2 procedure code should be defined in the package body.

B. The PROC3 procedure should be declared in the package specification.

C. The PROC3 procedure header should be declared at the beginning of the package body.

D. The variable x must be declared in the package body and removed from the specification,

Answer: A

Explanation:

QUESTION NO: 31

ORDER_TOTAL is a column in the orders table with the data type and size as number (8, 2) Examine the following code:

Which statement is correct about the above code?

A. It gives an error in line 3

B. It gives an error in line 4

C. It gives an error in line 6

D. It executes successfully and displays the output.

Answer: B

Explanation:

QUESTION NO: 32

View the Exhibit and examine the blocks of code that you plan to execute.

Which statement is true about the blocks of code?

A. All the blocks execute successfully and the anonymous block displays123cant: 4545cnt: 45

B. All the blocks execute successfully and the anonymous block displays123cut: 045cart: 1

C. The anonymous block gives an error because the function invocation in line 2 is not valid.

D. The procedure creation gives an error because the function invocation in line 1 is not valid.

Answer: A

Explanation:

QUESTION NO: 33

Which statement is true about triggers on data definition language (DDL) statements?

A. They can be used to track changes only to a table or index.

B. They can be defined by all users in the database or only by a specific user.

C. They are fired only when the owner of the object Issues the DDL statement.

D. They can be used to track changes to a table, table space, view, or synonym.

Answer: D

Explanation:

QUESTION NO: 34

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.

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

Answer: C,D

Explanation:

QUESTION NO: 35

In which of the following scenarios would you recommend using associative arrays?

A. When you want to retrieve an entire row from a table and perform calculations

B. When you know the number of elements in advance and the elements are usually accessed sequentially

C. When you want to create a separate lookup table with multiple entries for each row of the main table, and access it through join queries

D. When you want to create a relatively small lookup table, where the collection can be constructed on memory each time a subprogram is invoked.

Answer: D

Explanation:

QUESTION NO: 36

View Exhibit1 and examine the structure of the EMP table.

View Exhibit2 and examine the code.

EKPNOS 7845 and 7900 exist in the EMP table.

Which two calls to the RAISE_SALABY procedure in the anonymous block execute successfully? (Choose two.)

A. call in line 6

B. call in line 7

C. call in line 8

D. call in line 9

Answer: C,D

Explanation:

QUESTION NO: 37

Examine the following code:

Which statement is true about the execution of the above code?

A. It executes and displays null.

B. It executes and the condition returns true.

C. It executes and control goes to the else statement.

D. It fails because no value is assigned to the v_myage variable.

Answer: C

Explanation:

QUESTION NO: 38

Which system events can be used to create triggers that fire both at database and schema levels? (Choose all that apply)

A. AFTER LOGON

B. AFTER STARTUP

C. BEFORE SHUTDOWN

D. AFTER SERVERERROR

Answer: A,D

Explanation:

http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/create_trigger.htm#LNPLS2064

QUESTION NO: 39

In which of the following scenarios would you recommend using PL/SQL records?

A. when you want to retrieve an entire row from a table and perform calculations

B. when you know the number of elements in advance and the elements are usually accessed sequentially

C. when you want to create a separate lookup table with multiple entries for each row of the main table, and access it through join queries

D. when you want to create a relatively small lookup table, where the collection can be constructed in memory each time a subprogram is invoked

Answer: A

Explanation:

QUESTION NO: 40

View the Exhibit and examine the structure of the employees table.

Execute the following block of code:

What is the outcome?

A. It gives an error because group functions cannot be used in anonymous blocks

B. It executes successfully and correctly gives the result of the sum of salaries in department 60.

C. It executes successfully and incorrectly gives the result of the sum of salaries in department 60.

D. It gives an error because the variable name and column name are the same in the where clause of the select statement.

Answer: C

Explanation:

Site Search:

Close

Close
Download Free Demo of VCE
Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.


Simply submit your e-mail address below to get started with our interactive software demo of your free trial.


Enter Your Email Address

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.