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

1) What is the value of the beta variable after the following code executes? int

ID: 3570379 • Letter: 1

Question

1) What is the value of the beta variable after the following code executes?

            int beta = 5;

            switch(beta)

            {

            case 3:

                        beta += 3;

            case 5:

                        beta += 2;

case 1:

                        beta++;

       break;

            case 4:

                        beta += 4;

            }

2) What is the output from the following C++ code fragment if the following values are the inputs to cin?

            15 23 -10 37 -35

      int sum, num;

      cin >> sum;

      for(int j = 1; j <= 4; j++)

      {

            cin >> num;

            sum += num;

      }

      cout <<

Explanation / Answer

beta = 8

sum =30