Multiple Choice
What is the output of the following segment of code if 4 is input by the user when asked to enter a number?
int num;
int total = 0;
cout << "Enter a number from 1 to 10: ";
cin >> num;
switch (num)
{
case 1:
case 2: total = 5;
case 3: total = 10;
case 4: total = total + 3;
case 8: total = total + 6;
default: total = total + 4;
}
cout << total << endl;
A) 0
B) 3
C) 13
D) 28
E) None of these
Correct Answer:

Verified
Correct Answer:
Verified
Q2: In C++ the = operator indicates:<br>A)equality<br>B)assignment<br>C)subtraction<br>D)negation<br>E)None of
Q5: The following code correctly determines whether x
Q10: This operator is used in C++ to
Q20: When an if statement is placed within
Q21: What is the value of donuts
Q22: If you place a semicolon after the
Q26: What will the following program segment
Q28: The _ of a variable is limited
Q45: If the sub-expression on the left side
Q51: This operator takes an operand and reverses