Multiple choice technology testing

What must be the naming convention followed in defining constants and variables?

  1. Cons: Path_Dir, Vari: path_dir

  2. Cons: PATH_DIR, Vari: path_dir

  3. Cons: Path_Dir, Vari: PATH_DIR

  4. Cons: PATH_dir, Vari: path_DIR

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

The standard naming convention across programming languages is that constants use ALL_CAPS_WITH_UNDERSCORES (PATH_DIR) while variables use lowercase_with_underscores (path_dir). This makes constants easily distinguishable from variables in code and improves readability.