Type d'évaluation
Mise en situation réelle
Analyse
Intelligence Artificielle
Compétences ciblées
Scénario Technique
Context A developer wants a command-line script that accepts a filename as an argument and counts the number of lines in that file. The Problem The filename is currently hard-coded in the script, requiring a code change every time a different file needs to be processed. Constraints Read the filename from process.argv[2]. Display a usage message if no argument is provided. Use fs.promises to read the file and count line breaks. Handle file not found errors gracefully. Expected Deliverable A Node.js CLI script that accepts a filename argument, reads the file, counts and prints the number of lines, and handles missing arguments and file errors.
Prêt à évaluer ce talent ?
Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.