C Questions

0 votes, 0 avg
729

C Questions

1 / 15

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

        }

2 / 15

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

#include 
void solve() {
    int x = 1, y = 2;
    printf(x > y ? "Greater" : x == y ? "Equal" : "Lesser");
}
int main() {
    solve();
return 0;
} 

3 / 15

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

        }

4 / 15

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

5 / 15

5. How are String represented in memory in C?

6 / 15

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

        }

7 / 15

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

8 / 15

8. What is an example of iteration in C?

9 / 15

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

10 / 15

10. What is output of below program?


int main()
{
 int i,j;
 for(i = 0,j=0;i<5;i++)
 {
   printf("%d%d--",i,j);
 }
 return 0;
}

11 / 15

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

12 / 15

12. Global variables are ____________

13 / 15

13. What will happen if a header file is included in a program twice?

14 / 15

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

        }

15 / 15

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

Your score is

The average score is 38%

0%

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.