C Questions March 18, 2023 | No Comments 0 votes, 0 avg 723 123456789101112131415 C Questions 1 / 15 1. 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 2 / 15 2. 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 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. 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 6 / 15 6. Which of the following is true about return type of functions in C? A. Functions can return any type B. Functions can return any type except array and functions C. Functions can return any type except array, functions and union D. Functions can return any type except array, functions, function pointer and union 7 / 15 7. What will be the output of the following C code? #include int main() { int x = 0; if (x == 1) if (x == 0) printf("inside ifn"); else printf("inside else ifn"); else printf("inside elsen"); } A. inside if B. inside else if C. inside else D. compile time error 8 / 15 8. Which of the following are themselves a collection of different data types? A. string B. structures C. char D. all of the mentioned 9 / 15 9. What is an example of iteration in C? A. for B. while C. Do-while D. All of these 10 / 15 10. 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 11 / 15 11. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 12 / 15 12. 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 13 / 15 13. Which of the following option is the correct representation of the following C statement? e = a * b + c / d * f; A. e = (a * (b +(c /(d * f)))); B. e = ((a * b) + (c / (d * f))); C. e = ((a * b) + ((c / d)* f)); D. Both e = ((a * b) + (c / (d * f))); and e = ((a * b) + ((c / d)* f)); 14 / 15 14. double ______ (double x, double y) computes the floating-point remainder of x/y. A. modf B. fmod C. ceil D. floor 15 / 15 15. The concept of two functions with same name is know as? A. Operator Overloading B. Function Overloading C. Function Overriding D. Function renaming Your score isThe average score is 39% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz