Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q201: What is the output of the program if `due_date` is less than `todays_date` in the `Implementing User Defined Exception –III` example?
- A: Handling PAST_DUE exception in Global declaration.
- B: Could not recognize PAST_DUE_EXCEPTION in this scope.
- C: Valid Salary
- D: No Data Found
View Answer
A
Q202: Which section of the PL/SQL block cannot have User Defined Exceptions?
- A: Begin Section
- B: Declare Section
- C: Exception Section
- D: End Section
View Answer
A
Q203: What happens if an exception is not handled in the current block?
- A: The program ignores the exception
- B: The exception is raised again in the current block
- C: The exception is passed to the outer block for handling
- D: The program terminates immediately
View Answer
C
Q204: What does the `DBMS_OUTPUT.PUT_LINE` statement do in the provided examples?
- A: Displays messages or output during program execution
- B: Terminates the program
- C: Handles the exception
- D: Raises the exception
View Answer
A
Q205: What will the output be if `new_sal` is greater than or equal to `min_sal` in the `Implementing User Defined Exception –II` example?
- A: Salary is less than the defined minimum
- B: Valid Salary
- C: No Data Found
- D: Invalid Operation
View Answer
B
Q206: What is the correct way to handle multiple exceptions in a PL/SQL block?
- A: Using multiple `WHEN` clauses within the `EXCEPTION` section
- B: Using multiple `BEGIN` blocks
- C: Using multiple `DECLARE` sections
- D: Using nested `IF` statements
View Answer
A
Q207: What is the purpose of the `raise_application_error` procedure in PL/SQL?
- A: To issue user-defined ORA-error messages
- B: To handle exceptions automatically
- C: To log errors in a file
- D: To terminate the PL/SQL block
View Answer
A
Q208: What is the range of the error number that can be used with `raise_application_error`?
- A: -10000 to -10999
- B: -15000 to -15999
- C: -20000 to -20999
- D: -25000 to -25999
View Answer
C
Q209: Which statement is used to raise a user-defined exception with a custom error message?
- A: RAISE_APPLICATION_ERROR
- B: THROW_ERROR
- C: Raise
- D: EXCEPTION_INIT
View Answer
A
Q210: What is the syntax to use `raise_application_error` in PL/SQL?
- A: RAISE_APPLICATION_ERROR(error_number, message[, {TRUE | FALSE}])
- B: RAISE_APPLICATION_ERROR(message, error_number)
- C: RAISE_APPLICATION_ERROR(error_number, message)
- D: RAISE_APPLICATION_ERROR(message, error_number, {TRUE | FALSE})
View Answer
C