39.8k views
4 votes
Which of the following are legal variable names in programming?

a) dayOfWeek
b) 3dGraph
c) june1997
d) mixture#3
e) wek day

1 Answer

2 votes

Final answer:

From the list provided, 'dayOfWeek' and 'june1997' are legal variable names in programming because they start with letters and contain no illegal characters or spaces.

Step-by-step explanation:

The student's question concerns identifying the legal variable names in programming. When declaring variable names, there are general rules that most programming languages typically follow. Here is a breakdown of the options provided:

  • dayOfWeek: This is a legal variable name. It starts with a letter and contains no illegal characters or spaces.
  • 3dGraph: This is not a legal variable name because it starts with a number.
  • june1997: This is a legal variable name because it starts with a letter and contains letter and numeric characters without any spaces or special symbols.
  • mixture#3: This is not a legal variable name due to the inclusion of the '#' symbol, which is usually not allowed.
  • week day: This is not a legal variable name because it contains a space, which is not allowed in variable names.

Therefore, the legal variable names from the list provided are 'dayOfWeek' and 'june1997'.

User Jim Skerritt
by
8.6k points