C Questions

0 votes, 0 avg
708

C Questions

1 / 15

1. What is the output of C Program.?

int main()
{
    int a=10,b=20;
    
    if(a==9 AND b==20)
    {
        printf("Hurray..");
    }
    
    if(a==10 OR b==21)
    {
        printf("Theatre");
    }

    return 0;
}

2 / 15

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

3 / 15

3. Is initialisation mandatory for local static variables?

4 / 15

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

        }

5 / 15

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

#include 

int main()
{
    float x = 21.0;
    x %= 3.0;
    printf("%f",x);

    return 0;
}

6 / 15

6. What is the format identifier for “static a = 20.5;”?

7 / 15

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

8 / 15

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

9 / 15

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

#include 

int main(){
    int a = 11;
    
    while (a < 20) {
        printf("%d  ", a);
        a += 2;
    }
    
    return 0;
}

10 / 15

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

        }

11 / 15

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

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. What is #include < stdio.h > ?

14 / 15

14. What will fopen will return, if there is any error while opening a file?

15 / 15

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

       }

Your score is

The average score is 39%

0%