NCAE Mapping Hub
Overview Scoreboard Data Roles Exercised Checklists Lessons Skill Drills Practice Terminal Progress
essay medium Understand quoting 2 points

Question 31. CSCD240-E1-A

var="Stu Steiner". A) echo "Hello $var" B) echo 'Hello $var'. Explain difference and output.

Work the drill

Answer on paper or in a terminal before revealing the ideal answer.

Ideal answer
A prints "Hello Stu Steiner" (double quotes expand $var). B prints "Hello $var" (single quotes are literal).

Misconception bank

Each row below is a plausible wrong answer, the thinking that produces it, and the remedy that corrects the misconception. These are the foundation of the multiple-choice framing and the targeted feedback a student receives after answering.

Both print "Hello Stu Steiner"
Misconception. Student treats both quote types identically.
Remedy. Demo both forms side-by-side in terminal. Flash-card the rules.
Both print "Hello $var"
Misconception. Opposite error — thinks both are literal.
Remedy. Double quotes WILL expand. Only single quotes suppress.
A = "Hello $var", B = "Hello Stu Steiner"
Misconception. Reversed.
Remedy. Mnemonic: "double = dollar". Single quotes lock the value.

Authority mappings

Hover any chip for the mapping justification; click to open the authority record.

DCWF tasks: T0498
KU outcomes: CD-BSP-O1CO-M5-O2
KU topics: CD-BSP-T8a
NCAE errors: WWW Content / failure: Failed to connect to hostWWW Content / timeout: TimeoutWWW Content / failure: Website cannot be reached

Course-artifact links

Lectures

  • CSCD240-S26-L07. I/O redirection, aliases, source, .bashrc, env

Lab questions

  • CSCD240-S26-LAB4: Set var="Stu Steiner". Show echo "$var" and echo '$var'.
  • CSCD240-S26-LAB5: Test NAME=world and all three echo forms.

CTF challenges

  • 04 Environment & Patterns: Literal vs Expanded
  • 04 Environment & Patterns: Its a trap