multiple_choice
medium
Apply
pipeline-distinct
2 points
Question 15. CSCD240-E1-C
Which pipeline counts distinct values in column 1 of a CSV?
Work the drill
Answer on paper or in a terminal before revealing the ideal answer.
Ideal answer
B: cut -d, -f1 f | sort -u | wc -l
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.
A: cut -d, -f1 f | uniq | wc -l
Misconception. Missing sort; uniq sees non-adjacent dupes.
Remedy. Always sort before uniq.
C: sort f | cut -d, -f1 | wc -l
Misconception. Sort comes before cut; deduplicates whole lines then extracts — may still have dupes in col 1 when other cols differ.
Remedy. Extract first, then dedupe.
D: awk '{print $1}' f | wc -l
Misconception. Counts all values, not distinct.
Remedy. Need sort -u step.
Authority mappings
Hover any chip for the mapping justification; click to open the authority record.
DCWF roles:
CS-511 Cyber Defense Analyst
DCWF tasks:
T0259
KU outcomes:
CO-M9-O1
O*NET tasks:
SOC 15-1212.00: task 6SOC 15-1212.00: task 7SOC 15-1244.00: task 1SOC 15-1244.00: task 2
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: Use wc -l, head -n 5, tail -n 5, cut -d, -f 2 on a CSV.