Oracle Database Programming MCQs with Answers

Practice important Oracle Database Programming MCQs with answers and explanations.

Multiple Choice Questions

Q301: What does the `DBMS_OUTPUT.PUT_LINE` procedure do in a trigger?
  • A: It outputs the value of a variable to the database
  • B: It logs the result to a file
  • C: It prints messages to the console or log
  • D: It updates the database table
View Answer
C

Q302: When a trigger is disabled, what happens?
  • A: It is executed only when manually invoked
  • B: It is ignored and does not fire during DML operations
  • C: It logs an error message
  • D: It still runs but does not perform any actions
View Answer
B

Q303: How can you enable a trigger that has been disabled?
  • A: Use the `DROP TRIGGER` statement
  • B: Use the `CREATE TRIGGER` statement
  • C: Use the `ALTER TRIGGER` statement with `ENABLE`
  • D: Use the `ALTER TABLE` statement with `ENABLE`
View Answer
C

Q304: Which PL/SQL block creates a log entry every time the `emp` table is updated?
  • A: CREATE OR REPLACE TRIGGER Log_emp_update AFTER UPDATE ON emp BEGIN INSERT INTO Emp_log (Log_date, Action) VALUES (SYSDATE, 'Employee Table Updated'); END;
  • B: CREATE OR REPLACE TRIGGER Log_emp_update BEFORE UPDATE ON emp BEGIN INSERT INTO Emp_log (Log_date, Action) VALUES (SYSDATE, 'Employee Table Updated'); END;
  • C: CREATE OR REPLACE TRIGGER Log_emp_update AFTER INSERT OR UPDATE ON emp BEGIN INSERT INTO Emp_log (Log_date, Action) VALUES (SYSDATE, 'Employee Table Updated'); END;
  • D: CREATE OR REPLACE TRIGGER Log_emp_update BEFORE INSERT OR UPDATE ON emp BEGIN INSERT INTO Emp_log (Log_date, Action) VALUES (SYSDATE, 'Employee Table Updated'); END;
View Answer
A

Q305: What is a PL/SQL package?
  • A: A stored procedure
  • B: A database object that groups related database objects
  • C: A type of trigger
  • D: A view
View Answer
B

Q306: What is included in the Package Specification?
  • A: Implementation details of subprograms
  • B: Private declarations only
  • C: Definitions and public declarations
  • D: Exception handling routines
View Answer
C

Q307: Which part of a package contains the implementation details?
  • A: Package Specification
  • B: Package Body
  • C: Package Header
  • D: Package Interface
View Answer
B

Q308: What is the primary advantage of using a PL/SQL package?
  • A: Reducing database size
  • B: Increasing database performance by grouping logically related objects
  • C: Ensuring database security
  • D: Improving network connectivity
View Answer
B

Q309: Which part of the package declares types, variables, constants, exceptions, cursors, and subprograms available for use?
  • A: Package Specification
  • B: Package Body
  • C: Package Header
  • D: Package Implementation
View Answer
A

Q310: What is the correct syntax to create a package specification?
  • A: CREATE PACKAGE package_name AS [specification]; CREATE PACKAGE BODY package_name AS [implementation]; END package_name;
  • B: CREATE PACKAGE package_name AS [specification]; END package_name; CREATE PACKAGE BODY package_name AS [implementation]; END package_name;
  • C: CREATE PACKAGE package_name AS [specification]; CREATE PACKAGE BODY package_name AS [implementation]; END package_name;
  • D: CREATE PACKAGE BODY package_name AS [implementation]; END package_name; CREATE PACKAGE package_name AS [specification]; END package_name;
View Answer
C

Test Your Knowledge

Take a timed quiz on Oracle Database Programming

🚀 Start Quiz Now