C Questions March 18, 2023 | No Comments 0 votes, 0 avg 631 123456789101112131415 C Questions 1 / 15 1. 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 2 / 15 2. The standard header _______ is used for variable list arguments (…) in C. A. stdio.h B. stdlib.h C. math.h D. stdarg.h 3 / 15 3. What will be the output of the following C code? #include void main() { double k = 0; for (k = 0.0; k < 3.0; k++) printf("Hello"); } A. Run time error B. Hello is printed thrice C. Hello is printed twice D. Hello is printed infinitely 4 / 15 4. 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 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 considering the size of a short int is 2, char is 1 and int is 4 bytes? #include int main() { short int i = 20; char c = 97; printf("%d, %d, %dn", sizeof(i), sizeof(c), sizeof(c + i)); return 0; } A. 2, 1, 2 B. 2, 1, 1 C. 2, 1, 4 D. 2, 2, 8 7 / 15 7. Property which allows to produce different executable for different platforms in C is called? A. File inclusion B. Selective inclusion C. Conditional compilation D. Recursive macros 8 / 15 8. 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 9 / 15 9. The parameter control string in the printf () is a C String that contains text to be __________ A. taken from a standard output device B. written on to the standard output device C. received from the standard output device D. nothing can be said 10 / 15 10. Which statement is required to execute a block of code when the condition is false? A. for B. if C. else D. All of these 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. 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 14 / 15 14. What is the output of C Program.? int main() { int a=14; while(a<20) { ++a; if(a>=16 && a<=18) { continue; } printf("%d ", a); } return 0; } A. 15 16 17 18 19 B. 15 18 19 C. 15 19 20 D. 15 16 20 15 / 15 15. Which keyword is used to prevent any changes in the variable within a C program? A. immutable B. mutable C. const D. volatile Your score isThe average score is 39% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz