- ATrue
- BFalse
- C Don't Know
- DError
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
Answer: C) A function that calls itself. A recursive function is a function that calls itself either directly or indirectly. It is useful for solving problems that can be broken down into smaller sub-problems that are identical or similar in nature to the original problem.
The break statement is used to exit the current loop.
Here is an example in Java to demonstrate its usage:
public class BreakStatementExample { public static void main(String[] args) { // Loop from 1 to 5 for (int i = 1; i <= 5; i++) { if (i == 3) { break; // Exit the loop when i is 3 } System.out.println("Iteration: " + i); } System.out.println("Loop exited."); } }
Output:
Iteration: 1 Iteration: 2 Loop exited.
In this example, the break statement exits the loop when i equals 3, so the loop stops executing and the program continues with the next statement after the loop.