a. int i = 0;
while(i <= 20);
{
i = i+5;
cout << i << " ";
}
The above loop is an infinite loop. - TRUE.
[ Since there is a semicolon after while statement, while (i<=20); is equivalent to while(i<=20) { }. Even if there is no body to execute, doesn't mean that the loop terminates. Instead it will simply loop repeatedly over the conditional infinitely.]
b. for(int i =5; i>=1 ; i++)
{cout << i << endl;
}
The above loop is an infinite loop. - TRUE [ i is initialised to 5. Everytime i is incremented by one and hence it always satisties the condition i>=1]
Get Answers For Free
Most questions answered within 1 hours.