Multiple choice general knowledge

Which one is an illegal variable name in MATLAB?

  1. dog1

  2. under_dog

  3. underdog

  4. 1dog

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

MATLAB variable names must start with a letter, followed by letters, digits, or underscores. '1dog' starts with a digit, making it illegal. Options A, B, and C all start with letters and are valid variable names (dog1, under_dog, underdog).