1. Which two among the following programming constructs can be grouped within a package?

Answers:

  1. Cursor
  2. Constant
  3. Trigger
  4. Sequence
  5. View

2. Which two statements, among the following, describe the state of a package variable after executing the package in which it is declared?

Answers:

  1. It persists across transactions within a session
  2. It persists from session to session for the same user
  3. It does not persist across transaction within a session
  4. It persists from user to user when the package is invoked
  5. It does not persist from session to session for the same user

3. Which of the following is not a legal declaration?

Answers:

  1. declare v number(4);
  2. declare x,y varchar2(10);
  3. declare birthdate date not null;
  4. declare Sex boolean:=1;

4. The oracle server implicitly opens a cursor to process:

Answers:

  1. A Sql select statement
  2. A PL/SQL Select statement
  3. DML Statements
  4. DDL Statements

5. Which two statements out of the following regarding packages are true?

Answers:

  1. Both the specification and body are required components of a package
  2. The package specification is optional, but the package body is required
  3. The package specification is required, but the package body is optional
  4. The specification and body of the package are stored separately in the database

6. Examine the following trigger:

CREATE OR REPLACE TRIGGER Emp_count
AFTER DELETE ON Employee
FOR EACH ROW
DECLARE
n INTEGER;
BEGIN
SELECT COUNT(*) INTO n FROM employee;
DMBS_OUTPUT.PUT_LINE( ‘There are now’ || n || ’employees’);
END;

This trigger results in an error after this SQL statement is entered: DELETE FROM Employee WHERE Empno = 7499;
How should the error be corrected?

Answers:

  1. Change the trigger type to a BEFORE DELETE
  2. Take out the COUNT function because it is not allowed in a trigger
  3. Remove the DBMS_OUTPUT statement because it is not allowed in a trigger
  4. Change the trigger to a statement-level trigger by removing FOR EACH ROW

7. Which Section deals with handling of errors that arise during execution of the data manipulation statements, which makeup the PL/SQL Block?

Answers:

  1. Declare
  2. Exception
  3. Begin
  4. End

8. Which of the following statements is true?

Answers:

  1. Stored functions can be called from the SELECT and WHERE clauses only
  2. Stored functions do not permit calculations that involve database links in a distributed environment
  3. Stored functions cannot manipulate new types of data, such as longitude and latitude
  4. Stored functions can increase the efficiency of queries by performing functions in the query rather than in the application

9. Examine the following code:
CREATE OR REPLACE FUNCTION gen_email (first_name VARCHAR2, last_name VARCHAR2,
id NUMBER)
RETURN VARCHAR2 IS
email_name VARCHAR2(19);
BEGIN
email_name := SUBSTR(first_name, 1, 1) ||
SUBSTR(last_name, 1, 7) ||.@Oracle.com .;
UPDATE employees SET email = email_name
WHERE employee_id = id;
RETURN email_name;
END;
Which of the following statements removes the function?

Answers:

  1. DROP gen_email;
  2. REMOVE gen_email;
  3. DELETE gen_email;
  4. DROP FUNCTION gen_email;

10. A table has to be dropped from within a stored procedure. How can this be implemented?

Answers:

  1. A table cannot be dropped from a stored procedure
  2. Use the DROP command in the procedure to drop the table
  3. Use the DBMS_DDL packaged routines in the procedure to drop the table
  4. Use the DBMS_DROP packaged routines in the procedure to drop the table.

11. In Pl/Sql, if the where clause evaluates to a set of data, which lock is used?

Answers:

  1. Row Level Lock
  2. Page Level lock
  3. Column Level lock
  4. Exclusive Lock

12. If user defined error condition exists,Which of the following statements made a call to that exception?

Answers:

  1. Trap
  2. Raise
  3. call
  4. call Exception

13. Which of the following are identified by the “INSTEAD OF” clause in a trigger?

Answers:

  1. The view associated with the trigger
  2. The table associated with the trigger
  3. The event associated with the trigger
  4. The package associated with the trigger
  5. The statement level or for each row association to the trigger

14. What type of trigger is created on the EMP table that monitors every row that is changed, and places this information into the AUDIT_TABLE?

Answers:

  1. FOR EACH ROW trigger on the EMP table
  2. Statement-level trigger on the EMP table
  3. FOR EACH ROW trigger on the AUDIT_TABLE table
  4. Statement-level trigger on the AUDIT_TABLE table

15. CREATE OR REPLACE PACKAGE manage_emp IS
tax_rate CONSTANT NUMBER(5,2) := .28;
v_id NUMBER;
PROCEDURE insert_emp (p_deptno NUMBER, p_sal NUMBER);
PROCEDURE delete_emp;
PROCEDURE update_emp;
FUNCTION cal_tax (p_sal NUMBER) RETURN NUMBER;
END manage_emp;
/
CREATE OR REPLACE PACKAGE BODY manage_emp IS

PROCEDURE update_sal (p_raise_amt NUMBER) IS
BEGIN
UPDATE emp SET sal = (sal * p_raise_emt) + sal
WHERE empno = v_id;
END;

PROCEDURE insert_emp (p_deptno NUMBER, p_sal NUMBER) IS
BEGIN
INSERT INTO emp(empno, deptno, sal) VALUES
(v_id, p_depntno, p_sal);
END insert_emp;

PROCEDURE delete_emp IS
BEGIN
DELETE FROM emp WHERE empno = v_id;
END delete_emp;

PROCEDURE update_emp IS
v_sal NUMBER(10,2);
v_raise NUMBER(10, 2);
BEGIN
SELECT sal INTO v_sal FROM emp WHERE empno = v_id;
IF v_sal < 500 THEN v_raise := .05;
ELSIP v_sal < 1000 THEN v_raise := .07;
ELSE v_raise := .04;
END IF;
update_sal(v_raise);
END update_emp;

FUNCTION cal_tax (p_sal NUMBER)RETURN NUMBER IS
BEGIN
RETURN p_sal * tax_rate;
END cal_tax;
END manage_emp;
/
What is the name of the private procedure in this package?

Answers:

  1. CAL_TAX
  2. INSERT_EMP
  3. UPDATE_SAL
  4. DELETE_EMP
  5. UPDATE_EMP

16. Which procedure is called after a row has been fetched to transfer the value, from the select list of the cursor into a local variable?

Answers:

  1. Row_value
  2. Column_value
  3. Raise_application
  4. Exception_init

17. An internal LOB is _____.

Answers:

  1. A table
  2. A column that is a primary key
  3. Stored in the database
  4. A file stored outside of the database, with an internal pointer to it from a database column.

18. What is the maximum number of handlers processed before the PL/SQL block is exited, when an exception occurs?

Answers:

  1. Only one
  2. All that apply
  3. All referenced
  4. None

19. The technique employed by the Oracle engine to protect table data, when several people are accessing it is called:

Answers:

  1. Concurrency Control
  2. Program Control
  3. PL/SQL Control
  4. Locking

20. Which table should be queried to determine when the procedure was last compiled?

Answers:

  1. USER_PROCEDURES
  2. USER_PROCS
  3. USER_OBJECTS
  4. USER_PLSQL_UNITS

21. Which cursor dynamically allows passing values to a cursor while opening another cursor?

Answers:

  1. Implicit Cursor
  2. User Defined Cursor
  3. Parameterized Cursor
  4. Explicit Cursor

22. When the procedure or function is invoked, the Oracle engine loads the compiled procedure or function in the memory area called:

Answers:

  1. PGA
  2. SGA
  3. Redo Log Buffer
  4. Data base buffer cache

23. Which precomplied word is called, which when encountered, immediately binds the numbered exception handler to a name?

Answers:

  1. Pragma
  2. Raise
  3. Trap
  4. Exception_init

24. What happens during the execute phase with dynamic SQL for INSERT, UPDATE, and DELETE operations?

Answers:

  1. The validity of the SQL statement is established
  2. An area of memory is established to process the SQL statement
  3. The SQL statement is run and the number of rows processed is returned
  4. The area of memory established to process the SQL statement is released

25. Examine the following package specification:
CREATE OR REPLACE PACKAGE combine_all
IS
v_string VARCHAR2(100);
PROCEDURE combine (p_num_val NUMBER);
PROCEDURE combine (p_date_val DATE);
PROCEDURE combine (p_char_val VARCHAR2, p_num_val NUMBER);
END combine_all;
/
Which overloaded COMBINE procedure declaration can be added to this package specification?

Answers:

  1. PROCEDURE combine;
  2. PROCEDURE combine (p_no NUMBER);
  3. PROCEDURE combine (p_val_1 VARCHAR2, p_val_2 NUMBER);
  4. PROCEDURE combine_all(p_num_val VARCHAR2, p_char_val NUMBER);

26. Which part of a database trigger determines the number of times the trigger body executes?

Answers:

  1. Trigger type
  2. Trigger body
  3. Trigger event
  4. Trigger timing

27. Which table should be queried to check the status of a function?

Answers:

  1. USER_PROCS
  2. USER_OBJECTS
  3. USER_PROCEDURES
  4. USER_PLSQL_UNITS

28. Which of the following statements is true regarding stored procedures?

Answers:

  1. A stored procedure uses the DECLARE keyword in the procedure specification to declare formal parameters
  2. A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification
  3. A stored procedure must have at least one executable statement in the procedure body
  4. A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters

29. Examine the following code:
CREATE OR REPLACE TRIGGER secure_emp
BEFORE LOGON ON employees
BEGIN
IF (TO_CHAR(SYSDATE, ‘DY’) IN (‘SAT’, ‘SUN’)) OR
(TO_CHAR(SYSDATE, ‘HH24:MI’)
NOT BETWEEN ’08:00′ AND ’18:00′)
THEN RAISE_APPLICATION_ERROR (-20500, ‘You may
insert into the EMPLOYEES table only during
business hours.’);
END IF;
END;
/
What type of trigger is it?

Answers:

  1. DML trigger
  2. INSTEAD OF trigger
  3. Application trigger
  4. This is an invalid trigger

30. Which code is stored in the database when a procedure or function is created in SQL*PLUS?

Answers:

  1. Only P-CODE
  2. Only SOURCE code
  3. Both SOURCE CODE and P-CODE
  4. Neither SOURCE CODE or P-CODE

31. Evaluate the following PL/SQL block:
DECLARE
v_low NUMBER:=2;
v_upp NUMBER:=100;
v_count NUMBER:=1;
BEGIN
FOR i IN v_low..v_low LOOP
INSERT INTO test(results)
VALUES (v_count)
v_count:=v_count+1;
END LOOP;
END;
How many times will the executable statements inside the FOR LOOP execute?

Answers:

  1. 0
  2. 1
  3. 2
  4. 98
  5. 100

32. What can be done with the DBMS_LOB package?

Answers:

  1. Use the DBMS_LOB.WRITE procedure to write data to a BFILE
  2. Use the DBMS_LOB.BFILENAME function to locate an external BFILE
  3. Use the DBMS_LOB.FILEEXISTS function to find the location of a BFILE
  4. Use the DBMS_LOB.FILECLOSE procedure to close the file being accessed

33. Examine the following code:
CREATE OR REPLACE TRIGGER UPD_SALARY
FOR EACH ROW
BEGIN
UPDATE TEAM
SET SALARY=SALARY+:NEW.SALARY
WHERE ID=:NEW.TEAM_ID
END;
Which statement must be added to make this trigger executable after updating the SALARY column of the PLAYER table?

Answers:

  1. AFTER UPDATE ON PLAYER
  2. AFTER SALARY UPDATE OF PLAYER
  3. AFTER UPDATE(SALARY) ON PLAYER
  4. AFTER UPDATE OF SALARY ON PLAYER

34. How can migration be done from a LONG to a LOB data type for a column?

Answers:

  1. Use the DBMS_MANAGE_LOB.MIGRATE procedure
  2. Use the UTL_MANAGE_LOB.MIGRATE procedure
  3. Use the DBMS_LOB.MIGRATE procedure
  4. You cannot migrate from a LONG to a LOB data type for a column
  5. Using ALTER TABLE statement

35. Examine the following code:

CREATE OR REPLACE PACKAGE comm_package IS
g_comm NUMBER := 10;
PROCEDURE reset_comm(p_comm IN NUMBER);
END comm_package;

User MILLER executes the following code at 9:01am:
EXECUTE comm_package.g_comm := 15

User Smith executes the following code at 9:05am:
EXECUTE comm_package.g_comm := 20

Which of the following statement is true?

Answers:

  1. g_comm has a value of 15 at 9:06am for Smith
  2. g_comm has a value of 15 at 9:06am for Miller
  3. g_comm has a value of 20 at 9:06am for both Miller and Smith
  4. g_comm has a value of 15 at 9:03 am for both Miller and Smith

36. The CHECK_SAL procedure calls the UPD_SAL procedure. Both procedures are INVALID.Which command can be issued to recompile both procedures?

Answers:

  1. COMPILE PROCEDURE CHECK_SAL;
  2. COMPILE PROCEDURE UPD_SAL;
  3. ALTER PROCEDURE CHECK_SAL compile
  4. ALTER PROCEDURE UPD_sAL compile

37. Examine the following procedure:
PROCEDURE emp_salary
(v_bonus BOOLEAN,
V_raise BOOLEAN,
V_issue_check in out BOOEAN)
is
BEGIN
v_issue_check:=v_bonus or v_raise;
END;
If v_bonus=TRUE and v_raise=NULL,which value is assigned to v_issue_check?

Answers:

  1. TRUE
  2. FALSE
  3. NULL
  4. none

38. Which package construct must be declared and defined within the packages body?

Answers:

  1. Exception
  2. Boolean Variable
  3. Public Procedure
  4. Private Procedure

39. What happens when rows are found using a FETCH statement?

Answers:

  1. The cursor opens
  2. The cursor closes
  3. The current row values are loaded into variables
  4. Variables are created to hold the current row values

40. Evaluate the following PL/SQL block:
DECLARE
result BOOLEAN;
BEGIN
DELETE FROM EMPloyee
WHERE dept_id IN (10,40,50);
result:=SQL%ISOPEN;
COMMIT:
END;

What will be the value of RESULT if three rows are deleted?

Answers:

  1. 0
  2. 3
  3. TRUE
  4. NULL
  5. FALSE

41. Which two statements among the following, regarding oracle database 10g PL/SQL support for LOB migration, are true?

Answers:

  1. Standard package functions accept LOBs as parameters
  2. Standard package function do not accept LOBs as parameters
  3. Implicit data conversion is supported for converting LOB to RAW
  4. Implicit data conversion is not supported for converting varchar to LOB

42. Which command is used to disable all triggers on the EMPLOYEES table?

Answers:

  1. Multiple triggers on a table in one command cannot be disabled
  2. ALTER TRIGGERS ON TABLE employees DISABLE;
  3. ALTER employees DISABLE ALL TRIGGERS;
  4. ALTER TABLE employees DISABLE ALL TRIGGERS;

43. Which table and column can be queried to see all procedures and functions that have been marked invalid?

Answers:

  1. USER_ERRORS table,STATUS column
  2. USER_OBJECTS table,STATUS column
  3. USER_ERRORS table,INVALID column
  4. USER_OBJECTS table,INVALID column

44. SQL%ISOPEN always evaluates to false in case of a/an:

Answers:

  1. Explicit Cursor
  2. Implicit Cursor
  3. Paramertized Cursor
  4. Cursor with Arguments

45. Which datatype does the cursor attribute ‘%ISOPEN’ return?

Answers:

  1. BOOLEAN
  2. INTEGER
  3. NUMBER
  4. VARCHAR2

46. Which of the following is a benefit of using procedures and functions?

Answers:

  1. Procedures and Function increases the number of calls to the database
  2. Procedures and Function are reparsed for multiple users by exploiting shared SQL area
  3. Procedures and Function avoid reparsing for multiple users by exploiting shared SQL areas
  4. Testing of procedures and functions requires the database to be restarted, to clear out shared SQL areas and future access

47. All packages can be recompiled by using an Oracle utility called:

Answers:

  1. Dbms_Output
  2. Dbms_Lob
  3. Dbms_utility
  4. Dbms_Error

48. Which type of variable should be used to assign the value TRUE, FALSE?

Answers:

  1. Constant
  2. Scalar
  3. Reference
  4. Composite

49. In which type of trigger can the OLD and NEW qualifiers can be used?

Answers:

  1. Row level DML trigger
  2. Row level system trigger
  3. Statement level DML trigger
  4. Row level application trigger

50. Examine the following code:
CREATE OR REPLACE TRIGGER update_emp
AFTER UPDATE ON emp
BEGIN
INSERT INTO audit_table (who, dated) VALUES (USER, SYSDATE);
END;
/
An UPDATE command is issued in the EMP table that results in changing 10 rows
How many rows are inserted into the AUDIT_TABLE ?

Answers:

  1. 1
  2. 10
  3. None
  4. A value equal to the number of rows in the EMP table

1,993 total views, 5 views today