Cloud & DevOps · Question 22 · Medium

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

printf "x\ny\nz\nx\ny\n" | sort -u | wc -l
  1. 3
  2. 5
  3. 2
  4. 1
Answer and explanation

Answer: A. 3

Explanation: The input has five lines: x, y, z, x, y. sort -u sorts them and keeps only unique lines (x, y, z), and wc -l counts 3 lines.

Previous: Which octal mode gives the permissions rw-r----- (owner read and write, group… · Next: A container is started with docker run -p 8080:80 nginx. What does the -p…

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