C Questions

0 votes, 0 avg
631

C Questions

1 / 15

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

2 / 15

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

3 / 15

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

        }

4 / 15

4. What will be the output of the following C code if following commands are used to run (considering myfile exists)?

5 / 15

5. Size of an array can be evaluated by __________

(Assuming array declaration int a[10];)

6 / 15

6. What will be the output of the following C code considering the size of a short int is 2, char is 1 and int is 4 bytes?

        #include 

        int main()

        {

            short int i = 20;

            char c = 97;

            printf("%d, %d, %dn", sizeof(i), sizeof(c), sizeof(c + i));

            return 0;

        }

7 / 15

7. Property which allows to produce different executable for different platforms in C is called?

8 / 15

8. What is output of below program?


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

9 / 15

9. The parameter control string in the printf () is a C String that contains text to be __________

10 / 15

10. Which statement is required to execute a block of code when the condition is false?

11 / 15

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

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

14 / 15

14. What is the output of C Program.?

int main()
{
    int a=14;
    
    while(a<20)
    {
        ++a;
        if(a>=16 && a<=18)
        {
            continue;
        }
        printf("%d ", a);
       
    }

    return 0;
}

15 / 15

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

Your score is

The average score is 39%

0%