Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q191: What should be done if the `NO_DATA_FOUND` exception occurs during a `SELECT` operation?
- A: Display a custom message
- B: Ignore the exception
- C: Terminate the program
- D: Retry the operation
View Answer
A
Q192: What is a User Defined Exception in PL/SQL?
- A: A default exception automatically provided by PL/SQL
- B: A built-in exception predefined by the system
- C: A custom exception defined by the user
- D: A standard exception for all applications
View Answer
C
Q193: Where must a User Defined Exception be declared in a PL/SQL block?
- A: Begin Section
- B: Declare Section
- C: Exception Section
- D: End Section
View Answer
B
Q194: What is the syntax to declare a User Defined Exception?
- A: DECLARE exception_name EXCEPTION; BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
- B: DECLARE exception_name EXCEPTION; BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
- C: DECLARE exception_name EXCEPTION; BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
- D: DECLARE exception_name EXCEPTION; BEGIN statements; EXCEPTION WHEN exception_name THEN action; END;
View Answer
B
Q195: Which statement is used to raise a User Defined Exception?
- A: THEN
- B: Raise
- C: EXCEPTION
- D: IF
View Answer
B
Q196: In which section of the PL/SQL block are User Defined Exceptions handled?
- A: Declare Section
- B: Begin Section
- C: Exception Section
- D: End Section
View Answer
C
Q197: What is the output if the `salary` is less than `5000` in the given PL/SQL block?
- A: Valid Salary
- B: InValid Salary
- C: No Data Found
- D: Unique Key Violated
View Answer
B
Q198: What happens if an exception is raised in an inner block but not handled there?
- A: The program terminates immediately
- B: The outer block handles the exception
- C: The exception is ignored
- D: The program continues without handling the exception
View Answer
B
Q199: What will be displayed if a salary is less than the minimum salary 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
A
Q200: In the provided `Implementing User Defined Exception –III` example, where is the `past_due` exception declared?
- A: Only in the inner block
- B: Only in the outer block
- C: In both inner and outer blocks
- D: Nowhere, it’s not declared properly
View Answer
B