levo

Advanced Data Structures and Logic

Masking, clearing registers and encryption

  • 3 things to know
  • A2 Unit 3
Start revising · £5/month

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.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

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

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

Fetch, , execute.
decodecompilestore

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

A bit is a single binary digit.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

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.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

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