C Questions

0 votes, 0 avg
735

C Questions

1 / 15

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

2 / 15

2. Global variables are ____________

3 / 15

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

4 / 15

4. How many times i value is checked in the following C program?

        #include 

        int main()

        {

            int i = 0;

            while (i < 3)

                i++;

            printf("In while loopn");

        }

5 / 15

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

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. If p is an integer pointer with a value 1000, then what will the value of p + 5 be?

8 / 15

8. Which keyword is used to prevent any changes in the variable within a C program?

9 / 15

9. What is the output of the following code snippet?

#include 
int main() {
	int a[] = {1, 2, 3, 4};
	int sum = 0;
	for(int i = 0; i < 4; i++) {
	    sum += a[i];
	}
	printf("%d", sum);
	return 0;
}

10 / 15

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

        #include 

        int f(char chr, ...);

        int main()

        {

            char c = 97;

            f(c);

            return 0;

        }

        int f(char c, ...)

        {

            printf("%cn", 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. 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;
}

13 / 15

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

14 / 15

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

        }

15 / 15

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

#include 

int main()
{
    int x[5] = { 10, 20, 30 };
    printf("%ld", sizeof(x)/sizeof(x[0]));
    return 0;
}

Your score is

The average score is 38%

0%

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