OCA 1Z0-144 ORACLE

Description

Oracle Database 11g Program with PLSQL
Juan Taborda
Quiz by Juan Taborda, updated more than 1 year ago
Juan Taborda
Created by Juan Taborda almost 4 years ago
89
0

Resource summary

Question 1

Question
View the Exhibit to examine the PL/SQL code: DECLARE x NUMBER := 5; y NUMBER := NULL; BEGIN IF x != y THEN --yields NULL, not TRUE DBMS_OUTPUT.PUT_LINE('x != y'); --not run ELSIF x = y THEN --also yields NULL DBMS_OUTPUT.PUT_LINE('x = y'); ELSE DBMS_OUTPUT.PUT_LINE('Cant tell if x and y are equal or not.'); END IF; END; / SREVROUPUT is on for the session. Which statement is true about the output of the PL/SQL block?
Answer
  • The output is x = y.
  • It produces an error.
  • The output is x != y.
  • The output is Can't tell if x and y are equal or not.

Question 2

Question
Examine the following command: SQL>ALTER SESSION SET plsql_warnings * 'enable: severe', 'enable: performance', 'ERROR: 05003'; What is the implication of the above command?
Answer
  • It issues a warning whenever ERROR: 05003 occur during compilation.
  • It causes the compilation to fail whenever the warning ERROR.05003 occurs.
  • It issues warnings whenever the code causes an unexpected action or wrong results performance problems.
  • It causes the compilation to fail whenever the code gives wrong results or contains statements that are never executed.

Question 3

Question
View the exhibit and examine the structure of the products table. Examine the following code: CREATE TABLE debug_output (msg VARCHAR2(100)); CREATE OR REPLACE PROCEDURE debugging (msg VARCHAR) AS PRAGMA AUTONOMOUS_TRANSACTION; BEGIN INSERT INTO debug_output VALUES (msg); COMMIT; END debugging; / CREATE OR REPLACE PROCEDURE delete_details (p_id NUMBER) AS msg VARCHAR2(100); BEGIN DELETE FROM products WHERE prod_id = p_id COMMIT; EXCEPTION WHEN OTHERS THEN msg := SUBSTR(sqlerm,100); debugging(msg); END delete_details; / Which statement is true when the procedure DELETE_DETAILS is invoked?
Answer
  • It executes successfully but no error messages get recorded in the DEBUG_OUTPUT table
  • It executes successfully and any error messages get recorded in the DEBUG_OUTPUT table.
  • It gives an error because PRAGMA AUTONOMOUS_TRANSACTION can be used only in packaged procedures.
  • It gives an error because procedures containing PRAGMA AUTONOMOUS_TRANSACTION cannot be called from the exception section.

Question 4

Question
Which two tasks should be created as functions instead of as procedures?
Answer
  • Reference host or bind variables in a PL/SQL block of code
  • Tasks that compute and return multiple values to the calling environment
  • Tasks that compute a value that must be returned to the calling environment
  • Tasks performed in SQL that increase data independence by processing complex data analysis within the Oracle server, rather than by retrieving the data into

Question 5

Question
View Exhibit 1 and examine the structure of the employees table. View Exhibit 2 and examine the code. DECLARE emp_num NUMBER(6) := 120; sal NUMBER FUNCTION increase(emp_num NUMBER) RETURN number IS inc_amt NUMBER; BEGIN SELECT salary into sal FROM employees WHERE employee_id = emp_num; inc_amt := sal * .10; RETURN inc_amt; END; PROCEDURE raise_salary(emp_id NUMBER) IS amt NUMBER; BEGIN amt := increase(emp_num); UPDATE employees SET salary = salary + amt WHERE employee_id = emp_id; END raise_salary; BEGIN raise_salary(emp_num); COMMIT; END; / What would be the outcome when the code is executed?
Answer
  • It executes successfully.
  • It gives an error because the SAL variable is not visible in the increase function.
  • It gives an error because the increase function cannot be called from the RAISE_SALARY procedure.
  • 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

Question 6

Question
What is the correct definition of the persistent state of a packaged variable?
Answer
  • It is a private variable defined in a procedure or function within a package body whose value is consistent within a user session.
  • It is a public variable in a package specification whose value is consistent within a user session.
  • It is a private variable in a package body whose value is consistent across all current active sessions.
  • It is a public variable in a package specification whose value is always consistent across all current active sessions.

Question 7

Question
Examine the following block of code: Which line in the above code would result in errors upon execution?
Answer
  • line 5
  • line 8
  • line 2
  • line 7

Question 8

Question
View the Exhibit and examine the structure of the customer table. Examine the following trigger code: CREATE OR REPLACE TRIGGER max_credit_limit BEFORE INSERT OR UPDATE OF cust_category ON customer FOR EACH ROW WHEN (NEW / cust_category IS NULL) BEGIN IF INSERTING THEN :NEW.cust_category := 'C'; :NEW.cust_credit_limit := 8000; ELSIF UPDATING THEN :NEW.cust_category := :OLD.cust_category; :NEW.cust_credit_limit := :OLD.cust_credit_limit; END IF; END; / What is the outcome when the above trigger is compiled?
Answer
  • It compiles successfully.
  • It gives an error because the when condition is not valid.
  • It gives an error because when cannot be used for row-level triggers.
  • It gives an error because the statements under updating are not valid.
  • It gives an error because the new qualifier in the when clause requires a colon prefix.

Question 9

Question
Which statements are true about PL/SQL procedures? (Choose all that apply.)
Answer
  • Users with definer's rights who are granted access to a procedure that updates a table must be granted access to the table itself.
  • 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.
  • Depending on the number of calls, multiple copies of the procedure are loaded into memory for execution by multiple users to speed up performance.
  • 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 Java or C

Question 10

Question
The STRING_TAB table has the following structure: NAME NULL? TYPE STRING1 VARCHAR2(100) View the Exhibit and examine the code. What is the outcome on execution?
Answer
  • It displays Output buffer not long enough. This is my test string.
  • It displays only Output buffer not long enough, and exits the anonymous block.
  • It displays only This is my test string. - Because EXCEPTION should have been defined in the anonymous block to get the error message.
  • 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

Question 11

Question
Identify two situations where the DBMS_SQL package should be used.
Answer
  • The SELECT list is not known until run time.
  • The dynamic SQL statement retrieves rows into records.
  • You do not know how many columns a select statement will return, or what their data types will.
  • You must use the % found SQL cursor attribute after issuing a dynamic SQL statement that is an insert or update statement.

Question 12

Question
View the Exhibit and examine the code. Why does the code give an error on execution?
Answer
  • because the WORD_LIST parameter is not visible in procedure wording
  • because the lexicon variable is not visible in procedure ADD_ENTRY
  • because the lexicon variable is not initialized in procedure wording
  • because the WORD_LIST parameter in out mode cannot be of a record data type

Question 13

Question
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)
Answer
  • Bind
  • Parse
  • Fetch
  • Execute

Question 14

Question
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?
Answer
  • The procedures can be either stand-alone or packaged.
  • The procedures should be created only as packaged subprograms.
  • The procedures should be created only as stand-alone subprograms.
  • Each subprogram's formal parameters should differ in both name and data type
  • The formal parameters of each subprogram should differ in data type but can use the same names.

Question 15

Question
Which two statements are true about the instead of triggers?
Answer
  • Delete operations cannot be performed using the instead of triggers.
  • The instead or triggers must be created to add or modify data through any view.
  • The instead of triggers can be written only for views, and the before and after timing options are not valid.
  • The check option for views is not enforced when Insertions or updates to the view are performed by using the instead of triggers.

Question 16

Question
Which two statements are correct about the usage of parameters in functions?
Answer
  • Functions can have only in mode parameters.
  • Functions called in SQL statements cannot have out or in out mode parameters.
  • Functions having in, out, or in out parameters can be called only in named PL/SQL subprograms
  • Functions having in, out, or in out parameters can be called in PL/SQL procedures and anonymous blocks.

Question 17

Question
View the Exhibit and examine the structure of the employees table. Examine the following block of code: DECLARE v_sal NUMBER; v_name VARCHAR2(30); v_tenure NUMBER; v_hire_date DATE; BEGIN SELECT AVG(salary) INTO v_sal FROM employees; SELECT hire_date, DECODE(salary,v_sal,last_name,'NA') INTO v_hire_date, v_name FROM employees WHERE employee_id = 195; v_tenure := MONTHS_BETWEEN(CURRENT_DATE, v_hire_date); END; / What is the outcome when the above code is executed?
Answer
  • It executes successfully.
  • It gives an error because decode cannot be used in a PL/SQL block.
  • It gives an error because the AVG function cannot be used in a PL/SQL block
  • It gives an error because the MONTHS_BETWEEN function cannot be used in a PL/SQL block.
  • It gives an error because both the AVG and decode functions cannot be used in a PL/SQL block.

Question 18

Question
Examine the following code: CREATE OR REPLACE FUNCTION f2 (p_p1 NUMBER) RETURN NUMBER PARALLEL_ENABLE IS BEGIN RETURN p_p1 * 2; END f2; Which two statements are true about the above function?
Answer
  • It can be used only in a parallelized query.
  • It can be used in both a parallelized query and a parallelized DML statement.
  • It can be used only in a parallelized data manipulation language (DML) statement.
  • It can have a separate copy run in each of the multiple processes when called from a SQL statement that is run in parallel.
  • It requires a PRAGMA RESTRICT_REFERENCES declaration with RNDS, WNDS, RNPS, and WNPS specified in order to use parallel optimization.

Question 19

Question
/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 public: 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?
Answer
  • It goes into an infinite loop.
  • It executes successfully and displays only the list of faculty names.
  • It does not execute and displays an error message because the end-of-file condition is not taken care of.
  • It executes successfully and displays the list of faculty names followed by a "no data found" error message.

Question 20

Question
View the Exhibit to examine the PL/SQL block. Which statement is true about the execution of the PL/SQL block?
Answer
  • It executes successfully and gives the desired output.
  • It does not execute because the definition of type population is indexed by VARCHAR2.
  • It executes, and the string keys of an associative array are not stored in creation order, but in sorted order.
  • It does not execute because the value that is once assigned to the element of the associative array cannot be changed.

Question 21

Question
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?
Answer
  • Only HR
  • SCOTT and HR
  • Only SCOTT
  • SCOTT, HR, and SYS

Question 22

Question
Which two statements are true about the continue statement?
Answer
  • The PL/SQL block execution terminates immediately.
  • The CONTINUE statement cannot appear outside a loop.
  • The loop completes immediately and control passes to the statement after end loop.
  • The statements after the continue statement in the iteration are executed before terminating the LOOP.
  • The current iteration of the loop completes immediately and control passes to the next iteration of the loop.

Question 23

Question
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?
Answer
  • MY_PROC2 is not recompiled.
  • MY_PROC1 is recompiled but remains unchanged.
  • MY_PROC2 is recompiled but remains unchanged.
  • MY_PROC1 is recompiled without the debugging code.

Question 24

Question
View Exhibit 1 and examine the structure of the DO table. Name Null? Type ---------- --------- ----------- EMPNO NOT NULL NUMBER(4) EMPNAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) View Exhibit 2 and examine the code. The anonymous block gives an error on execution. What is the reason?
Answer
  • The assignment in line 7 is not valid.
  • The SQL does not support the Boolean data type.
  • A null value cannot be applied to the bind arguments in the using clause in line 10.
  • The names of bind variables must be the same as the using clause bind arguments in line 10.
  • The anonymous block execute successfully

Question 25

Question
View the Exhibit and examine the structure of the departments table in SCOTTs 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?
Answer
  • JONES executes the procedure with definer's rights.
  • JONES executes the procedure with invoker's rights.
  • SCOTT should grant only the execute privilege for the procedure to JONES.
  • SCOTT should grant both the BXKCOTE privilege for the procedure and insert privilege for the table to

Question 26

Question
Which two statements are true about statement-level and row-level triggers?
Answer
  • A row trigger fires once even if no rows are affected.
  • A statement trigger fires once even if no rows are affected.
  • 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.
  • 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.

Question 27

Question
Identify two features of obfuscation.
Answer
  • The Import and Export utilities accept wrapped files.
  • SQL' Plus cannot process the obfuscated source files.
  • Only the wrap utility can obfuscate multiple programs at a time.
  • Both the DBMS_DDL package and the Wrap utility can obfuscate multiple programs at a time.
  • The source code is visible only through the DBA_SOURCE view and not through the USER_SOURCE or ALL_SOURCE View

Question 28

Question
You create the following table and execute the following code: Which statement is true about the outcome of the above code?
Answer
  • It executes successfully and all the rows are updated.
  • It gives an error but saves the inserted rows and the update to the first row.
  • It gives an error but saves the inserted rows; however, no rows are updated.
  • It gives an error and all the data manipulation language (DML) statements are rolled back.

Question 29

Question
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?
Answer
  • It should be an after trigger.
  • It should be a before trigger.
  • It should be a row-level trigger.
  • It should be a statement-level trigger.
  • It can be a before or an after trigger.

Question 30

Question
Examine the following code that you plan to execute: What correction should be performed in the above code?
Answer
  • The PROC2 procedure code should be defined in the package body.
  • The PROC3 procedure should be declared in the package specification.
  • The PROC3 procedure header should be declared at the beginning of the package body.
  • The variable x must be declared in the package body and removed from the specification,

Question 31

Question
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?
Answer
  • It gives an error in line 3.
  • It gives an error in line 4.
  • It gives an error in line 6.
  • It executes successfully and displays the output.

Question 32

Question
View the Exhibit and examine the blocks of code that you plan to execute. Which statement is true about the blocks of code?
Answer
  • All the blocks execute successfully and the anonymous block displays123cnt: 4545cnt: 45.
  • All the blocks execute successfully and the anonymous block displays123cnt: 045cnt: 1.
  • The anonymous block gives an error because the function invocation in line 2 is not valid.
  • The procedure creation gives an error because the function invocation in line 1 is not valid.

Question 33

Question
Which statement is true about triggers on data definition language (DDL) statements?
Answer
  • They can be used to track changes only to a table or index.
  • They can be defined by all users in the database or only by a specific user.
  • They are fired only when the owner of the object Issues the DDL statement.
  • They can be used to track changes to a table, table space, view, or synonym.

Question 34

Question
Which two statements are correct about PL/SQL package components?
Answer
  • A package must have both specification and body.
  • A package body can exist without the package specification.
  • A package specification can exist without the package body.
  • When a packaged public variable is called for the first time in a session, the entire package is loaded into memory.

Question 35

Question
In which of the following scenarios would you recommend using associative arrays?
Answer
  • When you want to retrieve an entire row from a table and perform calculations
  • When you know the number of elements in advance and the elements are usually accessed sequentially
  • 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
  • When you want to create a relatively small lookup table, where the collection can be constructed on memory each time a subprogram is invoked.

Question 36

Question
View Exhibit 1 and examine the structure of the EMP table. NAME Null? Type EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) View Exhibit 2 and examine the code. EKPNOS 7845 and 7900 exist in the EMP table. Which two calls to the RAISE_SALARY procedure in the anonymous block execute successfully?
Answer
  • call in line 6
  • call in line 7
  • call in line 8
  • call in line 9

Question 37

Question
Examine the following code: Which statement is true about the execution of the above code?
Answer
  • It executes and displays null.
  • It executes and the condition returns true.
  • It executes and control goes to the else statement.
  • It fails because no value is assigned to the v_myage variable.

Question 38

Question
Which system events can be used to create triggers that fire both at database and schema levels?
Answer
  • AFTER LOGON
  • AFTER STARTUP
  • BEFORE SHUTDOWN
  • AFTER SERVERERROR

Question 39

Question
In which of the following scenarios would you recommend using PL/SQL records?
Answer
  • when you want to retrieve an entire row from a table and perform calculations
  • when you know the number of elements in advance and the elements are usually accessed sequentially
  • 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
  • when you want to create a relatively small lookup table, where the collection can be constructed in memory each time a subprogram is invoked

Question 40

Question
View the Exhibit and examine the structure of the employees table. NAME NULL? TYPE EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4) Execute the following block of code: What is the outcome?
Answer
  • It gives an error because group functions cannot be used in anonymous blocks.
  • It executes successfully and correctly gives the result of the sum of salaries in department 60.
  • It executes successfully and incorrectly gives the result of the sum of salaries in department 60.
  • It gives an error because the variable name and column name are the same in the where clause of the select statement.

Question 41

Question
Examine the following snippet of PL/SQL code: DECLARE emp_job employees.job_id%TYPE := 'ST_CLERK'; emp_salary employees.salary%TYPE := 3000; my_record employees%ROWTYPE; CURSOR cl (job VARCHAR2, max_wage NUMBER) IS SELECT * FROM employees WHERE job_id = job AND salary > max_wage; BEGIN .............. View the exhibit for table description of EMPLOYEES table. The EMPLOYEES table has 200 rows. Identify open statement for opening the cursor that fetches the result as consisting of employees with JOB_ID as ST_CLERK and salary greater than 3000.
Answer
  • OPEN c1 (NULL, 3000);
  • OPEN c1 (emp_job, 3000);
  • OPEN c1 (3000, emp_salary);
  • OPEN c1 (‘ST_CLERK’, 3000)
  • OPEN c1 (EMP_job, emp_salary);

Question 42

Question
View the exhibit and examine the structure of the EMPLOYEES table. NAME NULL? TYPE EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4) The salary of EMPLOYEE_ID 195 is 2800. You execute the following code: What is the outcome?
Answer
  • It gives an error because only the innermost block is labeled.
  • It gives an error because the same variable name cannot be used across all the nested blocks.
  • It executes successfully and displays the resultant values in the following sequence- 1000, 2800 50000, 2800.
  • It executes successfully and displays the resultant values in the following sequence: 1000, 2800, 50000, 1000.

Question 43

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

Question 44

Question
Examine the following PL/SQL code: Which statement is true about the execution of the code if the query in the PL/SQL block returns no rows?
Answer
  • The program abruptly terminates and an exception is raised.
  • The program executes successfully and the output is No ROWS_FOUND.
  • The program executes successfully and the query fetches a null value in the V_LNAME variable.
  • Program executes successfully, fetches a NULL value in the V_LNAME variable and an exception is raised.

Question 45

Question
Consider the following scenario: Local procedure A calls remote procedure B. Procedure A was compiled at 8 AM. Procedure A was modified and recompiled at 9 AM. Remote procedure B was later modified and recompiled at 11 AM. The dependency mode is set to timestamp. Which statement correctly describes what happens when procedure A is invoked at 1 PM?
Answer
  • Procedure A is invalidated and recompiled immediately.
  • There is no effect on procedure A and it runs successfully.
  • Procedure B is invalidated and recompiled again when invoked.
  • Procedure A is invalidated and recompiles when invoked the next time.

Question 46

Question
View the Exhibit to examine the PL/SQL block. Which statement is true about the output of the PL/SQL block?
Answer
  • It executes and the Output is emprec.deptname: .
  • It executes and the Output is emprec.deptname: Sales.
  • It produces an error because NULL is assigned to the emprec.empid field in the record.
  • It produces an error because the CHECK constraint is violated while assigning a value to the emprec.deptid field in the record.

Question 47

Question
Examine the following snippet of code from the DECLARE section of PL/SQL DECLARE - Cust_name VARCHAR2 (20) NOT NULL : = Tom Jones: Same_name cust_name%TYPE: Which statement is correct about the above snippets of code?
Answer
  • The SAME_NAME variable inherits only the data type from the CUST_NAME variable.
  • The SAME_NAME variable inherits only the data type and default value from the CUST_NAME variable.
  • The SAME_NAME variable inherits the data type, constraint, and default value from the CUST_NAME variable.
  • The SAME_NAME variable inherits only the data type and constraint from the CUST_NAME variable resulting in an error

Question 48

Question
Examine the following package specification. SQL>CREATE OR REPLACE PACKAGE emp_pkf IS PROCEDURE search_emp (empdet NUMBER); PROCEDURE search_emp (empdet DATE); PROCEDURE search_emp (empdet NUMBER); RETURN VARCHAR2 PROCEDURE search_emp (empdet NUMBER); RETURN DATE END emp_pkg - / The package is compiled successfully Why would it generate an error at runtime?
Answer
  • Because function cannot be overload.
  • Because function cannot differ only in return type.
  • Because all the functions and procedures in the package cannot have the same number of parameters with the same parameter name.
  • Because the search EMP (EMPDET NUMBER) procedure and the SEARCH_DEPT (EMPDET NUMBER) cannot have identical parameter names and data types.

Question 49

Question
Which two statements are true about PL/SQL exception propagation?
Answer
  • The exception reproduces itself in successive enclosing blocks until a handler is found.
  • Exception- can propagate across the remote subprograms that are called through database links.
  • If you declare a local exception in a subblock and a global exception in the outer block, the local declaration overrides the global exception.
  • If you declare a local exception in a subblock and a global exception in the outer block, the global declaration overrides the local exception.

Question 50

Question
Which tasks must be performed during the installation of the UTL_MAIL package?
Answer
  • setting the UTL_FILE_DIR initialization parameter
  • running the UTLMAIL.SQL and prvtmail.plb scripts
  • setting the SMTP_OUT_SERVER initialization parameter
  • using the CREATE DIRECTORY statement to associate an alias with an operating system directory
  • granting read and WRITE privileges to control the type of access to files in the operating system

Question 51

Question
You want to maintain an audit of the date and time when each user of the database logs off. Examine the following code: Which two clauses should be used to fill in the blanks and complete the above code?
Answer
  • ON SCHEMA
  • ON DATABASE
  • AFTER LOGOFF
  • BEFORE LOGOFF

Question 52

Question
View Exhibit 1 and examine the structure of the product table. NAME NULL? TYPE PROD_ID NOT NULL NUMBER(4) PROD_NAME NOT NULL VARCHAR2(10) PROD_LIST_PRICE NOT NULL NUMBER(0,2) PROD_VALID VARCHAR2(1) View Exhibit 2 and examine the procedure you created. The procedure uses the prod id to determine whether the list price is within a given range. You then create the following trigger on the product table. CREATE OR REPLACE TRIGGER check_price__trg BEFORE INSERT OR UPDATE OF prod_id, prod_list_price ON product FOR EACH ROW - WHEN (new.prod_id <> NVL(old.prod_id,0) OR New.prod__list_price <> NVL(old.prod_list_price, 0) ) BEGIN - check_price (: new.prod_id) ; END - / Examine the following update command for an existing row in the product table. SQL> UPDATE product SET prod_list_price = 10 WHERE prod_id=115; Why does it generate an error?
Answer
  • Because the procedure call in the trigger is not valid
  • Because the condition specified in the when clause is not valid
  • Because both the procedure and trigger access the same table
  • Because the WHEN clause cannot be used with a row-level trigger
  • Because the column list specified with UPDATE in the trigger is not valid

Question 53

Question
View Exhibit 1 and examine the structure of the employees table. NAME NULL? TYPE EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4) User SCOTT needs to generate a text report that contains the names of all employees and their salaries. Examine the following commands issued by the DBA: SQL_CREATE DICTORY my_dir AS '/temp/my_files* ; SQL_GRANT WRITE ON DIRECTORY my_dir TO SCOTT; View Exhibit 2 and examine the procedure code. You issue the following command: You issue the following command: SQL_EXEC sal_status ('MY_DIR', 'EMPREPORT.TXT') What is the outcome?
Answer
  • It executes successfully and creates the report.
  • It gives an error because the text file should be opened in append mode.
  • It gives an error because the "no data found" condition is not handled to come out of the loop.
  • It gives an error because user SCOTT should be granted both read and write privileges to the directory alias.
  • It executes but no data is written to the text file because the FFLUSH subprogram is not used to write all the data buffered in memory to a file.

Question 54

Question
Which two statements are true about the handling of internally defined or user-defined PL/SQL exceptions?
Answer
  • Add exception handlers whenever errors occur.
  • An exception handler should commit the transaction.
  • Handle named exceptions whenever possible instead of using when others in exception handlers.
  • Instead of adding exception handlers to your PL/SQL block, check for errors at every point where they may occur

Question 55

Question
View Exhibit 1 and examine the structure of the EMP table. NAME NULL? TYPE EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) View Exhibit 2 and examine the code created by the user SCOTT: SCOTT grants the necessary privileges to GREEN to access the EMP table and execute the package. Examine the following sequence of activities: SCOTT starts a session and issues the SQL>EXEC CURS_PKG.OPEN command. SCOTT then issues the SQL>EXEC CURS_PKG.NEXT command. green starts a session while SCOTTs session is running and issues THE SQL>EXEC CURS_PKG.NEXT command. SCOTT issues the SQI>>EXEC SCOTT.CURS_PKG.NEXT command. The EMP table contains sequential EMPNOS from 100 through 108. Which statement correctly describes the output?
Answer
  • SCOTT’s session shows the EMPNO 100, GREEN'S session shows an error, and SCOTT’s session shows an error.
  • SCOTT’s session shows the EMPNO 100, GREEN'S session shows EMPNO 100, and SCOTT’s session shows the EMPNO 101.
  • SCOTT’s session shows the EMPNO 100, GREEN'S session shows an error, and SCOTT’s session shows the second EMPNO 101.
  • SCOTT’s session shows the EMPNO 100, GREEN'S session shows EMPNO 101, and SCOTT’s session shows the second EMPNO 102.

Question 56

Question
Which two statements correctly differentiate functions and procedures?
Answer
  • A function can be called only as part of a SQL statement, whereas a procedure can be called only as a PL/SQL statement.
  • A function must return a value to the calling environment, whereas a procedure can return zero or more values to its calling environment.
  • A function can be called as part of a SQL statement or PL/SQL expression, whereas a procedure can be called only as a PL/SQL statement.
  • A function may return one or more values to the calling environment, whereas a procedure must return a single value to its calling environment.

Question 57

Question
View the Exhibits and examine the structure of the EMPLOYEES, DEPARTMENTS AND EMP_BY_DEPT tables. EMPLOYEES NAME NULL? TYPE EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4) DEPARTMENTS NAME NULL? TYPE DEPARTMENT_ID NOT NULL NUMBER(4) DEPARTMENT_NAME NOT NULL VARCHAR2(30) MANAGER_ID NUMBER(6) LOCATION_ID NUMBER(4) EMP_BY_DEPT NAME NULL? TYPE EMPLOYEE_ID NOT NULL NUMBER(6) DEPARTMENT_ID NOT NULL NUMBER(4) Examine the following code: What is the outcome on execution of the above code?
Answer
  • It executes successfully but the output statements show different values.
  • It executes successfully and both output statements show the same values.
  • It gives an error because the SQL%ROWCOUNT attribute cannot be used with BULK COLLECT.
  • It gives an error because the INSERT SELECT construct cannot be used with the FORALL

Question 58

Question
Which two statements are true about triggers?
Answer
  • All the triggers that are created on a table cannot be disabled simultaneously.
  • Any user who has the alter privilege on a table can create a trigger using that table.
  • Oracle provides a two-phase commit process whether a trigger updates tables in the local database or remote tables in a distributed database.
  • 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

Question 59

Question
Examine the following partial code: Which statement is correct about the unnamed block of code at the end of a package body?
Answer
  • It generates an error because all the blocks of code in a package body must be named.
  • It generates an error because V_TAXRATE is a public variable that is already initialized in the package specification.
  • It acts as a package initialization block that executes once, when the package is first invoked within the user session.
  • It acts as a package initialization block that executes each time a package subprogram is invoked within the user session and refreshes the initialized variable

Question 60

Question
Which two statements are true about the %ROWTYPE attribute?
Answer
  • It is used to declare a record that can hold multiple rows of a table.
  • The attributes of fields in the record with the %ROWTYPE attribute can be modified manually.
  • The attributes of fields in the record take their names and data types from the columns of the table, view, cursor, or cursor variable.
  • It ensures that the data types of the variables that are declared with the %ROWTYPE attribute change dynamically when the underlying table is altered.

Question 61

Question
You want to store values of different data types in a PL/SQL block and store one record at a time for processing the information. Which type of composite data type would you choose to fulfill the requirement?
Answer
  • VARRAYS
  • Nested table
  • PL/SQL records
  • Associative arrays

Question 62

Question
Which type of exceptions is qualified as nonpredefined Oracle server errors?
Answer
  • the exceptions that are explicitly raised by the program and can be caught by the exception handler
  • the exceptions that are raised implicitly by the Oracle server and can be caught by the exception handler
  • an exception that the developer determines as abnormal, are in the declarative section and raised explicitly
  • an exception that is raised automatically when the PL/SQL program violates a database rule or exceeds a system-dependent limit

Question 63

Question
View Exhibit 1 and examine the structure of the EMP table. NAME NULL? TYPE EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) View Exhibit 2 and examine the code of the packages that you have created. You issue the following command: SQL> DROP PACKAGE manage_emp; What is the outcome?
Answer
  • It drops both the MANAGE_EMP AND EMP__DET packages because of the cascading effect.
  • It drops the MANAGE_EMP package and invalidates only the body for the EMP_DET package.
  • It returns an error and does not drop the MAMAGE_EMP package because of the cascading effect.
  • It drops the MANAGE_EMP package and invalidates both the specification and body for the EMP_DET package.

Question 64

Question
Examine the following PL/SQL code: Which statement is true about the fetch statements in the PL/SQL code?
Answer
  • Each fetch retrieves the first row and assigns values to the target variables.
  • Each fetch retrieves the next consecutive row and assigns values to the target variables.
  • They produce an error because you must close and reopen the cursor before each fetch -statement.
  • Only the first fetch retrieves the first row and assigns values to the target variables- the second produces an error.

Question 65

Question
View Exhibit 1 and examine the structure of the employees table. NAME Null? Type EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4) View Exhibit 2 and examine the code. What is the outcome when the code is executed?
Answer
  • Both blocks compile and execute successfully when called.
  • Both blocks compile successfully but the CALC_SAL procedure gives an error on execution.
  • The CALC_SAL procedure gives an error on compilation because the amt variable should be declared in the RAISE_SALARY procedure.
  • The CALC_SAL procedure gives an error on compilation because the RAISE_SALARY procedure cannot call the stand-alone increase function.

Question 66

Question
Examine the following PL/SQL code: The server output is on for the session. Which statement is true about the execution of the code?
Answer
  • The code executes successfully and gives the desired output.
  • The code generates an error because the EMP_RECORD variable is not declared.
  • The code generates an error because the cursor is not opened before the FOR loop.
  • The code generates an error because the loop does not have the exit when clause.

Question 67

Question
View Exhibit 1 and examine the structure of the EMP and DEPT tables. EMP NAME NULL? TYPE EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) DEPT NAME NULL? TYPE DEPTNO NOT NULL NUMBER(2) DNAME VARCHAR2(14) LOC VARCHAR2(13) View Exhibit 2 and examine the trigger code that is defined on the DEPT table to enforce the update and delete restrict referential actions on the primary key of the DEPT table. What is the outcome on compilation?
Answer
  • It compiles and executes successfully.
  • It gives an error on compilation because it is not a row-level trigger.
  • It gives an error on compilation because the exception section is used in the trigger.
  • It compiles successfully but gives an error on execution because it is not a row-level trigger.

Question 68

Question
Which two statements are true about the PL/SQL initialization parameters?
Answer
  • To use native code compilation, PLSQL_OPTIMIZE_LEVEL should be set to a value less than or equal to 1.
  • The default value of 2 for PLSQL_OPTIMIZE_LEVEL allows the compiler to rearrange code for better performance.
  • Setting PLSQL_CODE_TYPE to native provides the greatest performance gains only for computation-intensive procedural operations
  • Changing the value of the PLSQL_CODE_TYPE parameter affects all the PL/SQL library units that have already been compiled.

Question 69

Question
Which two statements are true about anonymous blocks and named subprograms?
Answer
  • Subprograms are by default executed with definer's rights.
  • The declare section is optional for both anonymous blocks and subprograms.
  • Both anonymous blocks and subprograms execute by default with invoker's rights.
  • The declare section is mandatory for anonymous blocks and optional for subprograms.

Question 70

Question
View the Exhibit to examine the PL/SQL code. Which statement is true about the execution of the code?
Answer
  • The exception raised in the code is handled by the exception handler for the PAST_DUE exception.
  • It does not execute because you cannot declare an exception with a similar name in the subblock.
  • The PAST_DUE exception raised in the subblock causes the program to terminate abruptly because there is no exception handler in the subblock.
  • The PAST_DUE exception raised by the enclosing block is not propagated to the outer block and it is handled by the WHEN OTHERS exception handler

Question 71

Question
Examine the following partial declare section from a block of PL/SQL code Which line(s) in the above code are NOT valid? (Choose all that apply.)
Answer
  • line 2
  • line 3
  • line 4
  • line 5

Question 72

Question
Which two guidelines are recommended by Oracle to reduce invalidation of dependent objects?
Answer
  • Reference tables indirectly by using views.
  • Reference tables directly avoid using views.
  • When adding new items to a package, add them to the end of the package.
  • When adding new items to a package, add them to the beginning of the package.

Question 73

Question
View the Exhibit and examine the structure of the SALGRADE table. Name Null? Type GRADE NOT NULL NUMBER LOSAL NUMBER HISAL NUMBER Examine the following code: What is the outcome?
Answer
  • It is created successfully.
  • It gives an error because the return clause condition is invalid.
  • It gives an error because the usage of the host variables is invalid.
  • It gives an error because the data type of the return clause is invalid.

Question 74

Question
Examine the following code: The above code generates an error on execution. What must you do to ensure that the code executes successfully?
Answer
  • Use the TO_DATE function in line 2.
  • Use the TO_DATE function in line 7.
  • Use the TO_NUMBER function in line 6.
  • Use both the TO_DATE function in line 2 and the TO_NUMBER function in line 6.

Question 75

Question
Identify situations in which the DBMS_SQL package is the only applicable method of processing dynamic SQL.
Answer
  • When a query returns multiple rows
  • When a column name in a where clause is unknown at compile time
  • When the number of columns selected in a query is not known until run time
  • When a table needs to be created based on an existing table structure at run time
  • When privileges need to be granted to a new user to access an existing schema at run time

Question 76

Question
Examine the following block of code: Which two statements are correct about the code above?
Answer
  • The function goes through only the parse and executes phases.
  • The function goes through the parse, bind, and execute phases.
  • The function goes through the parse, bind, execute, and fetch phases.
  • All the processing phases for the function are performed only at run time.
  • Only the EXECUTE IMMEDIATE statement inside the function is parsed at run time.

Question 77

Question
Identify the scenario in which you would use the current of clause for an update or delete statement to rows fetched from a cursor.
Answer
  • when you want to lock the rows fetched by the cursor
  • when you want to update or delete the result set without affecting the rows in the table
  • when you want the database not to wait if the requested rows are locked by another user
  • when you want to ensure that the current rows fetched by the cursor are updated or deleted

Question 78

Question
Examine the following code: What is the outcome?
Answer
  • The procedure is created successfully and displays the values 20 and 30 when it is called.
  • The procedure gives errors because the parameters should be in out mode.
  • The procedure gives errors because the host variables cannot be referenced anywhere in the definition of a PL/SQL stored procedure.
  • The procedure is created successfully but does not display any values when it is called because the host variables cannot be displayed inside the procedure.

Question 79

Question
Examine the following PL/SQL code: The server output is on for the session. Which statement is true about the execution of the code?
Answer
  • It displays null if no employee with employee_id 123 exists.
  • It produces the ora-01403: no data found error if no employee with employee_id 123 exists.
  • It displays an error because the select * into clause cannot be used to populate the PL/SQL record type.
  • The code executes successfully even if no employee with employee_id 123 exists and displays Record Not Found.

Question 80

Question
Which statement is true about transactions in PL/SQL?
Answer
  • A transaction can span multiple blocks.
  • A block can contain only a single transaction.
  • SAVEPOINTS cannot be created in a PL/SQL block.
  • The END keyword signals the end of a PL/SQL block and automatically commits the transaction in the block.

Question 81

Question
Which statements are true about the WHEN OTHERS exception handler? (Choose all that apply.)
Answer
  • It can be the first exception handler.
  • It can be the only exception handler for the code.
  • It traps all the exceptions that are not already trapped.
  • You can have multiple OTHERS clauses to trap all the multiple unhandled exceptions.

Question 82

Question
View Exhibit 1 and examine the structure of the EMP table. NAME NULL? TYPE EMP_ID NUMBER(3) EMP_NAME VARCHAR2(10) SAL NUMBER(10,2) View Exhibit 2 and examine the PL/SQL block of code. What is the outcome?
Answer
  • It gives an error because the return type is not valid.
  • It gives an error because the record type is not defined within the function.
  • It gives an error because the function call in DBMS_OUTPUT. PUT__LINE is not valid.
  • It executes successfully and displays the names and salaries of all employees who earn the highest salary.
  • It executes successfully but does not display the names and salaries of all employees who earn the highest salary.

Question 83

Question
Examine the following package specification: Which statement is true?
Answer
  • g_comm has a value of 15 at 9: 06 AM only for Jones.
  • g_comm has a value of 10 at 9: 03 AM for both Jones and Smith.
  • g_comm has a value of 15 at 9: 03 AM for both Jones and Smith.
  • g_comm has a value of 20 at 9: 06 AM for both Jones and Smith.

Question 84

Question
You execute the following block of code: Which statement is true about the outcome?
Answer
  • Both Output statements show different values.
  • Both output statements show exactly the same values.
  • It gives an error because the nested blocks are not labeled.
  • It gives an error because the V_CUSTOMER variable have different types in the nested blocks.

Question 85

Question
Which three statements are true about wrapping?
Answer
  • The PL/SQL wrapper detects and reports only syntax errors.
  • The PL/SQL wrapper detects and reports both syntax and semantic errors.
  • When wrapping a package or object type, both the body and specification should be wrapped.
  • When wrapping a package or object type, only the body should be wrapped, not the specification.
  • To change a wrapped object, the original source code needs to be modified and then wrapped again.
  • To change a wrapped object, the wrapped code can be unwrapped, modified in a text file, and then wrapped again.

Question 86

Question
Which statements are true about database triggers? (Choose all that apply.)
Answer
  • They can invoke only PL/SQL procedures.
  • They can include SQL and PL/SQL or calls to Java procedures.
  • They are implicitly fired by an event that must occur within an application.
  • They are implicitly fired when a triggering event occurs, depending on which user is connected.

Question 87

Question
View the Exhibit and examine the code: Which statement is true about the COMPILE_CODE procedure?
Answer
  • It gives an error in line 6.
  • It gives an error in line 8.
  • It gives an error in line 5.
  • It executes successfully, but displays a warning about the unreachable code when used for the PROC1 procedure.
  • It executes successfully, but a warning about the unreachable code is not displayed when used for the PROC1 procedure.

Question 88

Question
You create a procedure to handle the processing of bank current accounts which rolls back payment transactions if the overdraft limit is exceeded. The procedure should return an "error" condition to the caller in a manner consistent with other Oracle server errors. Which construct should be used to handle this requirement?
Answer
  • The SQLERRM function
  • The PRAGMA EXCEPTION_INIT function
  • The RAISE_APPLICATION_ERROR procedure
  • A user-defined exception used with a raise statement

Question 89

Question
Examine the following DECLARE section of PL/SQL block: Which line in the above declaration would generate an error?
Answer
  • Line 2
  • Line 3
  • Line 4
  • Line 5
  • Line 6

Question 90

Question
Which statements correctly describe the features of functions and procedures? (Choose all that apply.)
Answer
  • A procedure can contain a return statement without a value.
  • A function can return multiple values using a single return clause.
  • A procedure can be executed as part of a SQL expression or as a PL/SQL statement.
  • A function can contain zero or more parameters that are transferred from the calling environment.

Question 91

Question
Examine the following PL/SQL code; The execution of the code produces errors. Identify the error in the code.
Answer
  • The open cursor is missing.
  • The fetch clause is missing.
  • The exit when condition is missing.
  • The EMP_NAME and EMP_JOB variables cannot be used in the for clause of the cursor FOR statement.

Question 92

Question
Examine the following PL/SQL code: Which statement is true about the execution of the PL/SQL code?
Answer
  • It executes successfully.
  • It generates a run-time exception.
  • It does not execute because of syntax error.
  • It executes successfully and generates a warning.

Question 93

Question
View the Exhibit and examine the package code created by SCOTT. The execute privilege on this package is granted to green. Examine the following sequence of commands issued by SCOTT: SET SERVEROUTPUT ON EXEC pkg1.init_pkg_state(5) EXEC pkg1.print_pkg_state GREEN logs in an issues the following commands: SET SERVEROUTPUT ON EXEC scott.pkg1.print_pkg_state What is the outcome?
Answer
  • SCOTT’S session displays 5, and then 0, green’s session displays 0.
  • SCOTT’S session displays 5, and then 0, green's session displays 5.
  • SCOTT’S session displays 5, and then 5, again, green's session displays 0.
  • SCOTT’S session displays 5, and then 5, again; green's session displays 5.

Question 94

Question
Which two statements are true about the exit statement encountered in loop?
Answer
  • The PL/SQL block execution terminates immediately after the exit statement.
  • The loop completes immediately and control passes to the statement after END LOOP.
  • The statements after the exit statement in the Iteration are not executed before terminating the LOOP.
  • The current iteration of the loop completes immediately and control passes to the next iteration of the loop.

Question 95

Question
Which two statements are true about database triggers?
Answer
  • Each trigger can be of any size.
  • Each trigger can be of a maximum size of 32 KB.
  • A trigger can contain a maximum of 32 lines of code.
  • Triggers fired by DML statements cannot cascade simultaneously.
  • Both DML and DDL statements can cascade any number of triggers.
  • Both data manipulation language (DML) and data definition language (DDL) statements can cascade up to 32 triggers

Question 96

Question
View the Exhibit to examine the PL/SQL code. The record for the employee with employee_id 100 in the employees table is as follows: EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL HIRE_DATE JOB_ID SALARY 100 Steven King SKING 17-JUN-87 AD_PRES 24000 Identify the correct output for the code.
Answer
  • King 17-JUN-87 1500
  • King 17-JUN-87 24000
  • King current sysdate 1500
  • King current sysdate 24000

Question 97

Question
View the Exhibit and examine the structure of the customer table. You need to create a trigger to ensure that customers in category "A" and "B" have a credit limit of more than 8000. Examine the following trigger. CREATE OR REPLACE TRIGGER verify_cust_category BEFORE INSERT ON customer BEGIN IF :NEW.cust_category IN ('A','B') AND :NEW.cust_credit_limit < 8000 THEN RAISE_APPLICATION_ERROR (-20202, 'Credit Limit cannot be less than 8000'); END IF; END; / Which statement is correct about the outcome of this trigger?
Answer
  • It compiles successfully and fires whenever the specified condition is met.
  • It compiles successfully but does not fire even when the condition is met.
  • It gives an error on compilation because the new qualifier is prefixed with a colon.
  • It gives an error on compilation because the new qualifier can be used only in row-level triggers.

Question 98

Question
View the Exhibit to examine the PL/SQL code. Which statement is true about the exception handlers in the PL/SQL code?
Answer
  • All the exceptions in the code are trapped by the exception handler.
  • All the "no data found" errors in the code are trapped by the exception handler.
  • The PL/SQL program does not execute because an exception is not declared in the declare section.
  • An exception handler in the code traps the "no data found" error after executing the handler code and the program flow returns to the next line of code.

Question 99

Question
View the Exhibit to examine the PL/SQL code. SERVEROUTPUT is on for the session. Which statement is true about the execution of the code?
Answer
  • The execution fails because of the misplaced else clause.
  • The execution is successful even if there is no employee with EMPLOYEE_ID 115.
  • The execution falls and throws exceptions if no employee with EMPLOYEE_ID us is found.
  • The execution is successful, but it displays an incorrect output if no employee with EMPLOYEE_ID 115 is found.

Question 100

Question
View the Exhibit and examine the structure of the AUDIT_CUST table. CREATE TABLE audit_cust ( user_name VARCHAR2(50), change_time DATE, cust_id NUMBER, old_credit_limit NUMBER, new_credit_limit NUMBER ); / CUST_ID and CUST_LIMIT are existing columns in the CUSTOMER table. Examine the following trigger code: Which statement is true about the above trigger?
Answer
  • It gives an error on compilation because it should be a statement-level trigger.
  • It compiles and fires successfully when the credit limit is updated in the customer table.
  • It gives an error on compilation because of the commit command in the trigger code.
  • It compiles successfully, but gives an error when the credit limit is updated in the CUSTOMER table because the PRAGMA AUTONOMOUS_TRANSACTION

Question 101

Question
Which three statements are true about anonymous blocks and subprograms?
Answer
  • Only subprograms can be parameterized.
  • Only subprograms are persistent database objects.
  • Both anonymous blocks and subprograms can be parameterized.
  • Both anonymous blocks and subprograms are persistent database objects.
  • Only subprograms can return values that persist after the execution of the subprogram.
  • Both anonymous blocks and subprograms can return values that persist in SQL*Plus variables after their execution.

Question 102

Question
View the exhibit and examine the structure of the EMPLOYEE table. EMPLOYEE_SEQ is an existing sequence. Examine the following block of code: Which statement is true about the above block of code?
Answer
  • It consists of two transactions
  • It consists of a single transaction.
  • The data is automatically committed after the block execution ends.
  • It gives an error on execution because sequences cannot be used in anonymous blocks.

Question 103

Question
View the Exhibit and examine the structure of the customer table. Name Null? Type CUST_ID NOT NULL NUMBER CUST_LAST_NAME NOT NULL VARCHAR2(40) CUST_CITY NOT NULL VARCHAR2(30) CUST_CREDIT_LIMIT NUMBER CUST_CATEGORY VARCHAR2(20) You create the following trigger to ensure that customers belonging to category "A" or "B" in the customer table can have a credit limit of more than 8000. What is the outcome?
Answer
  • The trigger is fired, a message is displayed, and the update is successful.
  • The trigger is fired and a message is displayed, but the update is rolled back.
  • The trigger is not fired because the when clause should be used to specify the condition, however, the update is successful.
  • The trigger is not fired because column names must be specified with the update event to identify which columns must be changed to cause the trigger to fire, however, the update is successful.

Question 104

Question
View the Exhibit and examine the partial data in the PRODUCTS table. PROD_ID is the primary key. PRODUCTS PROD_ID PROD_NAME PROD_LIST_PRICE 126 3 1/2" Bulk Diskettes, Box of 100 28.99 127 Model CD13272 Tricolor Ink Cartridge 36.99 128 Model SM6273 Black Ink Cartridge 27.99 129 Model NM500X High Yield Toner Cartridge 192.99 Examine the following code: What is the outcome on execution of the above code?
Answer
  • It executes successfully.
  • It gives an error because the DECODE function can be used only in a SQL statement.
  • It gives an error because the SUBSTR and INSTR functions can be used only in a SQL statement.
  • It gives an error because both the MAX and DECODE functions can be used only in a SQL statement.

Question 105

Question
View Exhibit 1 and examine the structure of the EMP table. NAME NULL? TYPE EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) View Exhibit 2 and examine the PL/SQL block of code. What is the outcome?
Answer
  • It gives an error because the return type is not valid.
  • It gives an error because the record type is not defined within the function.
  • It gives an error because the function call in DBMS_OUTPUT. PUT_LINE is not valid
  • It executes successfully and displays the names and salaries of all employees who earn the highest salary.
  • It executes successfully but does not display the names and salaries of all employees who earn the highest salary.

Question 106

Question
View the Exhibit and examine the structure of the EMP table. NAME NULL? TYPE EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) Examine the following block of code: Which stages are performed when the above block is executed? (Choose all that apply.)
Answer
  • Bind
  • Parse
  • Fetch
  • Execute

Question 107

Question
The STRING_TAB table has the following structure: NAME NULL? TYPE STRING1 VARCHAR2(100) View the Exhibit and examine the code. What is the outcome on execution?
Answer
  • It displays Output buffer not long enough. This is my test string.-.
  • It displays only Output buffer not long enough, and exits the anonymous block.
  • It displays only - Because EXCEPTION should have been defined in the anonymous block to get the error message. This is my test string.
  • It does not display any of the DBMS_OUTPUT messages and gives an error because a transaction control statement cannot be used in the exception section
Show full summary Hide full summary

Similar

Unit 1 - Electricity
Callum McClintock
Macbeth cards
gregory.rolfe
3. The Bolshevik's Seizure of Power
ShreyaDas
Cory & Manuel
Prudensiano Manu
Strength and Limitations of research methods
Isobel Wagner
Python Quiz
karljmurphy
Biology B1
Kelsey Phillips
Plant and animal cells
Tyra Peters
Biology B1
themomentisover
Animal Farm CONTEXT
Lydia Richards2113
Coastal Development and physical processess
Corey Meehan