C Questions

0 votes, 0 avg
666

C Questions

1 / 15

1. Array sizes are optional during array declaration by using ______ keyword.

2 / 15

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

        #include 

        void foo(int *ary[]);

        int main()

        {

            int ary[2][3];

            foo(ary);

        }

        void foo(int *ary[])

        {

            int i = 10, j = 2, k;

            ary[0] = &i;

            ary[1] = &j;

            *ary[0] = 2;

            for (k = 0;k < 2; k++)

            printf("%dn", *ary[k]);

        }

3 / 15

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

4 / 15

4. What will be the output of the following C program?

#include 

union values {
    int val1;
    char val2;
} myVal;

int main()
{
    myVal.val1 = 66;
    
    printf("val1 = %p", &myVal.val1);
    printf("nval2 = %p", &myVal.val2);
    
    return 0;
}

5 / 15

5. The syntax of the scanf() is scanf(“control string “, arg1,arg2,arg3,….,argn); the prototype of control string is ____________

6 / 15

6. What is an example of iteration in C?

7 / 15

7. Which option should be selected to work the following C expression?

string p = "HELLO";

8 / 15

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

        #include 

        void main()

        {

            int x = 1, y = 0, z = 5;

            int a = x && y && z++;

            printf("%d", z);

        }

9 / 15

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

        #include 

        #include 

        int main()

        {

            char line[3];

            FILE *fp;

            fp = fopen("newfile.txt", "r");

            while (fgets(line, 3, fp))

            fputs(line, stdout);

            return 0;

        }

10 / 15

10. 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);

       }

11 / 15

11. Which of the following is true about return type of functions in C?

12 / 15

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

        #include 

        int main()

        {

            int x = 0;

            if (x == 1)

                if (x == 0)

                    printf("inside ifn");

                else

                    printf("inside else ifn");

            else

                printf("inside elsen");

        }

13 / 15

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

14 / 15

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

15 / 15

15. The standard header _______ is used for variable list arguments (…) in C.

Your score is

The average score is 39%

0%