Multiple choice technology programming languages

Which of the following are legal identifiers?

  1. 2variable

  2. variable2

  3. _whatavariable

  4. 3

  5. #myvar

  6. $anothervar

Reveal answer Fill a bubble to check yourself
B,C,D,F Correct answer
Explanation

In most programming languages (Java, C, etc.), valid identifiers cannot start with a digit or contain special characters like #. They can contain letters, digits, underscores, and in some languages like Java, the dollar sign. 'variable2', 'whatavariable', '_3', and '$anothervar' are all valid.