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 24

Table-valued function returns
A result set (table) usable in FROM clause
click to copy
Which constraint is validated at statement execution time by default
NOT DEFERRABLE (default)
click to copy
DEFERRABLE INITIALLY DEFERRED constraint
Is checked at end of transaction (COMMIT time) by default
click to copy
Which SQL creates a partial/filtered index
CREATE INDEX idx ON emp(salary) WHERE dept='IT'
click to copy
Composite index (A,B,C): which query CAN use this index
WHERE A=1 AND B=5 (leading columns)
click to copy
Index fragmentation above 30% should be addressed by
REBUILD INDEX (drops and recreates, eliminates all fragmentation)
click to copy
Which SQL checks index fragmentation in SQL Server
sys.dm_db_index_physical_stats
click to copy
UPDATE STATISTICS command purpose
Refresh the statistical metadata the optimizer uses for query planning
click to copy
Which SQL best finds all tables in current database
SHOW TABLES or SELECT * FROM information_schema.TABLES
click to copy
INFORMATION_SCHEMA is
A system database providing metadata about all database objects
click to copy
Which SQL lists all columns of the questions table
SHOW COLUMNS FROM questions OR DESCRIBE questions
click to copy
EXPLAIN SELECT * FROM questions WHERE q_level=3 shows
The execution plan: whether index is used, rows examined, join type
click to copy
Which helps identify slow queries in MySQL
EXPLAIN and slow_query_log
click to copy
Which lock type is compatible with another shared lock
Shared (S) lock
click to copy
X (exclusive) lock is compatible with
No other lock type
click to copy
Which CC protocol allows both readers and writers without blocking each other
MVCC (Multi-Version Concurrency Control)
click to copy
Optimistic CC three phases are
Read, Validate, Write (commit if valid; else restart)
click to copy
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

DBMS → PL/SQL 3

Which SQL creates a stored procedure with output parameter
CREATE PROCEDURE p(OUT result INT) BEGIN...END
click to copy
Recursive stored procedure/function requires
A termination condition to prevent infinite recursion
click to copy
Which SQL creates trigger to log inserts on questions table
CREATE TRIGGER trg AFTER INSERT ON questions FOR EACH ROW INSERT INTO audit_log...
click to copy

DBMS → Transactions 4

Which isolation level is the SQL standard default in most databases
READ COMMITTED
click to copy
MySQL InnoDB default isolation level is
REPEATABLE READ
click to copy
Database transaction log is used for
Recovery: undoing incomplete transactions and redoing committed ones after crashes
click to copy
2PC blocking problem: coordinator fails between PREPARE and COMMIT causes
Participants that voted COMMIT block indefinitely waiting for coordinator decision
click to copy

DBMS → DDL Commands 1

Which DDL command modifies column data type
ALTER TABLE t MODIFY/ALTER COLUMN col newtype
click to copy

DBMS → Relational Model 1

PRIMARY KEY vs UNIQUE: key difference
UNIQUE allows one NULL; PRIMARY KEY does not allow any NULL
click to copy

DBMS → Deadlock 1

Deadlock detection frequency tradeoff
Higher frequency: detects deadlocks sooner but adds overhead; lower: less overhead but longer wait
click to copy

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 → 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