NCAE Mapping Hub
Overview Scoreboard Data Roles Exercised Checklists Lessons Skill Drills Practice Terminal Progress
performance hard Apply grep-recursive 2 points

Question 14. CSCD240-E1-A

Show the filenames containing "printf" in all .c files in home directory and subdirs.

Work the drill

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

Ideal answer
grep -rl printf ~/ --include="*.c"
Acceptable alternatives: ["grep -r --include=\"*.c\" -l printf ~/", "find ~ -name \"*.c\" -exec grep -l printf {} \\;"]

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.

grep -r printf ~/
Misconception. Missing --include filter; will return matches from non-.c files too.
Remedy. Teach --include="*.c" or use find piping.
grep printf ~/*.c
Misconception. Not recursive; only searches top-level *.c, not subdirs.
Remedy. Highlight: -r/-R flag enables recursion.
grep -r -i printf ~/ --include="*.c"
Misconception. Added -i (case-insensitive) not requested — may match Printf, PRINTF.
Remedy. Read the question literally: "printf" (case-sensitive).

Authority mappings

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

DCWF tasks: T0259 T0447
KU outcomes: CD-BSP-O6CO-M9-O1
KU topics: CD-BSP-T3
NCAE errors: SSH Login / failure: Failed to connect to host: IPSSH Login / partial: The following users failed t.SSH Login / partial: The following users failed t.

Course-artifact links

Lectures

  • CSCD240-S26-L08. Pipes, filters, grep, sort, uniq, wc, tar

Lab questions

  • CSCD240-S26-LAB5: grep -i, grep -n, grep -v, grep -c, grep -r on a log file.