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 → Concurrency Control 1

Thomas Write Rule modification to timestamp ordering
Silently ignores an obsolete write when a newer transaction already wrote the item
click to copy

DBMS → Transactions 1

2PC blocking problem: coordinator fails between PREPARE and COMMIT causes
Participants that voted COMMIT block indefinitely waiting for coordinator decision
click to copy

DBMS → Introduction to DBMS 31

3PC (Three-Phase Commit) adds which phase to resolve 2PC blocking
PRE-COMMIT phase between PREPARE and COMMIT making protocol non-blocking
click to copy
RAID 0 provides
Striping only (improved performance, NO fault tolerance)
click to copy
RAID 6 provides
Double parity - can survive TWO simultaneous disk failures
click to copy
SSD vs HDD in databases: key advantage of SSD
Much faster random I/O: near-zero seek time and rotational latency
click to copy
Buffer pool hit ratio measures
Percentage of page requests served from memory vs disk (higher=better)
click to copy
Query rewrite: pushing projection down the operator tree
Reduces tuple width early limiting data carried through subsequent operations
click to copy
Which is a complete set of minimal Armstrong's axioms
Reflexivity, Augmentation, Transitivity
click to copy
Union rule for FDs is derived from which two axioms
Augmentation and Transitivity
click to copy
Decomposition rule for FDs is derived from
Reflexivity only
click to copy
Canonical cover has no extraneous attributes and no redundant FDs. Which algorithm finds it
Standard algorithm: remove extraneous attributes (left then right side), then remove redundant FDs
click to copy
To check if FD A→B is redundant in set F, compute
A+ without the FD A→B; if B∈A+ then A→B is redundant
click to copy
R(A,B,C,D,E) with FDs: AB→C, C→D, D→E, E→A. What is the closure AB+?
ABCDE
click to copy
Which query finds employees in BOTH department 10 AND department 20 (transferred)
SELECT empid FROM emp WHERE dept=10 INTERSECT SELECT empid FROM emp WHERE dept=20
click to copy
Which SQL deletes duplicate rows keeping only lowest id
DELETE FROM emp WHERE id NOT IN (SELECT MIN(id) FROM emp GROUP BY name,salary)
click to copy
Which query efficiently finds all questions with no answer set (right_answer_id IS NULL)
SELECT * FROM questions WHERE right_answer_id IS NULL
click to copy
To update q_level for all questions in assignment_id=1 to level 3
UPDATE questions SET q_level=3 WHERE assignment_id=1
click to copy
Which SQL finds questions that have all 5 options filled (option_e is not NULL)
SELECT * FROM questions WHERE option_e IS NOT NULL
click to copy
To soft-delete all questions for assignment_id=2 in Laravel
Question::where('assignment_id',2)->delete() with SoftDeletes trait
click to copy
To permanently delete soft-deleted questions in Laravel
Question::onlyTrashed()->forceDelete()
click to copy
To restore soft-deleted questions in Laravel
Question::onlyTrashed()->restore()
click to copy
In Laravel, Question::where('assignment_id',1)->get() vs Question::where('assignment_id',1)->first()
get() returns Collection of all matches; first() returns only the first matching model or NULL
click to copy
DB::table('questions')->value('question') returns
First question's text as a plain value (not Collection/model)
click to copy
DB::table('questions')->exists() returns
Boolean: TRUE if at least one row matches the query, FALSE otherwise
click to copy
DB::table('questions')->doesntExist() returns
Boolean: TRUE if NO rows match the query
click to copy
Question::withCount('options') in Laravel Eloquent
Adds options_count attribute with count of related options
click to copy
DB::table('questions')->orderByRaw('FIELD(q_level,3,2,1)')->get() in MySQL
Orders by custom field order: 3 first, then 2, then 1
click to copy
DB::table('questions')->selectRaw('COUNT(*) as total, AVG(q_level) as avg_level')->first()
Returns a stdClass with total count and average q_level
click to copy
To get questions grouped by q_level with count in Laravel
DB::table('questions')->groupBy('q_level')->selectRaw('q_level,COUNT(*) as cnt')->get()
click to copy
Which Laravel method chains multiple OR conditions cleanly
->where(function($q){ $q->where('a',1)->orWhere('b',2) }) for grouped OR
click to copy
Which SQL finds the n-th highest salary (n=3rd highest)
SELECT salary FROM emp ORDER BY salary DESC LIMIT 2,1
click to copy
Which SQL lists all tables with their row counts
SELECT TABLE_NAME, TABLE_ROWS FROM information_schema.TABLES WHERE TABLE_SCHEMA='dbname'
click to copy

DBMS → Joins 2

Which join algorithm is best when inner relation has no index and doesn't fit in memory
Block nested-loop join (reads outer in blocks to reduce I/O)
click to copy
Cost of index-based nested-loop join (outer b_r blocks, inner has index)
b_r + n_r × (cost of index lookup)
click to copy

DBMS → Normalization 3

Which normal form specifically addresses redundancy due to functional dependencies
BCNF
click to copy
If R(A,B,C) is in BCNF is it also in 3NF
Yes - every BCNF relation is also in 3NF
click to copy
A relation in 4NF is also in
BCNF (since 4NF ⊂ BCNF ⊂ 3NF ⊂ 2NF ⊂ 1NF)
click to copy

DBMS → Relational Model 2

R(A,B,C,D,E) with above FDs. How many candidate keys are there
4 (AB, CB, DB, EB)
click to copy
R(A,B,C) FDs: A→B, B→C, C→A. All candidate keys are
A, B, and C (each determines all others)
click to copy