Control Instructions

Q1:
What will be the output of the program?
#include<stdio.h>
int main()
{
    int i=3;
    switch(i)
    {
        case 1:
            printf('Hello\n');
        case 2:
            printf('Hi\n');
        case 3:
            continue;
        default:
            printf('Bye\n');
    }
    return 0;
}

A Error: Misplaced continue

B Bye

C No output

D Hello Hi

ANS:A - Error: Misplaced continue

The keyword continue cannot be used in switch case. It must be used in for or while or do while loop. If there is any looping statement in switch case then we can use continue.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.