C QuestionsBy Kritika Papne / March 18, 2023 0 votes, 0 avg 746 123456789101112131415 C Questions 1 / 15 1. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 2 / 15 2. Array sizes are optional during array declaration by using ______ keyword. A. auto B. static C. extern D. register 3 / 15 3. Which of the following is an exit controlled loop? A. While loop B. for loop C. Do-while loop D. none of the above 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"); } A. Nothing B. Compile time error C. hello D. Varies 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; } A. 2, 1, 2 B. 2, 1, 1 C. 2, 1, 4 D. 2, 2, 8 6 / 15 6. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 7 / 15 7. Choose a correct statement about C language break; statement. A. A single break; statement can force execution control to come out of only one loop. B. A single break; statement can force execution control to come out of a maximum of two nested loops. C. A single break; statement can force execution control to come out of a maximum of three nested loops. D. None of the above. 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"); } A. 2 B. 3 C. 4 D. 1 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; } A. Compilation error B. Infinite loop C. Segmentation fault D. No.of lines present in file newfile 10 / 15 10. How are String represented in memory in C? A. An array of characters B. The object of some class C. same as other primitive data types D. linkedList of chracters 11 / 15 11. Libray function getch() belongs to which header file? A. stdio.h B. conio.h C. stdlib.h D. stdlibio.h 12 / 15 12. Property which allows to produce different executable for different platforms in C is called? A. File inclusion B. Selective inclusion C. Conditional compilation D. Recursive macros 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; } A. 3 5 B. 3 3 C. 5 5 D. 5 3 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]); } A. 4 B. 5 C. Compile time error D. 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; } A. 5,5 B. 6,6 C. 5,6 D. None of the above Your score isThe average score is 38% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Written by Shubhranshu Shekhar, who has trained 20000+ students in coding. Kritika Papne