C Questions March 18, 2023 | No Comments 0 votes, 0 avg 708 123456789101112131415 C Questions 1 / 15 1. 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 2 / 15 2. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 3 / 15 3. Is initialisation mandatory for local static variables? A. Yes B. No C. Depends on the compiler D. Depends on the standard 4 / 15 4. 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 5 / 15 5. 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 6 / 15 6. 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 7 / 15 7. Array sizes are optional during array declaration by using ______ keyword. A. auto B. static C. extern D. register 8 / 15 8. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 9 / 15 9. 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 10 / 15 10. What will be the output of the following C code? #include #include int main() { char line[3]; FILE *fp; fp = fopen("newfile.txt", "r"); while (fgets(line, 3, fp)) fputs(line, stdout); return 0; } A. Compilation error B. Infinite loop C. Segmentation fault D. No.of lines present in file newfile 11 / 15 11. Which of the following are themselves a collection of different data types? A. string B. structures C. char D. all of the mentioned 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. What is #include < stdio.h > ? A. Preprocessor directive B. Inclusion directive C. File inclusion directive D. None of the mentioned 14 / 15 14. What will fopen will return, if there is any error while opening a file? A. Nothing B. EOF C. NULL D. Depends on compiler 15 / 15 15. What will be the output of the following C code? #include int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); } A. 1 4 B. compilation error C. 1 2 4 D. 1 3 4 Your score isThe average score is 39% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz