/Be careful!!!!! int num = 7; while (num < 10); { num++; } cout << num; Flag thi
ID: 3872129 • Letter: #
Question
/Be careful!!!!!
int num = 7;
while (num < 10);
{
num++;
}
cout << num;
Flag this Question
Question 2
Given the following code, what value will num have after the loop?:
int num = 10;
while (num < 12)
{
num+=2;
}
Flag this Question
Question 3
How many times will "Let us C" display?
int i = 0;
while (i <= 10)
{
cout << "Let us C" << endl;
i++;
}
Flag this Question
Question 4
Given this code, what will display?
int i = 0;
while (i == 10)
{
cout << "Let us C" << endl;
i++;
}
Explanation / Answer
Question 1 :
Answer : Displays 10
while loop exits when num = 10
Question 2 :
Answer : 12
while loop exits when num = 12 , because 12 < 12 fails
Question 3 :
Answer : 11
0 to 10 means 11 times
Question 4 :
Answer : It runs, but nothing displays
initally i = 0 , but in while condition will execute when i == 10 so condition fails and exit
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.