Here is a listing of C interview questions on “Variable Names” along with answers, explanations and/or solutions:
1. C99 standard guarantees uniqueness of ____ characters for internal names.
Explanation:ISO C99 compiler may consider only first 63 characters for internal.
2. C99 standard guarantess uniqueness of _____ characters for external names.
Explanation:ISO C99 compiler may consider only first 31 characters for external
variables having 31 characters due to which it may not be unique.
3. 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
4. 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
Explanation:Variable name cannot start with a digit.
5. Variable names beginning with underscore is not encouraged. Why?
a) It is not standardized
b) To avoid conflicts since assemblers and loaders use such names
c) To avoid conflicts since library routines use such names
d) To avoid conflicts with environment variables of an operating system
6. All keywords in C are in
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
7. 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
Explanation:It depends on the standard to which compiler and linkers are adhering to.
8. Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
Explanation:Since only underscore and no other special character is allowed in a variable name, it results in an error.
9. Which of the following is true for variable names in C?
a) They can contain alphanumeric characters as well as special characters
b) It is not an error to declare a variable to be one of the keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length
Explanation:According to the syntax for C variable name, it cannot start with a digit.
To practice all features of C programming language, here is complete set of 1000+ Multiple Choice Questions and Answers on C.