Bird
0
0

Which of the following is the correct way to declare an associative array named user_info in Bash?

easy📝 Syntax Q3 of 15
Bash Scripting - Arrays
Which of the following is the correct way to declare an associative array named user_info in Bash?
Adeclare user_info
Bdeclare -a user_info
Cdeclare -A user_info
Ddeclare -i user_info
Step-by-Step Solution
Solution:
  1. Step 1: Understand declare options

    -a declares indexed arrays, -i declares integers, -A declares associative arrays.
  2. Step 2: Match with associative array

    Only declare -A user_info correctly declares an associative array.
  3. Final Answer:

    declare -A user_info -> Option C
  4. Quick Check:

    declare -A = associative array declaration [OK]
Quick Trick: Use declare -A for associative arrays [OK]
Common Mistakes:
MISTAKES
  • Using -a for associative arrays
  • Omitting the -A option
  • Using -i which is for integers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes