Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the printout of the following switch statement? char ch = \'b\'; switch

ID: 3692436 • Letter: W

Question

What is the printout of the following switch statement?

char ch = 'b';
switch (ch)
{
case 'a':
cout << ch << endl;
case 'b':
cout << ch << endl;
case 'c':
cout << ch << endl;
case 'd':
cout << ch << endl;
default:
cout<< "Error" << endl;
}

bb

b

bcd

bbb

abcd

What is the number of iterations in the following loop:
for (int i = 1; i < n; i++)
{
// iteration
}

2*n

n

n + 1

n - 1

How many times the following code prints "Welcome to C++"?
int count = 0;
while (count < 10)
{
cout << "Welcome to C++";
count++;
}

8

10

9

11

0

bb

b

bcd

bbb

abcd

What is the number of iterations in the following loop:
for (int i = 1; i < n; i++)
{
// iteration
}

2*n

n

n + 1

n - 1

How many times the following code prints "Welcome to C++"?
int count = 0;
while (count < 10)
{
cout << "Welcome to C++";
count++;
}

8

10

9

11

0

Explanation / Answer

The switch statement prints out b.

The number of iterations in the for loop is n.

The code prints "Welcome to C++" 10 times.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote