C Questions March 18, 2023 | No Comments 0 votes, 0 avg 735 123456789101112131415 C Questions 1 / 15 1. Which of the following are themselves a collection of different data types? A. string B. structures C. char D. all of the mentioned 2 / 15 2. Global variables are ____________ A. Internal B. External C. Both Internal and External D. None of the mentioned 3 / 15 3. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 4 / 15 4. How many times i value is checked in the following C program? #include int main() { int i = 0; while (i < 3) i++; printf("In while loopn"); } A. 2 B. 3 C. 4 D. 1 5 / 15 5. 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 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. If p is an integer pointer with a value 1000, then what will the value of p + 5 be? A. 1020 B. 1005 C. 1004 D. 1010 8 / 15 8. Which keyword is used to prevent any changes in the variable within a C program? A. immutable B. mutable C. const D. volatile 9 / 15 9. What is the output of the following code snippet? #include int main() { int a[] = {1, 2, 3, 4}; int sum = 0; for(int i = 0; i < 4; i++) { sum += a[i]; } printf("%d", sum); return 0; } A. 1 B. 4 C. 20 D. 10 10 / 15 10. What will be the output of the following C code? #include int f(char chr, ...); int main() { char c = 97; f(c); return 0; } int f(char c, ...) { printf("%cn", c); } A. Compile time error B. Undefined behaviour C. 97 D. a 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. 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 14 / 15 14. 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 4 5 0 B. 1 2 3 4 5 junk C. 1 2 3 4 5 5 D. Run time error 15 / 15 15. What will be the output of the following C program? #include int main() { int x[5] = { 10, 20, 30 }; printf("%ld", sizeof(x)/sizeof(x[0])); return 0; } A. 3 B. 4 C. 5 D. 6 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