C Programming Multiple Choice Questions (MCQ) | IT Developer <?php echo $page_title; ?>
IT Developer

C Programming Multiple Choice Questions (MCQ)

C Programming - Conditional Statements & Loops Multiple Choice Questions (MCQ) - Set 28



Share with a Friend

Multiple Choice Questions


C Programming - Conditional Statements & Loops Multiple Choice Questions (MCQ) - Set 28

136. What is the output of C Program with switch statement or block ?
int main()
{
    int k=8;

    switch(k)
    {
        case 1==8: printf("ROSE ");break;
        case 1 && 2: printf("JASMINE "); break;
        default: printf("FLOWER ");
    }

    printf("GARDEN");
}
A). ROSE GARGEN
B). JASMINE GARDEN
C). FLOWER GARDEN
D). Compiler error
View Answer
Correct: C




137. What is the output of C Program with switch statement or block ?
int main()
{
    int k=25;

    switch(k)
    {
        case 24: printf("ROSE ");break;
        case 25: printf("JASMINE "); continue;
        default: printf("FLOWER ");
    }

    printf("GARDEN");
}
A). JASMINE GARDEN
B). JASMINE FLOWER GARDEN
C). FLOWER GARDEN
D). Compiler error
View Answer
Correct: D




138. What is the output of C Program with switch statement or block ?
int main()
{
    switch(24.5)

        case 24.5: printf("SILVER ");break;
        case 25.0: printf("GOLD "); break;
        default: printf("TIN ");
    }
    
    printf("COPPER");
}
A). SILVER COPPER
B). TIN COPPER
C). COPPER
D). Compiler error
View Answer
Correct: D




139. Choose a correct statement about a C Switch Construct.
A). default case is optional inside switch.
B). break; causes the control to exit the switch immediately and avoid fall down to other CASE statements.
C). You can not use duplicate CASE Constants inside a Switch construct.
D). All the above.
View Answer
Correct: D




140. In switch statement, each case instance value must be ?
A). Constant
B). Variable
C). Special Symbol
D). None of the above
View Answer
Correct: A