Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q131: Which of the following causes abnormal termination of a simple loop in PL/SQL?
- A: Missing EXIT condition
- B: Incorrect syntax
- C: Declaring variables after the loop
- D: Not printing results
View Answer
A
Q132: What will the following code output after the loop completes: `if rep >=5 then EXIT; end if; rep:=rep+1;`?
- A: Value of Rep: 5
- B: ORA-10260 Error
- C: Program runs indefinitely
- D: The program doesn't terminate
View Answer
A
Q133: What is the output of a loop that inserts rows into the EMP table when the value of rep is less than 11?
- A: No rows inserted
- B: Only 1 row inserted
- C: 10 rows inserted
- D: Loop terminates early
View Answer
C
Q134: In a simple loop with an exit condition, what happens when the exit condition is FALSE?
- A: The loop continues executing
- B: The loop terminates
- C: The program crashes
- D: The loop skips execution
View Answer
A
Q135: What is the reverse value of the maximum salary, given the following code? (Output of the program is 117564)
- A: 461571
- B: 456711
- C: 465711
- D: 567141
View Answer
C
Q136: How does the reverse operation work in a loop with MOD and TRUNC functions?
- A: It calculates the square
- B: It extracts the last digit
- C: It finds the even number
- D: It reverses the string
View Answer
B
Q137: Which loop structure is used to display the reverse of a number in PL/SQL?
- A: FOR loop
- B: WHILE loop
- C: Simple loop
- D: IF loop
View Answer
C
Q138: What will the following code print: `WHILE done LOOP DBMS_OUTPUT.PUT_LINE ('Printed once'); done := FALSE; END LOOP;`?
- A: Printed twice
- B: Printed once
- C: Printed indefinitely
- D: Nothing
View Answer
B
Q139: Which of the following can cause a WHILE loop to terminate prematurely?
- A: Exit condition becomes TRUE
- B: Exit condition is missing
- C: Syntax error
- D: The loop counter reaches 10
View Answer
A
Q140: What is the output of the following code with a WHILE loop that inserts 10 rows into EMP table?
- A: Rows inserted successfully
- B: Transaction failed
- C: Only 5 rows inserted
- D: Loop terminated prematurely
View Answer
A