C QuestionsBy Kritika Papne / March 18, 2023 0 votes, 0 avg 750 123456789101112131415 C Questions 1 / 15 1. 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 2 / 15 2. What will be the output of the following C code? #include struct student { char *c; struct student *point; }; void main() { struct student s; printf("%d", sizeof(s)); } A. 5 B. 9 C. 8 D. 16 3 / 15 3. 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 4 / 15 4. What is storage class for variable A in below code? int main() { int A; A = 10; printf("%d", A); return 0; } A. extern B. auto C. register D. static 5 / 15 5. What will be the output of the following code snippet? #include void solve() { int x = 1, y = 2; printf(x > y ? "Greater" : x == y ? "Equal" : "Lesser"); } int main() { solve(); return 0; } A. Greater B. Lesser C. Equal D. None of the above 6 / 15 6. What will be the output of the following C code? #include int main() { int a = 1, b = 2, c = 3; int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c; int **sptr = &ptr1; //-Ref *sptr = ptr2; } A. ptr1 points to a B. ptr1 points to b C. sptr points to ptr2 D. none of the mentioned 7 / 15 7. 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 8 / 15 8. 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 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. 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 11 / 15 11. What will be the output of the following C code? #include int main(){ int a = 11; while (a < 20) { printf("%d ", a); a += 2; } return 0; } A. 11 13 15 17 19 B. 11 12 13 14 15 16 17 18 19 20 C. 11 13 15 17 19 21 D. None of these 12 / 15 12. What will be the output of the following C code? #include int main(){ int i, j; for (i = 2; i < 10; i++) { for (j = 2; j <= (i / j); j++) if (!(i % j)) break; if (j > (i / j)) printf("%d ", i); } return 0; } A. 2 3 4 5 6 7 8 9 B. 3 5 7 9 C. 2 3 5 7 D. 2 3 5 7 11 13 / 15 13. 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 14 / 15 14. The following function computes the maximum value contained in an integer array p[] of size n (n >= 1) int max(int *p, int n) { int a=0, b=n-1; while (__________) { if (p[a] <= p[b]) { a = a+1; } else { b = b-1; } } return p[a]; } The missing loop condition is A. a != n B. b != O C. b > (a+1) D. b != a 15 / 15 15. What is the default return type if it is not specified in function definition? A. void B. int C. double D. short int 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