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 11



Share with a Friend

Multiple Choice Questions


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

51. A switch statement is used to
A). To use switching variable
B). Switch between function in a programchar
C). Switch from one variable to another variable
D). To choose from multiple possibilities which may arise due to different values of a single variable
View Answer
Correct: D




52. What is the output of C Program ?
int main()
{
    int a=9, b=5, c=8;
    a=b=c=10;
    if(a==9)
    {
        printf("Swan\n");
    }
    else
    {
        printf("Eggs\n");
    }
    
    printf("Red");

    return 0;
}
A). Swan Eggs Red
B). Swan Red
C). Eggs Red
D). Compiler error as you can not assign to more than two variables at once.
View Answer
Correct: C




53. A labeled statement consist of an identifier followed by a
A). ;
B). ,
C). :
D). None of the above
View Answer
Correct: C




54. What is the output of C Program ?
int main()
{
    int a=9, b=5, c=8;

    if(!(a==9))
    {
        printf("Monkey\n");
    }
    else
    {
        printf("Elephant\n");
    }
    
    printf("Cat");

    return 0;
}
A). Monkey Cat
B). Elephant Cat
C). Cat
D). Compiler error
View Answer
Correct: B




55. Consider the following code snippet
marks = 80;
switch (marks)
{
     case 60:
       grade = ‘C’;
       break;
     case 70: 
        grade = ‘B’;
        break;
     case 80:
        grade = ‘A’;
        break;
     default:
        grade = ‘E’;
}
What is the value of ‘grade’ after the switch statement is executed?

A). A
B). B
C). C
D). E
View Answer
Correct: A