with solutions 2025
When the condition is tested and the result is false, the loop body will be skipped and the first
statement after the while loop will be executed. - ANSWER True
Use the code shown below to answer the question below.
int id = 0;
cout << "ID: ";
cin >> id;
switch (id) {
case 1: cout << "Janet"; break;
case 2: cout << "Mark"; break;
case 3:
case 5: cout << "Jerry"; break;
default: cout << "Sue";
}
What will be displayed when the user enters the number 4?
Group of answer choices
Jerry
Janet
Sue
Mark - ANSWER Sue
Consider the following code snippet
int a,b,c,max;
,max=a;
if(max<b)
max=b;
if(max<c)
max=c;
cout<<"Max: "<< max;
What output do you think the code will produce if a is 10, b is 20, c is 30?
Group of answer choices
Max: 30
Max: 10
Max: max
Max: 20 - ANSWER Max: 30
What does the following code fragment write to the monitor?
int sum = 14;
if ( sum < 20 )
cout<<"Under ";
else
{
cout<<"Over ";
cout<<"the limit.";
}
Group of answer choices
Under
,Over the limit.
Over
Under the limit. - ANSWER Under
What does the following code fragment write to the monitor?
int sum = 14;
if ( sum < 20 )
cout<<"Under ";
else
cout<<"Over ";
cout<<"the limit.";
Under
Under the limit.
Over
Over the limit. - ANSWER Under the limit.
Consider the following code snippet
if (x<50)
if(x>=20 && x<40)
x+=25;
else
x-=25;
else
x++;
, What will be the final value of x if x=20?
Group of answer choices
65
15
45
30 - ANSWER 45
Consider the following switch statement:
int x = 4, y;
switch ( y % x ){
case 0: x += y;
case 1: cout<<"x = " << x;
break;
case 2: y -= x;
case 3: cout<<"y = " << y; break;
default: cout<<"No Match";
}
What is the output of this program if y = -2?
Group of answer choices
y = -2
No Match
-2
x = 4 - ANSWER No Match
What does the following code fragment write to the monitor?