Oracle Database: Advanced PL/SQL — Question 55
Which is true about counter variables in a FOR loop?
Answer options
- A. It must explicitly be declared.
- B. It can be modified in the body of the loop.
- C. It cannot be NULL.
- D. It is accessible outside the body of the loop.
Correct answer: C
Explanation
The correct answer is C because counter variables in a FOR loop are typically initialized and assigned a definitive value, making them non-NULL. Option A is incorrect because not all programming languages require explicit declaration of counter variables. Option B is wrong since modifying the counter variable within the loop can lead to unintended consequences, and Option D is incorrect because the scope of the counter variable is usually limited to the loop's body.