C Questions March 18, 2023 | No Comments 0 votes, 0 avg 729 123456789101112131415 C Questions 1 / 15 1. What will be the output of the following C code? #include int *m(); void main() { int *k = m(); printf("hello "); printf("%d", k[0]); } int *m() { int a[2] = {5, 8}; return a; } A. Hello 5 8 B. Hello 5 C. hello followed by garbage value D. Compilation error 2 / 15 2. What will be the output of the following code snippet? #include void solve() { int x = 1, y = 2; printf(x > y ? "Greater" : x == y ? "Equal" : "Lesser"); } int main() { solve(); return 0; } A. Greater B. Lesser C. Equal D. None of the above 3 / 15 3. What will be the output of the following C code? #include void main() { int x = 1, y = 0, z = 5; int a = x && y && z++; printf("%d", z); } A. 6 B. 5 C. Varies D. 0 4 / 15 4. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 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. 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 7 / 15 7. 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 8 / 15 8. What is an example of iteration in C? A. for B. while C. Do-while D. All of these 9 / 15 9. What is the output of C Program.? int main() { int a=0, b=0; while(++a < 4) printf("%d ", a); while(b++ < 4) printf("%d ", b); return 0; } A. 0 1 2 3 1 2 3 4 B. 1 2 3 1 2 3 4 C. 1 2 3 4 1 2 3 4 D. 1 2 3 4 0 1 2 3 10 / 15 10. What is output of below program? int main() { int i,j; for(i = 0,j=0;i<5;i++) { printf("%d%d--",i,j); } return 0; } A. 0--01--12--23--34-- B. 00--10--20--30--40-- C. Compilation Error D. 00--01--02--03--04-- 11 / 15 11. 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 12 / 15 12. Global variables are ____________ A. Internal B. External C. Both Internal and External D. None of the mentioned 13 / 15 13. What will happen if a header file is included in a program twice? A. Program will throw an error B. Program will throw an exception C. Program will run normally D. None of these 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. Choose facts about continue; statement is C Language. A. continue; is used to take the execution control to next iteration or sequence B. continue; statement causes the statements below it to skip for execution C. continue; is usually accompanied by IF statement. D. All the above. 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