levo

Fundamentals of Programming

Boolean operations

  • 1 thing to know
  • Paper 1

Overview

Recall questions on the NOT, AND, OR and XOR operations, how XOR differs from OR, evaluating them for given values, and writing compound conditions with them.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Process

Both P and Q are True. Which of P AND Q, P OR Q and P XOR Q are True?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What does the NOT operation do?

    Model answer

    It inverts a Boolean value: NOT True is False and NOT False is True. It is used to reverse a condition, for example WHILE NOT found.

  2. 2

    What does the AND operation do?

    Model answer

    It gives True only when both of its operands are True, and False in every other case. It is used when two conditions must hold at once, for example age >= 13 AND age <= 19.

  3. 3

    What does the OR operation do?

    Model answer

    It gives True when at least one of its operands is True, and False only when both are False. It is inclusive, so it is still True when both operands are True.

  4. 4

    What does the XOR operation do, and how does it differ from OR?

    Model answer

    Exclusive OR gives True when exactly one of its operands is True, and False when they are both True or both False. It differs from OR only in the both-True case, which OR calls True and XOR calls False. XOR is the 'one or the other but not both' operator, and it has the useful property that applying the same value twice returns the original.

  5. 5

    A is True and B is False. Evaluate NOT A, A AND B, A OR B and A XOR B.

    Model answer

    NOT A is False. A AND B is False, because B is not True. A OR B is True, because A is True. A XOR B is True, because exactly one of the two is True.

  6. 6

    Both P and Q are True. Which of P AND Q, P OR Q and P XOR Q are True?

    Model answer

    P AND Q is True and P OR Q is True, but P XOR Q is False, because exclusive OR requires exactly one operand to be True and here both are.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A driver is .
softwarehardwarestorage

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AThe integer 5 is 0101.
B0.75 is 1/2 + 1/4.
CThe fraction bits are 1100.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Head means the first single element of a non-empty list.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Fundamentals of Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.