Q. Determine Output

Code:
void main()
{
      int i=3;
      switch(i)
      {
            default: printf("zero");
            case 1: printf("one"); break;
            case 2: printf("two"); break;
            case 3: printf("three"); break;
      }
}
  • (A) zero
  • (B) three
  • (C) Error
  • (D) None of These
πŸ’¬ Discuss
βœ… Correct Answer: (B) three
Explanation: The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.
Explanation by: Prashant
The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
201
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Prashant
Publisher
πŸ“ˆ
86%
Success Rate