C Questions

0 votes, 0 avg
37

C Questions

1 / 15

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

2 / 15

2. Which of the following is an exit controlled loop?

3 / 15

3. 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]);

        }

4 / 15

4. Identify X library function for line input and output in the following C code?

5 / 15

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

6 / 15

6. What is storage class for variable A in below code?


int main()
{
int A;
A = 10;
printf("%d", A);
return 0;
}

7 / 15

7. What is an example of iteration in C?

8 / 15

8. 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");

        }

9 / 15

9.

What does argc and argv indicate in command-line arguments?
(Assuming: int main(int argc, char *argv[]) )

10 / 15

10. What does the following program print?

#include
void f(int *p, int *q)
{
  p = q;
 *p = 2;
}
int i = 0, j = 1;
int main()
{
  f(&i, &j);
  printf("%d %d n", i, j);
  getchar();
  return 0;
}

11 / 15

11. 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}};

        }

12 / 15

12. 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;
}

13 / 15

13. Global variables are ____________

14 / 15

14. Which of the following are themselves a collection of different data types?

15 / 15

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

        #include 

        int main()

        {

            const int ary[4] = {1, 2, 3, 4};

            int *p;

            p = ary + 3;

            *p = 5;

            printf("%dn", ary[3]);

        }

Your score is

The average score is 30%

0%