OA. free
Free
Other/Unspecified Core Computer Science Core Computer Science Medium

What is the output of the program for the following input?

Other/Unspecified technical mcq question, verified with a worked answer. Free to practise - no sign-up.

int pop (void); /* pop the top of the stack */
void flagError ();

int main ()
{
    int c, m, n, r;
    while ((c = getchar ()) != EOF)
    {
        if (isdigit (c))
            push (c);
        else if ((c == '+') || (c == '*'))
        {
            m = pop ();
            n = pop ();
            r = (c == '+') ? n + m : n*m;
            push (r);
        }
        else if (c != '\n')
            flagError ();
    }
    printf("% c", pop ());
}

What is the output of the program for the following input?
52*33 2 + *

Choose one option.
Show answer & explanation
Answer: A. A) 15

Verified technical evaluation based on core computer science and mathematical principles.

Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.