C QuestionsBy Kritika Papne / March 18, 2023 0 votes, 0 avg 737 123456789101112131415 C Questions 1 / 15 1. What will be the output of the following C code if following commands are used to run (considering myfile exists)? A. Compile time error (after first command) B. d in the myfile file C. d on the screen D. Undefined behaviour 2 / 15 2. What type of array is generally generated in Command-line argument? A. Single dimension array B. 2-Dimensional Square Array C. Jagged Array D. 2-Dimensional Rectangular Array 3 / 15 3. Which of the following is not a storage class specifier in C? A. extern B. register C. volatile D. static 4 / 15 4. 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; } A. 55 B. 54 C. 1 D. o 5 / 15 5. 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 6 / 15 6. double ______ (double x, double y) computes the floating-point remainder of x/y. A. modf B. fmod C. ceil D. floor 7 / 15 7. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 8 / 15 8. What will be the output of the following code snippet? #include void solve() { int a[] = {1, 2, 3, 4, 5}; int sum = 0; for(int i = 0; i < 5; i++) { if(i % 2 == 0) { sum += *(a + i); } else { sum -= *(a + i); } } printf("%d", sum); } int main() { solve(); return 0; } A. 2 B. 15 C. syntax error D. 3 9 / 15 9. 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 10 / 15 10. What will be the output of the following C code? #include int main() { int i = 0; do { i++; if (i == 2) continue; printf("In while loop "); } while (i < 2); printf("%dn", i); } A. In while loop 2 B. In while loop in while loop 3 C. In while loop 3 D. Infinite loop 11 / 15 11. What does the following program print? #include void f(int *p, int *q) { p = q; *p = 2; } int i = 0, j = 1; int main() { f(&i, &j); printf("%d %d n", i, j); getchar(); return 0; } A. 2 2 B. 2 1 C. 0 1 D. 0 2 12 / 15 12. What will happen if a header file is included in a program twice? A. Program will throw an error B. Program will throw an exception C. Program will run normally D. None of these 13 / 15 13. What is an example of iteration in C? A. for B. while C. Do-while D. All of these 14 / 15 14. Identify X library function for line input and output in the following C code? A. fputs B. getc C. putc D. fgets 15 / 15 15. 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 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