Cloud & DevOps · Question 12 · Hard

What does this shell pipeline print? Ignore any leading spaces.

printf "b\na\nb\nc\na\nb\n" | sort | uniq -c | sort -rn | head -1
  1. 2 a
  2. 3 b
  3. 1 c
  4. 3 a
Answer and explanation

Answer: B. 3 b

Explanation: sort groups identical lines, and uniq -c counts them: 2 a, 3 b, 1 c. sort -rn orders the counts in descending numeric order, and head -1 keeps the top line, "3 b".

Previous: What is the difference between Continuous Delivery and Continuous Deployment? · Next: The file server.log contains these four lines: ERROR disk full INFO ok ERROR…

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

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