Variables & Expansion interview questions

18 Variables & Expansion questions from the Bash bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Variables & Expansion question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers