Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q181: In nested exception handling, which block's exception handler takes precedence if both inner and outer blocks have exception handlers?
- A: Inner block's exception handler
- B: Outer block's exception handler
- C: Both handle the exception equally
- D: Neither handle the exception properly
View Answer
A
Q182: Which component is NOT part of a built-in exception in PL/SQL?
- A: Exception Name
- B: Exception Unique Number
- C: Exception Description
- D: Exception Variable
View Answer
D
Q183: What will be the output of the program if an `INSERT` statement violates a unique key constraint?
- A: Record not matched
- B: Unique Key Violated
- C: ORA-01422: exact fetch returns more than requested number of rows
- D: Invalid Number
View Answer
B
Q184: When handling exceptions in PL/SQL, which section contains the exception handling statements?
- A: Declare Section
- B: Begin Section
- C: Exception Section
- D: End Section
View Answer
C
Q185: In PL/SQL, what is the result of a `DUP_VAL_ON_INDEX` exception?
- A: The record already exists
- B: The SQL error code
- C: The error message associated with the exception
- D: The record was not found
View Answer
A
Q186: Which PL/SQL block structure is used to handle runtime errors?
- A: Declare-Exception
- B: Begin-Exception
- C: Begin-Exception-End
- D: Declare-Begin-End
View Answer
C
Q187: What type of exceptions are raised implicitly by the PL/SQL runtime system?
- A: User-defined exceptions
- B: Internal exceptions
- C: Predefined exceptions
- D: All of the above
View Answer
B
Q188: What does the `RAISE` statement do in PL/SQL?
- A: Declares an exception
- B: Triggers an exception defined by the user
- C: Handles an exception
- D: Ends the program execution
View Answer
B
Q189: What is the purpose of the `dbms_output.put_line` statement in exception handling examples?
- A: To terminate the program
- B: To display error messages
- C: To raise exceptions
- D: To execute SQL statements
View Answer
B
Q190: When multiple rows are returned by a `SELECT` statement without using a cursor, what exception is raised?
- A: ORA-01422: exact fetch returns more than requested number of rows
- B: Invalid Number
- C: Duplicate Value
- D: No Data Found
View Answer
A