C QuestionsBy Kritika Papne / March 18, 2023 0 votes, 0 avg 742 123456789101112131415 C Questions 1 / 15 1. 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 2 / 15 2. In C, parameters are always A. Passed by value B. Passed by reference C. Non-pointer variables are passed by value and pointers are passed by reference D. Passed by value result 3 / 15 3. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 4 / 15 4. What is the default return type if it is not specified in function definition? A. void B. int C. double D. short int 5 / 15 5. Which option should be selected to work the following C expression? string p = "HELLO"; A. typedef char [] string; B. typedef char *string; C. typedef char [] string; and typedef char *string; D. Such expression cannot be generated in C 6 / 15 6. 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 7 / 15 7. What will be the output of the following code snippet? #include void solve() { int first = 10, second = 20; int third = first + second; { int third = second - first; printf("%d ", third); } printf("%d", third); } int main() { solve(); return 0; } A. 10 30 B. 30 10 C. 10 20 D. 20 10 8 / 15 8. What is the output of C Program.? int main() { int a=10,b=20; if(a==9 AND b==20) { printf("Hurray.."); } if(a==10 OR b==21) { printf("Theatre"); } return 0; } A. Theatre B. Hurray Theatre C. No output D. Compiler error 9 / 15 9. Which of the following is the correct syntax to declare a 3 dimensional array using pointers? A. char *a[][]; B. char **a[]; C. char ***a; D. all of the mentioned 10 / 15 10. 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 11 / 15 11. 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 12 / 15 12. What will be the output of the following code snippet? #include void solve() { int ch = 2; switch(ch) { case 1: printf("1 "); case 2: printf("2 "); case 3: printf("3 "); default: printf("None"); } } int main() { solve(); return 0; } A. 1 2 3 None B. 2 C. 2 3 None D. None 13 / 15 13. 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 14 / 15 14. Why do variable names beginning with the underscore is not encouraged? A. It is not standardized B. To avoid conflicts since assemblers and loaders use such names C. To avoid conflicts since library routines use such names D. To avoid conflicts with environment variables of an operating system 15 / 15 15. What will be the output of the following C code? #include struct student { char *name; }; struct student s[2]; void main() { s[0].name = "alan"; s[1] = s[0]; printf("%s%s", s[0].name, s[1].name); s[1].name = "turing"; printf("%s%s", s[0].name, s[1].name); } A. alan alan alan turing B. alan alan turing turing C. alan turing alan turing D. run time error 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