Rapid-fire basics · Full-pass trainer

Every value. Every direction.

One operation at a time. Work through every byte value, keep your place, and build fluency one rep at a time.

Choose your focus

Build up in this order, or jump in.

Definition questions always use choices. A complete pass is available when you choose one question type. Starting a new drill replaces the saved session; your topic totals and missed questions stay.

Your practice totals

Saved on this browser. Counts describe practice, not a guarantee of mastery.

Quick reference · open when you need a reminder

Read the bits

bit:    7   6  5  4  3  2  1  0
weight:128 64 32 16  8  4  2  1

Add the weights of the 1 bits. In signed 8-bit two’s complement, replace the 128 weight with −128.

Upper four bits: 1010 0000 = 128 + 32 = 160. 1011 0000 = 128 + 32 + 16 = 176. These are unsigned readings.

Binary → hex: split into groups of four bits from the right. Hex → binary: expand each digit into four bits.

Hex digits

Two’s complement

8-bit signed range: −128 to 127. Unsigned: 0 to 255.

Decode a leading 1: unsigned value − 256. Encode a negative value: 256 + value. To negate the bit pattern: flip all eight bits and add 1, keeping eight bits.

11111111 = −1 signed or 255 unsigned. 01111111 = 127.

Operations

& both bits 1 · | either bit 1 · ^ bits differ · ~ flips bits.

&& both true · || either true · ! reverses truth. Zero is false; every nonzero value is true. Results are 0 or 1.

Left shift by k: multiply by 2k. Unsigned right shift: divide by 2k, round down. Only discard at 8 bits when the question explicitly says so.

C assumptions & type-size reference

Byte exercises use 8 bits; signed byte patterns use two’s complement. Type-size drills use the model below. These sizes are assumptions, not universal C guarantees.

TypeBytes in this modelBits
char, signed char, unsigned char18
short216
int, float432
long, long long, double, pointers864

C questions use C17 semantics and state any additional assumptions. Plain char signedness varies. Character-code questions explicitly assume ASCII. Small integer types can be promoted before arithmetic. In C, ~ and shifts do not automatically stop at eight bits.

Arithmetic right shifts are labelled as a sign-extending model; C17 leaves a negative signed right shift implementation-defined. A shift count at least as large as the promoted left operand’s width is undefined.

Language reference: WG14 C11 committee draft, §§6.3.1.1, 6.5.3, 6.5.7 and 6.5.10–14 (the relevant rules also apply in C17).