C Questions March 18, 2023 | No Comments 0 votes, 0 avg 37 123456789101112131415 C Questions 1 / 15 1. 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. 2 / 15 2. Which of the following is an exit controlled loop? A. While loop B. for loop C. Do-while loop D. none of the above 3 / 15 3. 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 4 / 15 4. Identify X library function for line input and output in the following C code? A. getc B. putc C. fgets D. fputs 5 / 15 5. Array sizes are optional during array declaration by using ______ keyword. A. auto B. static C. extern D. register 6 / 15 6. What is storage class for variable A in below code? int main() { int A; A = 10; printf("%d", A); return 0; } A. extern B. auto C. register D. static 7 / 15 7. What is an example of iteration in C? A. for B. while C. Do-while D. All of these 8 / 15 8. 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 9 / 15 9. What does argc and argv indicate in command-line arguments? (Assuming: int main(int argc, char *argv[]) ) A. argument count, argument variable B. argument count, argument vector C. argument control, argument variable D. argument control, argument vector 10 / 15 10. What does the following program print? #include void f(int *p, int *q) { p = q; *p = 2; } int i = 0, j = 1; int main() { f(&i, &j); printf("%d %d n", i, j); getchar(); return 0; } A. 2 2 B. 2 1 C. 0 1 D. 0 2 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. Global variables are ____________ A. Internal B. External C. Both Internal and External D. None of the mentioned 14 / 15 14. Which of the following are themselves a collection of different data types? A. string B. structures C. char D. all of the mentioned 15 / 15 15. What will be the output of the following C code? #include int main() { const int ary[4] = {1, 2, 3, 4}; int *p; p = ary + 3; *p = 5; printf("%dn", ary[3]); } A. 4 B. 5 C. Compile time error D. 3 Your score is The average score is 30% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz