Question
16 16 What is the output of the following code? int main() { int x = 5; while (x > 0) { cout < <
16
16
What is the output of the following code?
int main() {
int x = 5;
while (x > 0) {
cout << x << " ";
x = x - 1;
}
cout << "Go!";
return 0;
}
Select one:
a. 5 4 3 2 1 Go!
b. 4 3 2 1 0 Go!
c. 5 4 3 2 1 0 Go!
d. 5 5 4 3 2 1 Go! 17
What is the value assigned to variable z for the following code, assuming the initial values of a = 2, b = 2, and c = 30?
mult = 0;
while (a < 20) {
mult = b * a;
if (mult > c) break;
a = a + 1;
}
z = a;
Select one:
a. 16
b. 18
c. 30
d. 40
19
What is the output of the following code?
int main() {
string cityState = "Kansas City, Kansas.";
cout << cityState.find("City");
return 0;
}
Select one:
a. -1
b. 6
c. 7
d. 8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started