C Questions

0 votes, 0 avg
615

C Questions

1 / 15

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

2 / 15

2. In C, parameters are always 

3 / 15

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

4 / 15

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

        }

5 / 15

5. 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;

        }

6 / 15

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

7 / 15

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

        }

8 / 15

8. Which of the following option is the correct representation of the following C statement?

e = a * b + c / d * f;

9 / 15

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

#include 
void solve() {
    int a = 3;
    int res = a++ + ++a + a++ + ++a;
    printf("%d", res);
}
int main() {
solve();
return 0;
}

10 / 15

10. How are String represented in memory in C?

11 / 15

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

12 / 15

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

13 / 15

13. The following function computes the maximum value contained in an integer array p[] of size n (n >= 1) 

int max(int *p, int n)
{
    int a=0, b=n-1;
    while (__________)
    {
        if (p[a] <= p[b])
        {
            a = a+1;
        }
        else
        {
            b = b-1;
        }
    }
    return p[a];
}

The missing loop condition is

14 / 15

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

15 / 15

15. What is the disadvantage of arrays in C?

Your score is

The average score is 40%

0%