OA. free
Free
Palo Alto Networks Core Computer Science Core Computer Science Medium

Select any one of the following

Palo Alto Networks technical mcq question, verified with a worked answer. Free to practise - no sign-up.

int main(void) {
    int i;
    for(i=10;i<15;i++)
    {
        while(i)
        {do{
            printf("%d",i);
            if(i>1) continue;
        }while(0);
        break;
        }}
    return 0;
}

Select any one of the following

Choose one option.
Show answer & explanation
Answer: C. 11111

The loop runs for 5 iterations (i = 10, 11, 12, 13, 14), each printing '1' once before the break statement terminates the inner while loop, producing '11111'.

Step-by-step Derivation:
Step 1: The outer for-loop sets i from 10 to 14 (5 iterations).
Step 2: In each iteration, the inner do-while loop executes printf, printing '1'.
Step 3: The continue statement branches to while(0), terminating the do-while loop.
Step 4: The subsequent break statement exits the while(i) loop.
Step 5: Thus exactly 5 ones are printed: '11111'.