Skip to main content

Oracle Database Programming MCQs with Answers

Practice important Oracle Database Programming MCQs with answers and explanations.

Multiple Choice Questions

Q211: In the provided `Implementing Raise_application_error – I` example, what happens if `salary < 5000`?
  • A: An error message is raised using `raise_application_error`
  • B: `Valid Salary` is displayed
  • C: `Invalid Salary` is displayed
  • D: No output is displayed
View Answer
A

Q212: What will be the output if `v_ename` is NULL in the `Implementing User Defined Exception –II` example?
  • A: No name for empno
  • B: The employee is validated without errors
  • C: No data found for empno
  • D: The job field is missing
View Answer
A

Q213: What does the `EXCEPTION_INIT` pragma do?
  • A: It associates a user-defined exception with an Oracle error code
  • B: It handles runtime errors automatically
  • C: It logs exceptions in a file
  • D: It raises a built-in exception
View Answer
A

Q214: What is the syntax for using `EXCEPTION_INIT` pragma?
  • A: DECLARE exception_name EXCEPTION; PRAGMA EXCEPTION_INIT(exception_name, error_number); BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
  • B: DECLARE exception_name EXCEPTION; PRAGMA EXCEPTION_INIT(exception_name, error_number); BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
  • C: DECLARE exception_name EXCEPTION; PRAGMA EXCEPTION_INIT(exception_name, error_number); BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
  • D: DECLARE exception_name EXCEPTION; PRAGMA EXCEPTION_INIT(exception_name, error_number); BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
View Answer
A

Q215: In the `Implementing Exception_init Pragma –I` example, what is associated with the error code 100?
  • A: `FOUND_NOTHING` exception
  • B: `DEADLOCK_DETECTED` exception
  • C: `INVALID_SALARY` exception
  • D: `NO_DATA_FOUND` exception
View Answer
A

Q216: What will be displayed if a deadlock is detected in the `Implementing Exception_init Pragma –II` example?
  • A: Deadlock is detected
  • B: ORA-00060: deadlock detected
  • C: An error message from `dbms_output`
  • D: No data is found
View Answer
A

Q217: What is the output of the `Implementing Raise_application_error – I` example if `salary` is not less than `5000`?
  • A: Valid Salary
  • B: InValid Salary
  • C: No data found
  • D: Error message is raised
View Answer
B

Q218: Which section of the PL/SQL block contains the `RAISE_APPLICATION_ERROR` statement?
  • A: Begin Section
  • B: Declare Section
  • C: Exception Section
  • D: End Section
View Answer
A

Q219: What will happen if you use `RAISE_APPLICATION_ERROR` with an error number outside the range -20000 to -20999?
  • A: The PL/SQL block will terminate immediately
  • B: A custom error message will be displayed
  • C: The PL/SQL block will continue execution
  • D: An error message will be displayed indicating an invalid error number
View Answer
B

Q220: What type of exceptions can `EXCEPTION_INIT` pragma be used to handle?
  • A: Only Oracle predefined exceptions
  • B: Only user-defined exceptions
  • C: Oracle predefined exceptions with custom messages
  • D: Only runtime exceptions
View Answer
C

Test Your Knowledge

Take a timed quiz on Oracle Database Programming

🚀 Start Quiz Now