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 → SQL Basics 4

ROLLUP in GROUP BY
Generates subtotals and grand total across hierarchy levels
click to copy
CUBE in GROUP BY
Generates subtotals for ALL possible combinations of specified grouping columns
click to copy
NTILE(4) OVER(ORDER BY salary) divides
Ordered rows into 4 approximately equal-sized buckets
click to copy
Which SQL clause is mandatory in a SELECT statement?
FROM
click to copy

DBMS → Introduction to DBMS 32

PERCENT_RANK() of highest-ranked row is
0.0
click to copy
SUM(salary) OVER(ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) computes
Running cumulative total of salary
click to copy
CUME_DIST() computes
Cumulative distribution: fraction of rows ≤ current row value
click to copy
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING includes
Previous row + current row + next row (3-row window)
click to copy
PAXOS consensus protocol is used in
Distributed systems for fault-tolerant consensus among multiple nodes
click to copy
Base property of NoSQL - Eventually consistent means
Given enough time (no updates) all replicas will converge to same value
click to copy
Vertical fragmentation in distributed DB divides relation by
Columns (attributes) keeping PK in each fragment
click to copy
Horizontal fragmentation in distributed DB divides relation by
Rows (subsets of tuples) based on selection predicates
click to copy
Location transparency in distributed DB means
User can query data without knowing its physical location
click to copy
Impedance mismatch in databases refers to
Mismatch between OO programming model and relational data model
click to copy
ORM (Object-Relational Mapper) bridges
Object-oriented programming model and relational database (impedance mismatch)
click to copy
Laravel's Eloquent uses which ORM pattern?
Active Record pattern
click to copy
Which SQL function returns current date only (no time)?
CURDATE() or CURRENT_DATE
click to copy
FLOOR(4.9) returns
4
click to copy
CEIL(4.1) returns
5
click to copy
ROUND(4.567,2) returns
4.57
click to copy
ABS(-15) returns
15
click to copy
MOD(17,5) returns
2
click to copy
UPPER('dbms') returns
DBMS
click to copy
LOWER('DBMS') returns
dbms
click to copy
LENGTH('RMSSSB') returns
6
click to copy
SUBSTRING('Database',1,4) returns
Data
click to copy
TRIM(' hello ') returns
hello
click to copy
REPLACE('SQL is hard','hard','easy') returns
SQL is easy
click to copy
CHARINDEX('S','DBMS') returns
4
click to copy
REVERSE('SQL') returns
LQS
click to copy
CONCAT('Hello',' ','World') returns
Hello World
click to copy
SELECT * FROM questions LIMIT 10 OFFSET 20 returns
Rows 21 through 30
click to copy
Which SQL adds a new column to existing table?
ALTER TABLE questions ADD COLUMN new_col INT
click to copy
Which SQL renames a table?
ALTER TABLE old RENAME TO new OR RENAME TABLE old TO new
click to copy
CREATE INDEX idx ON questions(q_level) creates
A data structure to speed up queries on q_level column
click to copy
Which prevents phantom reads?
SERIALIZABLE
click to copy

DBMS → Transactions 2

Two-Phase Commit (2PC) is used for
Distributed database transactions across multiple nodes
click to copy
Which isolation level allows dirty reads?
READ UNCOMMITTED
click to copy

DBMS → Joins 1

Semi-join optimization in distributed queries sends
Only join-attribute projection to remote site to reduce data transfer
click to copy

DBMS → DDL Commands 1

DROP TABLE removes
Table structure, all data, indexes, and constraints permanently
click to copy