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
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
B.retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
C.a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
D.a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
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"?
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
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
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
D.Variable assignment — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
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"?
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
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
C.Command substitution — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
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
8. Which term means: "retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal"?
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
B.Parameter expansion — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
C.Parameter expansion — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
D.Parameter expansion — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
11. Which term means: "a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all"?
A.Single quoting — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
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
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
D.Single quoting — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
14. Which term means: "a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside"?
A.Double quoting — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
B.Double quoting — retrieving and optionally transforming a variable's value using brace syntax, supporting defaults, substring slicing, and pattern removal
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
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
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"?
A.Default value expansion — a quoting style that preserves every enclosed character literally, with no variable, history, or backslash interpretation at all
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
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
D.Default value expansion — a quoting style that prevents word splitting and globbing while still allowing variable and dollar-substitution to occur inside
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.