Build a Database from Scratch
- 29Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
29 questions
- 1MySQL creates a_____for each database within its data directory.
Hint
Think about how files are organized on a file system.
Answer
folder
- 2A table file in MySQL stores both the table data and the_____for the primary key.
Hint
This structure speeds up searching by primary key.
Answer
index
- 3Using_____format for storing table data complicates random access because row boundaries must be found linearly.
Hint
This common data format uses delimiters like commas.
Answer
CSV
- 4To make rows the same size in a file, strings are forced to have a_____number of characters.
Hint
This ensures each string field occupies a fixed byte count.
Answer
maximum
- 5In the fixed-size row format, each row uses 4 bytes for the primary key, 1 byte for string length, and 255 bytes for the string, totaling_____bytes.
Hint
Add the three components together.
Answer
260
- 6Linear search through a file has time complexity_____while indexed search is O(log n).
Hint
Think about how time grows with the number of rows.
Answer
O(n)
- 7A_____index suffers from the problem of becoming a linked list if keys are inserted in ascending order.
Hint
This common data structure has at most two children per node.
Answer
binary tree
- 8In a B-Tree, each node can have more than two children, and the maximum number of keys in a node is given by the formula_____where C is the minimum number of children.
Hint
If C=2, max keys would be 3.
Answer
2C-1
- 9When a B-Tree node reaches its maximum number of keys, the_____key is moved up to the parent during insertion.
Hint
This key is the middle one in sorted order.
Answer
median
- 10When splitting a full B-Tree node, the node is divided into two nodes, and a new_____is created if the current node is the root.
Hint
This node has no parent.
Answer
root
- 11To store a B-Tree on disk, each node is stored in a single_____of data.
Hint
Reading from disk happens in fixed-size chunks.
Answer
block
- 12In a B-Tree stored on disk, children pointers are represented as_____numbers.
Hint
These numbers are sequential offsets into the file.
Answer
block
- 13The database introduces its own storage unit called a_____which may consist of one or more disk blocks.
Hint
It's larger than a block and its size is defined by the database.
Answer
page
- 14A_____page stores variable-length data by using a slot array at the beginning and cells at the end.
Hint
The term describes a method for efficient insertion and binary search.
Answer
slotted
- 15In a slotted page, each slot in the array is a 2-byte_____that points to the corresponding cell.
Hint
It indicates the position of the cell within the page.
Answer
offset
- 16In index-organized storage, tables are stored as_____sorted by the primary key.
Hint
This data structure is used for both the table and indexes.
Answer
B-Trees
- 17When a row exceeds a predefined size threshold, the database uses_____pages to store the remaining data.
Hint
These pages form a linked list.
Answer
overflow
- 18The SQL parser converts a string into an_____(AST) representing the statement.
Hint
This tree structure captures the syntax hierarchy.
Answer
Abstract Syntax Tree
- 19The_____performs context-dependent analysis like checking if a table exists or if data types match.
Hint
It runs after parsing to validate semantics.
Answer
analyzer
- 20The query plan uses the_____model, where each node is an iterator that returns one tuple at a time via .next() calls.
Hint
This pattern processes tuples one by one without loading all into memory.
Answer
iterator
- 21Picking specific columns from a row in relational algebra is called_____.
Hint
It reduces the number of attributes.
Answer
projection
- 22The_____plan collects all tuples from its source into a fixed-size memory buffer and writes to a temporary file when full.
Hint
This plan supports operations that need the entire dataset, like sorting.
Answer
collect
- 23The algorithm used for sorting large datasets that do not fit in RAM is called_____.
Hint
It works in passes using multiple input buffers.
Answer
K-Way External Merge Sort
- 24In the K-Way External Merge Sort, each pass multiplies the run size by_____.
Hint
With K=2, runs double each pass.
Answer
K
- 25The cache replacement policy used in MKDB is the_____algorithm.
Hint
It uses a circular array and reference bits.
Answer
clock
- 26In the clock algorithm, when a page is modified, its_____bit is set to 1.
Hint
This indicates the page needs to be written back to disk.
Answer
dirty
- 27To implement rollback, the database writes the original contents of pages to a_____before modifying them.
Hint
This file stores a copy of the original data.
Answer
journal file
- 28Committing a transaction in the journal-based approach involves simply_____the journal file.
Hint
Once committed, the journal is no longer needed.
Answer
deleting
- 29MKDB uses a network protocol inspired by_____.
Hint
This popular in-memory data store has a simple text-based protocol.
Answer
Redis

Ask anything
We've read this whole study set, so questions about it get the best answers.