C Questions

0 votes, 0 avg
7

C Questions

1 / 15

1. What will be the output of the following C function?

        #include 

        enum birds {SPARROW, PEACOCK, PARROT};

        enum animals {TIGER = 8, LION, RABBIT, ZEBRA};

        int main()

        {

            enum birds m = TIGER;

            int k;

            k = m;

            printf("%dn", k);

            return 0;

        }

2 / 15

2. What is the output of C Program.?

int main()
{
    int a=0, b=0;
    while(++a < 4)
        printf("%d ", a);

    while(b++ < 4)
        printf("%d ", b);

    return 0;
}

3 / 15

3. What is an example of iteration in C?

4 / 15

4. scanf() is a predefined function in______header file.

5 / 15

5. Size of an array can be evaluated by __________

(Assuming array declaration int a[10];)

6 / 15

6. What will be the output of the following C code if following commands are used to run (considering myfile exists)?

7 / 15

7. Multiple values of the same variable can be tested using ___.

8 / 15

8. Choose a correct statement about C language break; statement.

9 / 15

9. What will be the output of the following C code?

        #include 

        int main()

        {

            printf("%d ", 1);

            goto l1;

            printf("%d ", 2);

            l1:goto l2;

            printf("%d ", 3);

            l2:printf("%d ", 4);

       }

10 / 15

10. What is output of below program?


int main()
{
int i,j,count;
count=0;
for(i=0; i<5; i++);
{ 
for(j=0;j<5;j++);
{
    count++;
}
}
printf("%d",count);
return 0;
}

11 / 15

11. What is #include < stdio.h > ?

12 / 15

12. Comment on the output of the following C code.

        #include 

        struct temp

        {

            int a;

            int b;

            int c;

        };

        main()

        {

            struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

        }

13 / 15

13. How many times i value is checked in the following C program?

        #include 

        int main()

        {

            int i = 0;

            while (i < 3)

                i++;

            printf("In while loopn");

        }

14 / 15

14. Which is correct with respect to the size of the data types?

15 / 15

15. What will be the output of the following C code?

        #include 

        int *m();

        void main()

        {

            int *k = m();

            printf("hello ");

            printf("%d", k[0]);

        }

        int *m()

        {

            int a[2] = {5, 8};

            return a;

        }

Your score is

The average score is 27%

0%