Multiple choice

Give output of the following, if the input given is 'a'. cin>>choice; switch(choice) { case ' b' :cout<< banana ; break; case ' a' :cout<< apple ; case ' g' :cout<< grapes ; default :cout<< invalid choice ; }

  1. applegrapesinvalid choice

  2. applegrapesinvalid choicebanana

  3. apple

  4. none of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

When input is 'a', case 'a' executes but has no break statement, causing fallthrough to case 'g' and then default. This outputs 'apple' + 'grapes' + 'invalid choice' without spaces.