C Questions March 18, 2023 | No Comments 0 votes, 0 avg 268 123456789101112131415 C Questions 1 / 15 1. The parameter control string in the printf () is a C String that contains text to be __________ A. taken from a standard output device B. written on to the standard output device C. received from the standard output device D. nothing can be said 2 / 15 2. What will be the output of the following C code? #include int main() { float x = 23.456; printf("%.2f",x); return 0; } A. 23.456OO B. 23.456 C. 23.45 D. 23.46 3 / 15 3. What is the use of symbol * in the control string as shown [=%[*][width] [modifiers] type=]? A. * is not optional, used to read data from the stream but it is not ignored B. * is optional and used when the data should be read from the stream but ignored C. * is not optional, it is used to read data stream but ignored D. * is optional and used to read data from stream but it is not ignored 4 / 15 4. What will be the output of the following C program? #include int main() { int x[5] = { 10, 20, 30 }; printf("%ld", sizeof(x)/sizeof(x[0])); return 0; } A. 3 B. 4 C. 5 D. 6 5 / 15 5. What will be the output of the following C code? #include int main(){ char grade = 'B'; switch (grade) { case 'A': printf("Excellent!n"); case 'B': case 'C': printf("Well donen"); case 'D': printf("You passedn"); case 'F': printf("Better try againn"); break; default: printf("Invalid graden"); } } A. Well done B. You passed C. Better try again D. All of these 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. What will be the output of the following C code? #include void main() { int i = 0; while (i < 10) { i++; printf("hin"); while (i < 8) { i++; printf("hellon"); } } } A. Hi is printed 8 times, hello 7 times and then hi 2 times B. Hi is printed 10 times, hello 7 times C. Hi is printed once, hello 7 times D. Hi is printed once, hello 7 times and then hi 2 times 8 / 15 8. Comment on the following 2 arrays with respect to P and Q. int *a1[8]; int *(a2[8]); P. Array of pointers Q. Pointer to an array A. a1 is P, a2 is Q B. a1 is P, a2 is P C. a1 is Q, a2 is P D. a1 is Q, a2 is Q 9 / 15 9. 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 10 / 15 10. 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 11 / 15 11. What will be the output of the following code snippet? #include void solve() { int a = 3; int res = a++ + ++a + a++ + ++a; printf("%d", res); } int main() { solve(); return 0; } A. 12 B. 24 C. 20 D. 18 12 / 15 12. 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 13 / 15 13. 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; } A. 15 16 17 18 19 B. 15 18 19 C. 15 19 20 D. 15 16 20 14 / 15 14. What will be the output of the following C code? #include int main() { float x = 21.0; x %= 3.0; printf("%f",x); return 0; } A. 7 B. 7.oo C. 7.oooooo D. error 15 / 15 15. What will fopen will return, if there is any error while opening a file? A. Nothing B. EOF C. NULL D. Depends on compiler Your score is The average score is 30% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz