Which of the following is a valid variable name?
Select one:
a. ID#
b. _Edu2
c. Carat Weight
d. 5Years
Variable name are basically a container for storing the data variables. Every language has some rules for declaring the variable names which differ from language to language. But the rules which are mostly common are -
1) the name must start with the a letter or underscore character and not with any number or special character.
2) a name can contain only alphanumeric characters or underscores and no extra space in between characters.
3) names are case sensitive.
SO from these rules it's clear that the valid variable name is - option B which is _Edu2.
If you look at the other options option a it has a special character # which makes it invalid variable. Also option c is invalid as it has space in between words. Option D is wrong as its starting with a number. So the only correct option is b.
Get Answers For Free
Most questions answered within 1 hours.