22.9k views
4 votes
Which of the following is not a legal variable name? a. firstname

a) first_name
b) first_name1
c) 1firstname
d) firstName

User Dan Beam
by
9.2k points

1 Answer

3 votes

Final answer:

Option d) 1firstnamed is not a legal variable name because it starts with a number, which violates programming naming conventions.

Step-by-step explanation:

The question pertains to the rules for naming variables in programming. In programming, variable names must begin with a letter (a-z, A-Z) or an underscore (_), and cannot start with a number. Therefore, among the options provided:

  • a. firstname is a legal variable name.
  • b) first_name is a legal variable name.
  • c) first_name1 is a legal variable name.
  • d) 1firstnamed is not a legal variable name because it violates the rule that a variable name cannot start with a number.

So the answer is d) 1firstnamed, since it starts with a number.

User Mcnesium
by
8.8k points