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 27



Share with a Friend

Multiple Choice Questions


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

131. What is the output of C program with switch statement or block ?
int main()
{
    char code = 'K';

    switch(code)
    {
        case 'A': printf("ANT ");break;
        case 'K': printf("KING "); break;
        default: printf("NOKING");
    }

    printf("PALACE");
}
A). KING PALACE
B). KING NOTHING PALACE
C). ANT KING PALACE
D). Compiler error for using Non Integers as CASE constants.
View Answer
Correct: A




132. What is the output of C Program with switch statement or block ?
int main()
{
    char code = 'K';

    switch(code)
    {
        case "A": printf("ANT ");break;
        case "K": printf("KING "); break;
        default: printf("NOKING");
    }

    printf("PALACE");
}
A). ANT KING PALACE
B). KING PALACE
C). PALACE
D). Compiler error
View Answer
Correct: D




133. What is the output of C Program with switch statement or block ?
int main()
{
    char code = 'A';

    switch(code)
    {
        case 64+1: printf("ANT ");break;
        case 8*8+4: printf("KING "); break;
        default: printf("NOKING");
    }

    printf("PALACE");
}
A). ANT KING PALACE
B). KING PALACE
C). ANT PALACE
D). Compiler error for using expressions
View Answer
Correct: C




134. What is the output of C Program with switch statement or block ?
int main()
{
    char code=64;

    switch(code)
    {
        case 64: printf("SHIP ");break;
        case 8*8: printf("BOAT "); break;
        default: printf("PETROL");
    }

    printf("CHILLY");
}
A). SHIP CHILLY
B). BOAT CHILLY
C). BOAT PETROL CHILLY
D). Compiler error
View Answer
Correct: D




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

    switch(k)
    {
        case k<64: printf("SHIP ");break;
        case k>=64: printf("BOAT "); break;
        default: printf("PETROL");
    }

    printf("CHILLY");
}
A). BOAT CHILLY
B). BOAT PETROL CHILLY
C). SHIP BOAT CHILLY
D). Compiler error
View Answer
Correct: D