Oracle PL/SQL Programming and Database Administration

Test your knowledge of Oracle PL/SQL programming, database triggers, stored procedures, and database administration concepts. Includes questions on PL/SQL blocks, exceptions, indexes, and database constraints.

20 Questions Published

Questions

Question 1 True/False

Script component Can have only one Input flow and zero or more Output flows.

  1. True
  2. False
Question 2 True/False

Object is Valid Data type of SSIS Variable.

  1. True
  2. False
Question 3 Multiple Choice (Single Answer)

You created stored procedure DELETE_TEMP_TABLE that uses dynamic SQL to remove a table in your schema. You have granted the EXECUTE privilege to user A on this procedure. When user A executes the DELETE_TEMP_TABLE procedure, under whose privileges are the operations performed by default?

  1. SYS privileges
  2. Your privileges
  3. Public privileges
  4. User A’s privileges
Question 4 Multiple Choice (Single Answer)

Which code can you use to ensure that the salary is not increased by more than 10% at a time nor is it ever decreased?

  1. ALTER TABLE emp ADD CONSTRAINT ck_sal CHECK (sal BETWEEN sal AND sal*1.1);
  2. CREATE OR REPLACE TRIGGER check_sal BEFORE UPDATE OF sal ON emp - 6 - FOR EACH ROW WHEN (new.sal < old.sal OR new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( - 20508, ‘Do not decrease salary not increase by more than 10%’); END;
  3. CREATE OR REPLACE TRIGGER check_sal BEFORE UPDATE OF sal ON emp WHEN (new.sal < old.sal OR new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( - 20508, ‘Do not decrease salary not increase by more than 10%’); END;
  4. CREATE OR REPLACE TRIGGER check_sal AFTER UPDATE OR sal ON emp WHEN (new.sal < old.sal OR -new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( - 20508, ‘Do not decrease salary not increase by more than 10%’); END;
Question 5 Multiple Choice (Single Answer)

Examine the code and state which of the following options is correct? CREATE OR REPLACE PACKAGE bonus IS g_max_bonus NUMBER := .99; FUNCTION calc_bonus (p_emp_id NUMBER) RETURN NUMBER; FUNCTION calc_salary (p_emp_id NUMBER) RETURN NUMBER; END; / CREATE OR REPLACE PACKAGE BODY bonus IS v_salary employees.salary%TYPE; v_bonus employees.commission_pct%TYPE; FUNCTION calc_bonus (p_emp_id NUMBER) RETURN NUMBER - 7 - IS BEGIN SELECT salary, commission_pct INTO v_salary, v_bonus FROM employees WHERE employee_id = p_emp_id; RETURN v_bonus * v_salary; END calc_bonus FUNCTION calc_salary (p_emp_id NUMBER) RETURN NUMBER IS BEGIN SELECT salary, commission_pct INTO v_salary, v_bonus FROM employees WHERE employees RETURN v_bonus * v_salary + v_salary; END cacl_salary; END

  1. You can call the BONUS.CALC_SALARY packaged function from an INSERT command against the EMPLOYEES table.
  2. You can call the BONUS.CALC_SALARY packaged function from a SELECT command against the EMPLOYEES table.
  3. You can call the BONUS.CALC_SALARY packaged function form a DELETE command against the EMPLOYEES table.
  4. You can call the BONUS.CALC_SALARY packaged function from an UPDATE command against the EMPLOYEES table.
Question 6 Multiple Choice (Single Answer)

Which statement is valid when removing procedures?

  1. Use a drop procedure statement to drop a standalone procedure.
  2. Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package specification.
  3. Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package body.
  4. For faster removal and re-creation, do not use a drop procedure statement. Instead, recompile the procedure using the alter procedure statement with the REUSE SETTINGS clause.
Question 7 Multiple Choice (Single Answer)

You need to create a trigger on the EMP table that monitors every row that is changed and places this information into the AUDIT_TABLE. What type of trigger do you create?

  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
Question 8 Multiple Choice (Single Answer)

Which of the following do not help you execute multiple PL/SQL programs simultaneously?

  1. Oracle Advanced Queuing
  2. DBMS_JOB
  3. DBMS_SQL
  4. Pipelined Functions
Question 9 Multiple Choice (Single Answer)

In a PL/SQL block, a variable is declared as NUMBER without an initial value. What will its value be when it is first used in the executable section of the PL/SQL block?

  1. NULL
  2. 0
  3. Results in a compilation error
  4. An exception will be raised
Question 10 Multiple Choice (Single Answer)

Which of the following queries return the names of programs (without duplication) defined in the currently-connected schema whose source contains a call to DBMS_OUTPUT.PUT_LINE (assume that this program name does not appear inside comments)?

  1. SELECT name FROM USER_DEPENDENCIES WHERE referenced_name = 'DBMS_OUTPUT.PUT_LINE'
  2. SELECT name from ALL_SOURCE WHERE owner = USER AND name = 'DBMS_OUTPUT.PUT_LINE'
  3. SELECT DISTINCT name from ALL_SOURCE WHERE INSTR (text, 'DBMS_OUTPUT.PUT_LINE') > 0
  4. SELECT DISTINCT name from USER_SOURCE WHERE INSTR (UPPER (text), 'DBMS_OUTPUT.PUT_LINE') > 0
Question 11 Multiple Choice (Multiple Answers)

PL/SQL raises an exception, in which TWO of the following cases:

  1. When a SELECT statement returns no rows
  2. When a SELECT statement returns more than one row
  3. When the datatypes of SELECT clause and INTO clause do not match
  4. When INTO statement is missing in the SELECT statement
Question 12 Multiple Choice (Single Answer)

What is the result if two NULL values are compared to each other?

  1. TRUE
  2. FALSE
  3. UNDEFINED
  4. NULL
Question 13 Multiple Choice (Multiple Answers)

Functions for error trapping are contained in which section of a PL/SQL block?

  1. Header
  2. Declarative
  3. Executable
  4. Exception
Question 14 Multiple Choice (Single Answer)

What is the smallest possible PL/SQL block?

  1. Begin null; end;
  2. Declare x varchar2(100); begin dbms_output.put_line(x); end;
  3. Begin .. statement1; exception ... end;
  4. Begin dbms_output.put_line(sysdate); end;;
Question 15 Multiple Choice (Single Answer)

Maximum no of non clustered index in a table.

  1. 192
  2. 255
  3. 249
  4. 300
Question 16 Multiple Choice (Single Answer)

Maximum no of columns in a key.

  1. 1
  2. 31
  3. 16
  4. 255
Question 17 Multiple Choice (Single Answer)

maximum number of segments for any database

  1. 8
  2. 1
  3. 31
  4. 32
Question 18 Multiple Choice (Single Answer)

The maximum allowable size of the combined index values

  1. 255
  2. 600
  3. 256
  4. 32
Question 19 Multiple Choice (Single Answer)

maximum length for comments

  1. there is no limit
  2. 16843
  3. 255
  4. 1024
Question 20 Multiple Choice (Single Answer)

maximum of triggers in sybase

  1. 3
  2. 12
  3. 6
  4. 9