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 23



Share with a Friend

Multiple Choice Questions


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

111. Study the following 'C' program
#include <stdio.h>
void main ()
{ 
    static a, b;
    while (a > b ++)
}
What will be the value of a and b on the execution of above program?

A). a = 0, b = 1
B). a = 0, b = 0
C). a = 1, b = 1
D). None of these
View Answer
Correct: A




112. Choose facts about continue; statement is C Language.

A). continue; is used to take the execution control to next iteration or sequence
B). continue; statement causes the statements below it to skip for execution
C). continue; is usually accompanied by IF statement.
D). All the above.
View Answer
Correct: D




113. If the following loop is implemented
void main()
{ 
        int num = 0;
        do
        {
                -- num;
                printf (ā€œ%dā€, num);
                num ++;
        }
        while (num >=0);        
}
A). A run time error will be reported
B). The program will not enter into the loop
C). The loop will run infinitely many times
D). There will be a compilation error reported
View Answer
Correct: C




114. What is the output of C Program ?
int main()
{
    int a=14;
    
    while(a<20)
    {
        ++a;
        if(a>=16 && a<=18)
        {
            continue;
        }
        printf("%d ", a);
       
    }

    return 0;
}
A). 15 16 17 18 19
B). 15 18 19
C). 15 16 20
D). 15 19 20
View Answer
Correct: D




115. Consider the following program fragment:
switch (input)
{
        case '1': printf ("one");
        case '3': printf ("three");
        case '4': printf ("five");
        default: printf ("odd"); break;
}
What will be printed when input is '3'?

A). three five odd
B). three
C). three odd
D). three odd
View Answer
Correct: B