Top

Control Instructions

81.

The output of the code below is

#include 
    void main()
    {
        double ch;
        printf("enter a value btw 1 to 2:");
        scanf("%lf", &ch);
        switch (ch)
        {
        case 1:
            printf("1");
            break;
        case 2:
            printf("2");
            break;
        }
    }

 

Answer: A

No answer description available for this question.
 

Enter details here

82.

Which of the following is an invalid if-else statement?

Answer: A

No answer description available for this question.
 

Enter details here

83.

What will be the output of the program?

#include
int main()
{
    unsigned int i = 65536; /* Assume 2 byte integer*/
    while(i != 0)
        printf("%d",++i);
    printf("\n");
    return 0;
}

 

Answer: D

No answer description available for this question.
 

Enter details here

84.

If scanf() is used to store a value in a char variable then along with the value a carriage return(\r) also gets stored it.

Answer: B

No answer description available for this question.
 

Enter details here

85.

What will be the output of the program?

#include
int main()
{
    int x=1, y=1;
    for(; y; printf("%d %d\n", x, y))
    {
        y = x++ <= 5;
    }
    printf("\n");
    return 0;
}

 

Answer: A

No answer description available for this question.
 

Enter details here

86.

do-while loop terminates when conditional expression returns?

Answer: B

No answer description available for this question.
 

Enter details here

87.

#include 
int main()
{
    int i;
    if (printf("0"))
        i = 3;
    else
        i = 5;
    printf("%d", i);
    return 0;
} 

 

Answer: C

No answer description available for this question.
 

Enter details here

88.

What will be the output of the program?

#include
int main()
{
    int a = 300, b, c;
    if(a >= 400)
        b = 300;
    c = 200;
    printf("%d, %d, %d\n", a, b, c);
    return 0;
}

 

Answer: C

No answer description available for this question.
 

Enter details here

89.

What will be the output of the program?

#include
int main()
{
    int i=3;
    switch(i)
    {
        case 1:
            printf("Hello\n");
        case 2:
            printf("Hi\n");
        case 3:
            continue;
        default:
            printf("Bye\n");
    }
    return 0;
}

 

Answer: A

No answer description available for this question.
 

Enter details here

90.

Point out the error, if any in the program.

#include
int main()
{
    int i = 1;
    switch(i)
    {
        printf("This is c program.");
        case 1:
            printf("Case1");
            break;
        case 2:
            printf("Case2");
            break;
    }
return 0;
}

 

Answer: C

No answer description available for this question.
 

Enter details here

Loading…
Tags: Control Instructions Questions and Answers || Control Instructions MCQ Questions and Answers || Control Instructions GK Questions and Answers || Control Instructions GK MCQ Questions || Control Instructions Multiple Choice Questions and Answers || Control Instructions GK || GK on Control Instructions || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming