levo

Advanced Data Structures and Logic

Masking, clearing registers and encryption

  • 3 things to know
  • A2 Unit 3

Overview

Recall questions on why a bitwise operation covers a whole register at once, extracting the upper nibble, setting and inverting chosen bits, clearing a register, testing for an even number, XOR encryption worked in binary, extracting a colour component, and the weakness of a short repeating key.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Explain how a logical operation tests whether a whole number held in a register is even.

Key term

Why can a bitwise operation be applied to a whole register in a single instruction rather than one bit at a time?

Key term

Which operation and mask force bit 3 of a byte to 1 without disturbing any other bit?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Why can a bitwise operation be applied to a whole register in a single instruction rather than one bit at a time?

    Model answer

    Every bit position has its own logic gate and all of them operate at once, so the whole word is processed within one machine cycle.

  2. 2

    Which operation and which mask extract the upper four bits of a byte, and what must follow?

    Model answer

    The byte is ANDed with 11110000 in binary, and the result is then shifted right four places so that the nibble sits in the low bits.

  3. 3

    Calculate 11010110 AND 11110000, giving the result in binary and in denary.

    Model answer

    The result is 11010000 in binary, which is 208 in denary.

  4. 4

    Which operation and mask force bit 3 of a byte to 1 without disturbing any other bit?

    Model answer

    The byte is ORed with 00001000 in binary, which sets that bit while leaving every bit paired with a 0 unchanged.

  5. 5

    Which operation and mask invert the lower nibble of a byte while leaving the upper nibble alone?

    Model answer

    The byte is XORed with 00001111 in binary, because XOR with 1 inverts a bit while XOR with 0 reproduces it.

  6. 6

    State the quickest way a processor can force a register to zero using a logical operation, and explain why it works.

    Model answer

    The register is XORed with itself, because every bit is then paired with a copy of itself and XOR of two equal bits is 0.

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.

Hardware: Architecture, Memory and Storage
Networks and Data Transmission
Logic Gates and Boolean Algebra
Data Representation and Data Types

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.

Fetch, , execute.
decodecompilestore

Blank Blitz makes facts automatic

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

AEncryption is reversible.
BThe stored form could be decrypted.
CA hash cannot be reversed.

Build It gets the exam shape right

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

A bit is a single binary digit.
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 Advanced Data Structures and Logic, 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.