C Questions

0 votes, 0 avg
726

C Questions

1 / 15

1. Which of the following is not a storage class specifier in C?

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 the format identifier for “static a = 20.5;”?

4 / 15

4. Libray function getch() belongs to which header file?

5 / 15

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

        #include 

        struct p

        {

            int k;

            char c;

            float f;

        };

        int p = 10;

        int main()

        {

            struct p x = {1, 97};

            printf("%f %dn", x.f, p);

        }

6 / 15

6. Which of the following is true for the static variable?

7 / 15

7. Which C keyword is used to extend the visibility of variables?

8 / 15

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

        #include 

        void main()

        {

            double k = 0;

            for (k = 0.0; k < 3.0; k++)

                printf("Hello");

        }

9 / 15

9. Which of the following format specifiers is used to specify whether the given time is in AM or PM?

10 / 15

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

        #include 

        void main()

        {

            int a[2][3] = {1, 2, 3, , 4, 5};

            int i = 0, j = 0;

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

            for (j = 0; j < 3; j++)

            printf("%d", a[i][j]);

        }

11 / 15

11. What is the disadvantage of arrays in C?

12 / 15

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

        #include 

        void main()

        {

            int a[2][3] = {1, 2, 3, 4, 5};

            int i = 0, j = 0;

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

            for (j = 0; j < 3; j++)

            printf("%d", a[i][j]);

        }

13 / 15

13. Size of an array can be evaluated by __________

(Assuming array declaration int a[10];)

14 / 15

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

#include 

int main()
{
    char str1[] = { 'H', 'e', 'l', 'l', 'o' };
    char str2[] = "Hello";

    printf("%ld,%ld", sizeof(str1), sizeof(str2));

    return 0;
}

15 / 15

15. Which of the following is a correct format for declaration of function?

Your score is

The average score is 38%

0%