Examlex

Solved

What Is the Output of the Following Segment of Code

question 24

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;


Definitions:

Feminism

A movement for advocating women's rights and equality between the genders.

Progressive Era

A period of widespread social activism and political reform across the United States, roughly from the 1890s to the 1920s, aiming to eliminate problems caused by industrialization, urbanization, immigration, and corruption in government.

1920s

The decade from 1920 to 1929, marked by significant social, economic, and cultural changes worldwide.

Changes

The process or act of making or becoming different.

Related Questions