Bird
0
0

Why does bash allow marking variables as readonly? Choose the best explanation.

hard🧠 Conceptual Q10 of 15
Bash Scripting - Variables
Why does bash allow marking variables as readonly? Choose the best explanation.
ATo allow variables to be shared between scripts
BTo improve script execution speed by locking variables
CTo prevent accidental changes to important variables during script execution
DTo enable variables to be unset automatically after use
Step-by-Step Solution
Solution:
  1. Step 1: Understand purpose of readonly variables

    Readonly variables protect critical values from accidental modification.
  2. Step 2: Evaluate other options

    Readonly does not affect speed, sharing, or automatic unset.
  3. Final Answer:

    To prevent accidental changes to important variables during script execution -> Option C
  4. Quick Check:

    Readonly protects variables from change [OK]
Quick Trick: Readonly prevents accidental variable changes [OK]
Common Mistakes:
MISTAKES
  • Thinking readonly improves speed
  • Confusing readonly with variable sharing
  • Assuming readonly unsets variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes