Which loop can potentially become an infinite loop if no increment/decrement operation is performed on the loop control variable?
- do-while loop
- for loop
- foreach loop
- while loop
A while loop can potentially become an infinite loop if no increment or decrement operation is performed on the loop control variable within the loop body. This happens when the loop condition always evaluates to true.
Loading...
Related Quiz
- When trying to conserve memory usage, which method of parameter passing might be most effective in certain situations?
- Where are inline functions expanded?
- In C++, _______ is used to restrict access to class members and maintain encapsulation.
- What will happen if the break statement is used outside any loop or switch statement?
- Imagine a function that performs file I/O and may throw an exception. What might be a concern if this function is used inside a constructor, and how might it be addressed?