Quick Revision

GK One-Line Question & Answer

15541+ short questions with short answers, covering every category and sub-category on the site — no long articles to scroll through. Good for a fast recap before an exam, or a few minutes of daily practice.

DBMS → Introduction to DBMS 38

Pinning a buffer page means
Marking it as do-not-evict (currently in use)
click to copy
Multi-level index builds
Index on the index to reduce levels needed to find record
click to copy
Selectivity of a predicate is
Fraction of tuples satisfying the predicate (between 0 and 1)
click to copy
Equivalence rules in query optimization allow
Transforming one RA expression to another producing same result
click to copy
The iterator (volcano) model implements pipelining using
Open(), GetNext(), Close() interface on each operator
click to copy
Materialization in query processing
Fully computes and stores intermediate result before passing to next operator
click to copy
External sort complexity for n blocks, B buffer frames is approximately
O(n log_B n) passes
click to copy
ISAM supports
Both sequential access AND indexed access (but static overflow)
click to copy
Histogram in query optimizer stores
Distribution of attribute values for better cardinality estimation
click to copy
Why is sequential disk access faster than random?
No seek time or rotational latency between consecutive blocks
click to copy
Index seek vs index scan: index SEEK
Traverses B+tree to find specific key (fast for selective queries)
click to copy
Fill factor in index creation specifies
Percentage of each index page to fill leaving space for future inserts
click to copy
Linear hashing
Splits buckets incrementally in linear order without sudden doubling
click to copy
Extendible hashing solves static hashing by
Dynamically doubling directory size and splitting buckets as needed
click to copy
Double buffering allows
I/O of next block to overlap with CPU processing of current block
click to copy
The Selinger optimizer uses
Dynamic programming to find optimal join ordering with estimated costs
click to copy
Laravel Eloquent is
ORM using Active Record pattern mapping tables to PHP classes
click to copy
php artisan make:model Question creates
New Eloquent model class in app/Models
click to copy
Eloquent assumes table name is
Plural snake_case of model (User→users, Question→questions)
click to copy
To override Eloquent table name
Set protected $table = 'custom_name'
click to copy
Question::all() returns
Collection of all Question model instances
click to copy
Question::find(1) returns
Question with PK=1 or NULL if not found
click to copy
findOrFail($id) when ID not found
Throws ModelNotFoundException
click to copy
Eager loading with('posts') prevents
N+1 query problem by loading related models in 2 queries instead of N+1
click to copy
Eloquent create() requires
$fillable array set on model (mass assignment protection)
click to copy
$question->save() performs
INSERT for new model or UPDATE for existing model
click to copy
Soft delete uses
deleted_at TIMESTAMP column (NULL=active, timestamp=deleted)
click to copy
withTrashed() includes
All records including soft-deleted ones
click to copy
belongsToMany() is used for
Many-to-many relationship requiring pivot table
click to copy
chunk(100, callback) in Eloquent
Processes records 100 at a time preventing memory exhaustion
click to copy
DB::table('questions')->get() returns
Plain PHP stdClass objects (not Eloquent model instances)
click to copy
DB::table('questions')->where('is_deleted',0)->count() returns
Integer count of non-deleted questions
click to copy
php artisan migrate:fresh
Drops ALL tables then re-runs all migrations
click to copy
Schema::create() in migration
Creates a new database table
click to copy
$table->id() creates
AUTO_INCREMENT UNSIGNED BIGINT primary key column named id
click to copy
$table->string('question') creates
VARCHAR(255) column named question
click to copy
$table->text('solution') creates
TEXT column for large text content
click to copy
$table->timestamps() adds
created_at and updated_at TIMESTAMP NULL columns
click to copy

DBMS → Joins 1

A left-deep join tree has
All inner (right) inputs as base tables
click to copy

DBMS → Relational Model 1

Primary key in MySQL InnoDB automatically creates
Clustered index
click to copy