Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q141: What will the following code calculate: `FOR i IN 1..10 LOOP IF MOD(i,2) = 0 THEN dbms_output.put_line('Even'); END IF;`?
- A: Odd values
- B: Even values
- C: All numbers from 1 to 10
- D: No output
View Answer
B
Q142: Which PL/SQL loop guarantees at least one iteration regardless of the condition?
- A: FOR loop
- B: WHILE loop
- C: DO-WHILE loop
- D: CASE loop
View Answer
C
Q143: How is a DO-WHILE loop implemented in PL/SQL?
- A: Using FOR loop
- B: Using WHILE loop
- C: Using CASE statement
- D: Using a simple loop with an exit condition
View Answer
D
Q144: What is the error in the following code: `FOR i IN 1..10 LOOP i := i + 1; END LOOP;`?
- A: Syntax error
- B: Loop never executes
- C: Incrementing the loop counter is not allowed
- D: Loop terminates prematurely
View Answer
C
Q145: What is the output of the following program: `FOR i IN 1..10 LOOP dbms_output.put_line('Value of i: ' || i); END LOOP;`?
- A: Error
- B: Loop terminates early
- C: Value of i from 1 to 10 is printed
- D: Nothing is printed
View Answer
C
Q146: Which of the following is true for a REVERSE FOR loop in PL/SQL?
- A: Iteration proceeds upwards
- B: Iteration proceeds downwards
- C: Exit condition is checked first
- D: Loop never executes
View Answer
B
Q147: What will happen if the start value is greater than the end value in a FOR loop?
- A: Loop will execute normally
- B: Loop will never start
- C: Program crashes
- D: Error in syntax
View Answer
B
Q148: What does the 'CONTINUE' statement do in a loop?
- A: Skips the current iteration
- B: Exits the loop completely
- C: Pauses the loop
- D: Starts a new loop iteration
View Answer
A
Q149: In the given code, what does 'CONTINUE' do when 'x < 3'?
- A: Skips the remaining code and continues to the next iteration
- B: Exits the loop immediately
- C: Pauses the loop for a moment
- D: Does nothing
View Answer
A
Q150: What is the output of the 'CONTINUE' statement with 'x < 3' in the provided example?
- A: Skips code after 'CONTINUE' and continues to the next iteration
- B: Terminates the loop completely
- C: Outputs 'x' value before the 'CONTINUE' statement
- D: Restarts the loop from the beginning
View Answer
A