C Questions March 18, 2023 | No Comments 0 votes, 0 avg 728 123456789101112131415 C Questions 1 / 15 1. scanf() is a predefined function in______header file. A. stdlib. h B. ctype. h C. stdio. h D. stdarg. h 2 / 15 2. 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 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 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. 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. Which of the following is not a storage class specifier in C? A. extern B. register C. volatile D. static 7 / 15 7. Array sizes are optional during array declaration by using ______ keyword. A. auto B. static C. extern D. register 8 / 15 8. What will be the output of the following code snippet? #include int main() { int a = 3, b = 5; int t = a; a = b; b = t; printf("%d %d", a, b); return 0; } A. 3 5 B. 3 3 C. 5 5 D. 5 3 9 / 15 9. 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 10 / 15 10. Comment on the output of the following C code. #include struct temp { int a; int b; int c; }; main() { struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; } A. No Compile time error, generates an array of structure of size 3 B. No Compile time error, generates an array of structure of size 9 C. Compile time error, illegal declaration of a multidimensional array D. Compile time error, illegal assignment to members of structure 11 / 15 11. What is #include < stdio.h > ? A. Preprocessor directive B. Inclusion directive C. File inclusion directive D. None of the mentioned 12 / 15 12. 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 13 / 15 13. 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 14 / 15 14. 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 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 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 Questions, Quiz