C QuestionsBy Kritika Papne / March 18, 2023 0 votes, 0 avg 759 123456789101112131415 C Questions 1 / 15 1. What is the format identifier for “static a = 20.5;”? A. %s B. %d C. %f D. Illegal declaration due to absence of data type 2 / 15 2. 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 3 / 15 3. Libray function getch() belongs to which header file? A. stdio.h B. conio.h C. stdlib.h D. stdlibio.h 4 / 15 4. 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 5 / 15 5. Choose a correct statement about C language break; statement. A. A single break; statement can force execution control to come out of only one loop. B. A single break; statement can force execution control to come out of a maximum of two nested loops. C. A single break; statement can force execution control to come out of a maximum of three nested loops. D. None of the above. 6 / 15 6. The syntax of the scanf() is scanf(“control string “, arg1,arg2,arg3,….,argn); the prototype of control string is ____________ A. [=%[width][modifiers]type=] B. [=%[modifiers][width]type=] C. [=%[width] [modifiers]] D. [width][modifiers] 7 / 15 7. 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 8 / 15 8. 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 9 / 15 9. Property which allows to produce different executable for different platforms in C is called? A. File inclusion B. Selective inclusion C. Conditional compilation D. Recursive macros 10 / 15 10. 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 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. What is output of below program? int main() { int i,j,count; count=0; for(i=0; i<5; i++); { for(j=0;j<5;j++); { count++; } } printf("%d",count); return 0; } A. 55 B. 54 C. 1 D. o 13 / 15 13. What will be the output of the following code snippet? #include void solve() { int a[] = {1, 2, 3, 4, 5}; int sum = 0; for(int i = 0; i < 5; i++) { if(i % 2 == 0) { sum += *(a + i); } else { sum -= *(a + i); } } printf("%d", sum); } int main() { solve(); return 0; } A. 2 B. 15 C. syntax error D. 3 14 / 15 14. What will be the output of the following C code? #include int main() { enum {ORANGE = 5, MANGO, BANANA = 4, PEACH}; printf("PEACH = %dn", PEACH); } A. PEACH = 3 B. PEACH = 4 C. PEACH = 5 D. PEACH = 6 15 / 15 15. Is initialisation mandatory for local static variables? A. Yes B. No C. Depends on the compiler D. Depends on the standard 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