Bird
0
0

What is wrong with this array declaration?

medium📝 Debug Q14 of 15
Bash Scripting - Arrays
What is wrong with this array declaration?
myarray=(one two three four five six seven eight nine ten
AArray name is invalid
BValues should be quoted
CMissing closing parenthesis
DValues must be comma separated
Step-by-Step Solution
Solution:
  1. Step 1: Check array syntax completeness

    The declaration starts with '(' but does not have a closing ')'.
  2. Step 2: Verify other syntax rules

    Values do not need quotes if no spaces, array name is valid, commas are not used in Bash arrays.
  3. Final Answer:

    Missing closing parenthesis -> Option C
  4. Quick Check:

    Parentheses must open and close [OK]
Quick Trick: Always close parentheses in array declaration [OK]
Common Mistakes:
MISTAKES
  • Forgetting the closing parenthesis
  • Adding commas between values
  • Quoting values unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes