Top

Control Instructions

51.

Point out the error, if any in the for loop.

#include
int main()
{
    int i=1;
    for(;;)
    {
        printf("%d\n", i++);
        if(i>10)
           break;
    }
    return 0;
}

 

Answer: D

No answer description available for this question.
 

Enter details here

52.

What will be the output of the program?

#include
int main()
{
    char str[]="C-program";
    int a = 5;
    printf(a >10?"Ps\n":"%s\n", str);
    return 0;
}

 

Answer: A

No answer description available for this question.
 

Enter details here

53.

We want to test whether a value lies in the range 2 to 4 or 5 to 7. Can we do this using a switch?

Answer: A

No answer description available for this question.
 

Enter details here

54.

Which of the following errors would be reported by the compiler on compiling the program given below?

#include
int main()
{
    int a = 5;
    switch(a)
    {
    case 1:
    printf("First");

    case 2:
    printf("Second");

    case 3 + 2:
    printf("Third");

    case 5:
    printf("Final");
    break;

    }
    return 0;
}

 

Answer: C

No answer description available for this question.
 

Enter details here

55.

Which keyword can be used for coming out of recursion?

Answer: A

No answer description available for this question.
 

Enter details here

56.

Which of the following statements are correct about the below program?

#include
int main()
{
    int n = 0, y = 1;
    y == 1 ? n=0 : n=1;
    if(n)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

 

Answer: C

No answer description available for this question.
 

Enter details here

57.

The continue statment cannot be used with

Answer: D

No answer description available for this question.
 

Enter details here

58.

The output of the code below is

#include 
    int x;
    void main()
    {
        if (x)
            printf("hi");
        else
            printf("how are u");
    }

 

Answer: B

No answer description available for this question.
 

Enter details here

59.

What will be the output of the program?

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

 

Answer: D

No answer description available for this question.
 

Enter details here

60.

By default, the data type of a constant without a decimal point is int, whereas the one with a decimal point is a double.

Answer: A

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