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 21



Share with a Friend

Multiple Choice Questions


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

101. Which operators are known as Ternary Operator?
A). ::, ?
B). ?, :
C). ?, ;;
D). None of the above
View Answer
Correct: B




102. What is the output of C Program ?
int main()
{
    int k, j;
    
    for(k=1, j=10; k <= 5; k++)
    {
        printf("%d ", (k+j));
    }

    return 0;
}
A). compiler error
B). 10 10 10 10 10
C). 10 11 12 13 14 15
D). None of the above
View Answer
Correct: C




103. Find the error in the following program:
main()
{
        int m;
        char g;
        switch(m)
        {
                case 3: grade="P"; break;
                case 2: grade="Q"; break;
                case 1: grade="R"; break;
                default: grade="S"; break;
        }                       
}
What will be the output of the program?
A). Undefined symbol "grade"
B). switch statement cannot have more than three labels
C). case label cannot be numbers
D). none of these
View Answer
Correct: A




104. What is the output of C Program ?
int main()
{
    int k;
    
    for(k=1; k <= 5; k++);
    {
        printf("%d ", k);
    }

    return 0;
}
A). 1 2 3 4 5
B). 1 2 3 4
C). 6
D). 5
View Answer
Correct: C




105. How long the following loop runs?
  for ( x=0; x=3; x++)
A). Three times
B). Four times
C). Forever
D). Never
View Answer
Correct: D