Variables & Expansion interview questions

18 real Variables & Expansion questions from the Bash bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is Variable assignment?

Junior
  1. A.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  2. B.retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
  3. C.a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
  4. D.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
Reveal the answer + AI explanation — free account

2. Which term means: "binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command"?

Junior
  1. A.Double quoting
  2. B.Parameter expansion
  3. C.Command substitution
  4. D.Variable assignment
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.Variable assignment — a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  2. B.Variable assignment — a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  3. C.Variable assignment — binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  4. D.Variable assignment — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
Reveal the answer + AI explanation — free account

4. What is Command substitution?

Junior
  1. A.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  2. B.a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  3. C.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  4. D.a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
Reveal the answer + AI explanation — free account

5. Which term means: "a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses"?

Junior
  1. A.Double quoting
  2. B.Default value expansion
  3. C.Parameter expansion
  4. D.Command substitution
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.Command substitution — a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  2. B.Command substitution — binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  3. C.Command substitution — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  4. D.Command substitution — a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
Reveal the answer + AI explanation — free account

7. What is Parameter expansion?

Mid
  1. A.retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
  2. B.a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  3. C.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  4. D.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
Reveal the answer + AI explanation — free account

8. Which term means: "retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal"?

Mid
  1. A.Variable assignment
  2. B.Double quoting
  3. C.Parameter expansion
  4. D.Command substitution
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.Parameter expansion — binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  2. B.Parameter expansion — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  3. C.Parameter expansion — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
  4. D.Parameter expansion — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
Reveal the answer + AI explanation — free account

10. What is Single quoting?

Junior
  1. A.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  2. B.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  3. C.a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  4. D.a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
Reveal the answer + AI explanation — free account

11. Which term means: "a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all"?

Junior
  1. A.Single quoting
  2. B.Variable assignment
  3. C.Double quoting
  4. D.Parameter expansion
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Junior
  1. A.Single quoting — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
  2. B.Single quoting — a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  3. C.Single quoting — a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  4. D.Single quoting — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
Reveal the answer + AI explanation — free account

13. What is Double quoting?

Junior
  1. A.a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  2. B.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  3. C.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  4. D.a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
Reveal the answer + AI explanation — free account

14. Which term means: "a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside"?

Junior
  1. A.Variable assignment
  2. B.Parameter expansion
  3. C.Command substitution
  4. D.Double quoting
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Junior
  1. A.Double quoting — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
  2. B.Double quoting — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
  3. C.Double quoting — binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  4. D.Double quoting — a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
Reveal the answer + AI explanation — free account

16. What is Default value expansion?

Mid
  1. A.retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
  2. B.a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  3. C.binding a name to a value with the equals sign, which must have no surrounding whitespace or the shell treats the name as a command
  4. D.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
Reveal the answer + AI explanation — free account

17. Which term means: "a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback"?

Mid
  1. A.Default value expansion
  2. B.Double quoting
  3. C.Command substitution
  4. D.Parameter expansion
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.Default value expansion — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
  2. B.Default value expansion — a brace form that yields a fallback string when a parameter is unset or empty, written with a colon-dash between name and fallback
  3. C.Default value expansion — a construct that runs a command and replaces itself with that command's output, written with a dollar sign followed by parentheses
  4. D.Default value expansion — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Variables & Expansion free