C Questions March 18, 2023 | No Comments 0 votes, 0 avg 721 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 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 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. What will be the output of the following C code? #include void main() { char *s = "hello"; char *p = s * 3; printf("%ct%c", *p, s[1]); } A. h e B. l e C. Compile time error D. l h 6 / 15 6. What will be the output of the following C program? #include union values { int val1; char val2; } myVal; int main() { myVal.val1 = 66; printf("val1 = %p", &myVal.val1); printf("nval2 = %p", &myVal.val2); return 0; } A. val1 = 0x54ac88dd2012 val2 = 0x55ac76dd2014 B. Error C. val1 = 0x55ac76dd2014 val2 = 0x55ac76dd2014 D. Exception 7 / 15 7. Which of the following is an exit controlled loop? A. While loop B. for loop C. Do-while loop D. none of the above 8 / 15 8. 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 9 / 15 9. 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 10 / 15 10. What will be the output of the following C code? #include void foo(int *ary[]); int main() { int ary[2][3]; foo(ary); } void foo(int *ary[]) { int i = 10, j = 2, k; ary[0] = &i; ary[1] = &j; *ary[0] = 2; for (k = 0;k < 2; k++) printf("%dn", *ary[k]); } A. 2 2 B. Compile time error C. Undefined behaviour D. 10 2 11 / 15 11. Which is correct with respect to the size of the data types? A. char > int > float B. int > char > float C. char < int < double D. double > char > int 12 / 15 12. What will be the output of the following C code? #include void main() { double k = 0; for (k = 0.0; k < 3.0; k++) printf("Hello"); } A. Run time error B. Hello is printed thrice C. Hello is printed twice D. Hello is printed infinitely 13 / 15 13. What will be the output of the following C code? #include int main() { char str1[] = { 'H', 'e', 'l', 'l', 'o' }; char str2[] = "Hello"; printf("%ld,%ld", sizeof(str1), sizeof(str2)); return 0; } A. 5,5 B. 6,6 C. 5,6 D. None of the above 14 / 15 14. What is the default return type if it is not specified in function definition? A. void B. int C. double D. short int 15 / 15 15. 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 Your score isThe average score is 39% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz