The document contains a set of coding questions and answers related to C programming concepts like preprocessing, variables, functions, loops, and typedefs. The questions cover topics such as conditional compilation, preprocessor directives, variable scope and naming rules, function prototypes and return types, loops, and typedef declarations.
The document contains a set of coding questions and answers related to C programming concepts like preprocessing, variables, functions, loops, and typedefs. The questions cover topics such as conditional compilation, preprocessor directives, variable scope and naming rules, function prototypes and return types, loops, and typedef declarations.
Date: 19/09/2019 1. 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 2. C preprocessors can have compiler specific features. A. true B. false C. Depends on the standard D. Depends on the platform 3. Preprocessor feature that supply line numbers and file names to compiler is called? A. Selective inclusion B. macro substitution C. Concatenation D. Line control 4. Which of the following are C preprocessors? A. #ifdef B. #define C. #endif D. All of the mentioned. 5. The C-preprocessors are specified with _________symbol. A. # B. $ C. " " D. None of the mentioned. 6. What is the output of this C code? #define a 20 int main() { const int a = 50; printf("a = %d\n", a); } A. a = 50 B. a = 20 C. Run time error D. Compilation Error 7. What is the output of this C code? int main() { int var = 010; printf("%d", var); } A. 2 B. 8 C. 9 D. 10 8. enum types are processed by? A. Compiler B. Preprocessor C. Linker D. Assembler 9. What is the output of this C code? int main() { printf("AllIndiaExams\r\nclass\n"); return 0; } A. AllIndiaExamsclass B. AllIndiaExamsclass C. classundry D. AllIndiaExams 10. What is the output of this C code? int main() { const int a; a = 32; printf("a is %d", a); return 0; } A. a is 32 B. Compile time error C. Run time error D. none 11. Comment on the output of this C code? int const print() { printf("AllIndiaExams.in"); return 0; } void main() { print(); } A. AllIndiaExams.in is printed infinite number of times B. AllIndiaExams.in C. Runtime Error D. complilation error 12. Does this compile without error? int main() { int k; { int k; for (k = 0; k < 10; k++); } } A. Yes B. No C. Depends on the compiler D. Depends on the C standard implemented by compilers 13. What is the output of this C code? void main() { int k = 4; float k = 4; printf("%d", k) } A. Compile time error B. 4 C. 4.0000000 D. 4.4 14. A variable declared in a function can be used in main? A. True B. False C. True if it is declared static D. None of the mentioned. 15. The name of the variable used in one function cannot be used in another function? A. True B. False C. May be D. None of the mentioned. 16. C99 standard guarantees uniqueness of ____ characters for internal names. A. 31 B. 63 C. 12 D. 14 17. Which of the following is not a valid variable name declaration? A. int __a3; B. int __3a; C. int __A3; D. None of the mentioned. 18. Which of the following is not a valid variable name declaration? A. int _a3; B. int a_3; C. int 3_a; D. int _3a 19. All keywords in C are in? A. Lower Case letters B. Upper Case letters C. Camel Case letters D. None 20. Variable name resolving (number of significant characters for uniqueness of variable) depends on? A. Compiler and linker implementations B. Assemblers and loaders implementations C. C Language D. None 21. Which of the following is not a valid C variable name? A. int number; B. float rate; C. int variable_count; D. int $main; 22. Which is valid C expression? A. int my_num = 100,000; B. int my_num = 100000; C. int my num = 1000; D. int $my_num = 10000; 23. What is the output of this C code? int main() { int y = 10000; int y = 34; printf("Hello World! %d\n", y); return 0; } A. Compile time error B. Hello World! 34 24. Which of the following is not a valid variable name declaration? A. float PI = 3.14; B. double PI = 3.14; C. int PI = 3.14; D. #define PI 3.14 25. Which of the following cannot be a variable name in C? A. Volatile B. True C. friend D. export 26. What is the output of this C code? int main() { void foo(); void f() { foo(); } f(); } void foo() { printf("2 "); } A. 2 2 B. 2 C. Compile time error D. Depends on the compiler 27. What is the output of this C code? void foo(); int main() { void foo(); foo(); return 0; } void foo() { printf("2 "); } A. Compile time error B. 2 C. Depends on the compiler D. Depends on the standard 28. What is the default return type if it is not specified in function definition? A. void B. int C. double D. short int 29. What is the output of this C code? int foo(); int main() { int i = foo(); } foo() { printf("2 "); return 2; } A. 2 B. Compile time error C. Depends on the compiler D. Depends on the standard 30. functions can return structure in c? A. true B. false C. Depends on the compiler D. Depends on the standard 31. functions can return enumeration constants in c? A. true B. false C. depends on the compiler D. depends on the standard 32. Which keyword can be used for coming out of recursion? A. break B. return C. exit D. Both (a) and (b) 33. What is the output of this C code? int main() { int a = 0, i = 0, b; for (i = 0;i < 5; i++) { a++; continue; } } A. 2 B. 3 C. 4 D. 5 34. Which keyword is used to come out of a loop only for that iteration? A. break B. continue C. return D. None of the mentioned 35. What is the output of this C code? 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 36. What is the output of this C code? void main() { double k = 0; for (k = 0.0; k < 3.0; k++); printf("%lf", k); } A. 2.000000 B. 4.000000 C. 3.000000 D. Run time error 37. typedef which of the following may create problem in the program? A. ; B. printf/scanf C. Arithmetic operators D. All of the mentioned. 38. typedef declaration: A. Does not create a new type B. It merely adds a new name for some existing type. C. Both a & b D. None of the mentioned 39. What is the output of this C code? typedef struct p { int x, y; }k; int main() { struct p p = {1, 2}; k k1 = p; printf("%d\n", k1.x); } A. Compile time error B. 1 C. 0 D. Depends on the standard 40. The following query belongs to which condition types? SELECT fname FROM person WHERE dept_id=(SELECT dept_id FROM department WHERE names=’s’); A. Equality condition B. Inequality condition C. Range condition D. All of the mentioned