Computer Science I / Conditionals and Logical Branching
Practice question · True or false

With short-circuit evaluation, in the expression A or B, if A is true then B is still always evaluated.

Hints
  1. Ask whether the result is already decided once A is known to be true.
  2. A true left side of 'or' fixes the whole expression as true.
Show the answer

False

Why

False. If A is true, A or B is already true, so B is skipped, the mirror image of 'and' short-circuiting on a false left side. This is exactly why a guard like 'x is not zero or safe_to_divide(x)' can protect the right-hand call.

Read the lesson: Conditionals and Logical Branching →

Practise Conditionals and Logical Branching

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Conditionals and Logical Branching