Cloud & DevOps · Question 30 · Hard

What does this shell command print?

false && echo A || echo B
  1. A
  2. B
  3. A, then B on the next line
  4. Nothing
Answer and explanation

Answer: B. B

Explanation: false exits with a non-zero status, so the && part (echo A) is skipped. The || part runs because the preceding command failed, so only B is printed.

Previous: What does this shell pipeline 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

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