Cloud & DevOps · Question 29 · Hard
What does this shell pipeline print?
printf "3\n10\n2\n" | sort | head -1
- 2
- 3
- An error, because sort needs the -n option for numbers
- 10
Answer and explanation
Answer: D. 10
Explanation: Without -n, sort compares lines as text, character by character. '1' sorts before '2' and '3', so 10 comes first. sort -n would put 2 first.
Previous: When does a cron job with the schedule 30 2 * * 1 run? · Next: What does this shell command print?
Practise cloud & devops
Try a fresh set of cloud & devops questions with an explanation after every answer, free and without signing up: Cloud & DevOps practice. Or sit a full placement mock test.
More cloud & devops questions
- A service promises 99.9% availability per 30-day month. What is the maximum…
- A request must pass through a web server and then a database server, and both…
- When does a cron job with the schedule 30 2 * * 1 run?
- What does this shell command print?
More technical & programming practice
GenAI Basics · Pseudo-code · C Programming · Java · Python · Data Structures · Algorithms · Object-Oriented Programming
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge