Card library
Every card, and your own.
Cards from lessons you haven't added yet are listed as off.
Write your own card
0x00
How many distinct values can n bits represent?
off
0x00
Range of
u8 and of i8?off
0x00
The byte
0xFF read as u8 and as i8?off
0x00
How do you negate a two's complement number by hand?
off
0x00
Why do CPUs use two's complement for signed integers?
off
0x00
How many bits does one hex digit represent?
off
0x00
Zero extension vs sign extension?
off
0x00
In Zig, what happens when a
u8 holding 255 gets + 1 at runtime?off
0x00
@intCast vs @truncate vs @bitCast?off
0x00
Convert
0000_1101 to decimal.off
0x00
Convert 200 to binary.
off
0x00
What is the sign bit?
off
0x00
Convert
0000_1101 to decimal.off
0x00
Convert 200 to binary.
off
0x00
What is the sign bit?
off
0x01
At the machine level, what is a pointer?
off
0x01
Bytes of the
u32 0x11223344 in memory, lowest address first, on x86-64?off
0x01
What is network byte order?
off
0x01
What does an alignment of N require?
off
0x01
Size of
extern struct { a: u8, b: u32, c: u8 }, and why?off
0x01
Why do structs get tail padding?
off
0x01
Zig
struct vs extern struct vs packed struct?off
0x01
Which builtins inspect a type's layout in Zig?
off
0x01
What do
&x and p.* mean in Zig?off
0x01
Why are all pointers on a 64-bit machine the same size?
off
0x01
Why can a misaligned value be slow, or crash?
off
0x01
What do
&x and p.* mean in Zig?off
0x01
Why are all pointers on a 64-bit machine the same size?
off
0x01
Why can a misaligned value be slow, or crash?
off
0x02
What does the instruction pointer (
rip) hold?off
0x02
Describe the CPU's basic cycle.
off
0x02
How many general-purpose registers does x86-64 have?
off
0x02
What is an ISA?
off
0x02
What does the flags register record?
off
0x02
What does a branch misprediction cost, and why?
off
0x02
What is
cmov and why do compilers like it?off
0x02
How can you see the assembly Zig generates?
off
0x02
What is assembly?
off
0x02
How do
if and loops work at the machine level?off
0x02
What is a clock cycle?
off
0x02
What is assembly?
off
0x02
How do
if and loops work at the machine level?off
0x02
What is a clock cycle?
off
0x03
Which way does the x86-64 stack grow?
off
0x03
What exactly do
call and ret do?off
0x03
What's in a stack frame?
off
0x03
Why is stack allocation nearly free?
off
0x03
Why is returning a pointer to a local variable a bug?
off
0x03
System V x86-64: which registers carry the first six integer arguments?
off
0x03
Which registers are callee-saved in System V x86-64?
off
0x03
Typical main-thread stack size on Linux?
off
0x03
Why is the call stack a stack (last in, first out)?
off
0x03
What stops a stack overflow from corrupting other memory?
off
0x03
Three fixes for returning a pointer to a local variable?
off
0x03
Why is the call stack a stack (last in, first out)?
off
0x03
What stops a stack overflow from corrupting other memory?
off
0x03
Three fixes for returning a pointer to a local variable?
off
0x04
When must data live on the heap rather than the stack?
off
0x04
How does glibc's
malloc get memory from the Linux kernel?off
0x04
What is a bump (arena) allocator?
off
0x04
What is heap fragmentation?
off
0x04
Name the three classic manual memory bugs.
off
0x04
Does
free usually return memory to the OS?off
0x04
What is a pool allocator good for?
off
0x04
What does a garbage collector do that Zig leaves to you?
off
0x04
Why don't allocators ask the OS for memory on every small allocation?
off
0x04
What does a garbage collector do that Zig leaves to you?
off
0x04
Why don't allocators ask the OS for memory on every small allocation?
off
0x05
Cache line size on x86-64?
off
0x05
Rough latency of an L1 hit vs a trip to RAM?
off
0x05
Spatial vs temporal locality?
off
0x05
Why is walking a 2D array row by row faster than column by column?
off
0x05
Why are linked lists cache-unfriendly?
off
0x05
Array of structs vs struct of arrays, and Zig's tool for the latter?
off
0x05
What is false sharing?
off
0x05
What is a cache hit vs a cache miss?
off
0x05
What does the hardware prefetcher do?
off
0x05
What is a cache hit vs a cache miss?
off
0x05
What does the hardware prefetcher do?
off
0x06
What does the MMU do?
off
0x06
Typical page size on x86-64?
off
0x06
What is the TLB?
off
0x06
The two outcomes of a page fault?
off
0x06
Why does dereferencing null crash reliably?
off
0x06
Why can
mmap of a huge region return instantly?off
0x06
What are
.text, .data and .bss?off
0x06
Where do the heap and stack sit, and which way does each grow?
off
0x06
What does virtual memory give you?
off
0x06
Which part of a virtual address gets translated?
off
0x06
What does virtual memory give you?
off
0x06
Which part of a virtual address gets translated?
off
0x07
What is a system call?
off
0x07
x86-64 Linux: where do the syscall number and result go?
off
0x07
Syscall argument registers on x86-64 Linux, and the odd one out?
off
0x07
Syscall numbers of
write and exit on x86-64 Linux?off
0x07
What are file descriptors 0, 1 and 2?
off
0x07
Process vs thread?
off
0x07
Which tool shows a program's syscalls on Linux?
off
0x07
Why does switching processes cost more than switching threads?
off
0x07
What are user mode and kernel mode?
off
0x07
Why do I/O libraries buffer output?
off
0x07
What does a shell set up for
cat a | grep x?off
0x07
What are user mode and kernel mode?
off
0x07
Why do I/O libraries buffer output?
off
0x07
What does a shell set up for
cat a | grep x?off
0x08
const vs var in Zig?off
0x08
What does
undefined mean, and how does Debug mode help?off
0x08
How do you silence an unused local variable error?
off
0x08
Which implicit integer conversions does Zig allow?
off
0x08
Name the four build modes and which keep safety checks.
off
0x08
How does a labeled block return a value?
off
0x08
What does "no hidden control flow" mean in Zig?
off
0x08
zig run file.zig vs zig test file.zig?off
0x08
What does
@import("std") do, and what does the @ mean?off
0x08
Format specifiers
{s}, {d} and {x} in std.debug.print?off
0x08
What is
p.length() shorthand for, when length is declared in struct Point?off
0x08
What does
@import("std") do, and what does the @ mean?off
0x08
Format specifiers
{s}, {d} and {x} in std.debug.print?off
0x08
What is
p.length() shorthand for, when length is declared in struct Point?off
0x09
*T vs [*]T vs []T?off
0x09
@sizeOf([]u8) on a 64-bit machine?off
0x09
How do you dereference a pointer
p in Zig?off
0x09
Type of the string literal
"hello"?off
0x09
Which elements does
arr[1..3] include?off
0x09
What does
[:0]u8 mean?off
0x09
Size of
?*T compared to *T?off
0x09
Out-of-bounds slice index in Debug vs ReleaseFast?
off
0x09
How do you compare two strings in Zig?
off
0x09
Can a plain
*T be null in Zig?off
0x09
What does
arr[2..] mean?off
0x09
How do you compare two strings in Zig?
off
0x09
Can a plain
*T be null in Zig?off
0x09
What does
arr[2..] mean?off
0x0A
What does
try foo() expand to?off
0x0A
defer vs errdefer?off
0x0A
In what order do multiple
defers run?off
0x0A
E!T vs ?T?off
0x0A
Three ways to unwrap an optional
opt?off
0x0A
What is an error return trace?
off
0x0A
What does
fn f() !void mean?off
0x0A
Why put
errdefer right after an allocation?off
0x0A
How is Zig's error handling different from JavaScript exceptions?
off
0x0A
When should you use an optional instead of an error?
off
0x0A
How is Zig's error handling different from JavaScript exceptions?
off
0x0A
When should you use an optional instead of an error?
off
0x0B
Why does Zig pass allocators explicitly?
off
0x0B
What is
std.mem.Allocator internally?off
0x0B
alloc/free vs create/destroy?off
0x0B
When is an
ArenaAllocator a good fit?off
0x0B
What does
FixedBufferAllocator do?off
0x0B
Which allocator makes a test fail on a leak?
off
0x0B
What was
DebugAllocator called before Zig 0.14?off
0x0B
How do you append to a Zig 0.15
std.ArrayList?off
0x0B
Is memory from
gpa.alloc zeroed?off
0x0B
Why can an
ArenaAllocator skip individual frees?off
0x0B
Which error can every allocation return?
off
0x0B
Is memory from
gpa.alloc zeroed?off
0x0B
Why can an
ArenaAllocator skip individual frees?off
0x0B
Which error can every allocation return?
off
0x0C
How does Zig do generics?
off
0x0C
What does
@This() return?off
0x0C
Which features from other languages does
comptime replace?off
0x0C
What is
anytype?off
0x0C
Why use
inline for?off
0x0C
Are container-level
const initializers evaluated at compile time?off
0x0C
What does
@typeInfo(T) give you?off
0x0C
What's the difference between compile time and runtime?
off
0x0C
What does
@field(p, "x") do?off
0x0C
What's the difference between compile time and runtime?
off
0x0C
What does
@field(p, "x") do?off
0x0D
How do you use a C header from Zig?
off
0x0D
What is
zig cc?off
0x0D
What does
export fn do?off
0x0D
Bit layout of
packed struct(u8) { a: bool, b: bool, rest: u6 }?off
0x0D
Why mark an MMIO pointer
volatile?off
0x0D
How do you turn an integer address into a pointer in Zig?
off
0x0D
What is
[*c]T?off
0x0D
What is an ABI?
off
0x0D
What is memory-mapped I/O?
off
0x0D
What is an ABI?
off
0x0D
What is memory-mapped I/O?
off
Back up or move your progress
Your progress is saved in this browser only, under zig-under-the-hood/v1. Copy it as text to
keep a backup or move it to another browser, then paste it back here. Restoring replaces what you
have now.