C Questions March 18, 2023 | No Comments 0 votes, 0 avg 726 123456789101112131415 C Questions 1 / 15 1. Which of the following is not a storage class specifier in C? A. extern B. register C. volatile D. static 2 / 15 2. 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; } A. 0 1 2 3 1 2 3 4 B. 1 2 3 1 2 3 4 C. 1 2 3 4 1 2 3 4 D. 1 2 3 4 0 1 2 3 3 / 15 3. What is the format identifier for “static a = 20.5;”? A. %s B. %d C. %f D. Illegal declaration due to absence of data type 4 / 15 4. Libray function getch() belongs to which header file? A. stdio.h B. conio.h C. stdlib.h D. stdlibio.h 5 / 15 5. What will be the output of the following C code? #include struct p { int k; char c; float f; }; int p = 10; int main() { struct p x = {1, 97}; printf("%f %dn", x.f, p); } A. Compile time error B. O.OOOOOO 1O C. Somegarbage value 10 D. 0 10 6 / 15 6. Which of the following is true for the static variable? A. It can be called from another function B. It exists even after the function ends C. It can be modified in another function by sending it as a parameter D. All of the mentioned 7 / 15 7. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 8 / 15 8. 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"); } A. Run time error B. Hello is printed thrice C. Hello is printed twice D. Hello is printed infinitely 9 / 15 9. Which of the following format specifiers is used to specify whether the given time is in AM or PM? A. %P B. %I C. %X D. %p 10 / 15 10. 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]); } A. 1 2 3 junk 4 5 B. Compile time error C. 1 2 3 0 4 5 D. 1 2 3 3 4 5 11 / 15 11. What is the disadvantage of arrays in C? A. The amount of memory to be allocated should be known beforehand B. Elements of an array can be accessed in constant time C. Elements are stred in contiguous memory blocks D. Multiple other data structures can be implemented using array. 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]); } A. 1 2 3 4 5 0 B. 1 2 3 4 5 junk C. 1 2 3 4 5 5 D. Run time error 13 / 15 13. Size of an array can be evaluated by __________ (Assuming array declaration int a[10];) A. sizeof(a); B. sizeof(*a); C. sizeof(a[10]); D. 10 * sizeof(a); 14 / 15 14. 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 15 / 15 15. Which of the following is a correct format for declaration of function? A. return-type function-name(argument type); B. return-type function-name(argument type){} C. return-type (argument type)function-name; D. all of the mentioned Your score isThe average score is 38% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz