C Questions March 18, 2023 | No Comments 0 votes, 0 avg 7 123456789101112131415 C Questions 1 / 15 1. What will be the output of the following C function? #include enum birds {SPARROW, PEACOCK, PARROT}; enum animals {TIGER = 8, LION, RABBIT, ZEBRA}; int main() { enum birds m = TIGER; int k; k = m; printf("%dn", k); return 0; } A. 8 B. 1 C. O D. compile time error 2 / 15 2. 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 3 / 15 3. What is an example of iteration in C? A. for B. while C. Do-while D. All of these 4 / 15 4. scanf() is a predefined function in______header file. A. stdlib. h B. ctype. h C. stdio. h D. stdarg. h 5 / 15 5. Size of an array can be evaluated by __________ (Assuming array declaration int a[10];) A. sizeof(a); B. sizeof(*a); C. sizeof(a[10]); D. 10 * sizeof(a); 6 / 15 6. What will be the output of the following C code if following commands are used to run (considering myfile exists)? A. Compile time error (after first command) B. d in the myfile file C. d on the screen D. Undefined behaviour 7 / 15 7. Multiple values of the same variable can be tested using ___. A. switch B. for C. function D. All of these 8 / 15 8. 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. 9 / 15 9. 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 10 / 15 10. 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 11 / 15 11. What is #include < stdio.h > ? A. Preprocessor directive B. Inclusion directive C. File inclusion directive D. None of the mentioned 12 / 15 12. 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 13 / 15 13. 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 14 / 15 14. 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 15 / 15 15. 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 Your score is The average score is 27% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz