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 5



Share with a Friend

Multiple Choice Questions


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

21. What is the output of following code:
void main()
{
int i=5;
switch(i)
  {
    case 3: printf(“three”);
    case 4: printf(“four”);
    case 5: printf(“five”);
    case 6: printf(“six”);break;
    case 7: printf(“seven”);
    default: printf(“default”);
  }
}
A). five
B). fivesixsevendefault
C). fivesix
D). None of the above
View Answer
Correct: C




22. Choose a correct C Statement using IF Conditional Statement.
A)
if( condition )
{
    //statements;
}
B)
if( condition )
{
    //statements;
}
else
{
    //statements;
}
C)
if( condition1 )
{
    //statements;
}
else if( condition2)
{
    //statements;
}
else
{
    //statements;
}
D) All the above.
View Answer
Correct: D




23. The first expression in a for… loop is
A). Step value of loop
B). Value of the counter variable
C). Condition statement
D). None of the above
View Answer
Correct: B




24. What is the output of the C Program ?
int main()
{
    if( 4 > 5 )
    {
        printf("Hurray..\n");
    }
     printf("Yes");

    return 0;
}
A). Yes
B). Hurray.. Yes
C). Hurray..Yes
D). Compiler error
View Answer
Correct: A




25. What is the output?
void main()
{
  int a=0;
  a = 5<2 ? 4 : 3;
  printf("%d",a);
}
A). 4
B). 3
C). 5
D). 2
View Answer
Correct: B