C Questions

0 votes, 0 avg
746

C Questions

1 / 15

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

2 / 15

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

3 / 15

3. Which of the following is an exit controlled loop?

4 / 15

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

        #include 

        struct student

        {

            int no = 5;

            char name[20];

        };

        void main()

        {

            struct student s;

            s.no = 8;

            printf("hello");

        }

5 / 15

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

        }

6 / 15

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

7 / 15

7. Choose a correct statement about C language break; statement.

8 / 15

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

        }

9 / 15

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

        }

10 / 15

10. How are String represented in memory in C?

11 / 15

11. Libray function getch() belongs to which header file?

12 / 15

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

13 / 15

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

#include 
int main() {
	int a = 3, b = 5;
	int t = a;
	a = b;
	b = t;
	printf("%d %d", a, b);
	return 0;
}

14 / 15

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

        #include 

        int main()

        {

            const int ary[4] = {1, 2, 3, 4};

            int *p;

            p = ary + 3;

            *p = 5;

            printf("%dn", ary[3]);

        }

15 / 15

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

#include 

int main()
{
    char str1[] = { 'H', 'e', 'l', 'l', 'o' };
    char str2[] = "Hello";

    printf("%ld,%ld", sizeof(str1), sizeof(str2));

    return 0;
}

Your score is

The average score is 38%

0%

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

Scroll to Top