227 DBMS & SQL (Computer Science) questions asked in DSSSB TGT / PGT previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.
Which of the following SQL statements will retrieve the lowest value from a column named
'Price' in a table named 'Products'?
ASELECT MIN(Price) FROM Products;
BSELECT LOWEST(Price) FROM Products;
CSELECT TOP 1 Price FROM Products ORDER BY Price ASC;
DSELECT Price FROM Products WHERE Price = MIN(Price);
Show answerHide answer
Correct answer: (A) SELECT MIN(Price) FROM Products;
Explanation
The aggregate function MIN() returns the smallest value in a column. LOWEST() does not exist, and an aggregate cannot be used directly in a WHERE clause.
Select the correct SQL query that returns all students whose results are greater than the
average result of their respective departments.
ASELECT stu_id
FROM student
WHERE result > (SELECT AVG(result) FROM student GROUP BY dept_id);
BSELECT stu_id
FROM student
WHERE result > AVG(result) GROUP BY dept_id;
CSELECT stu_id
FROM student s
WHERE result > (SELECT AVG(s.result) FROM student);
DSELECT stu_id
FROM student s
WHERE result > (SELECT AVG(result) FROM student WHERE dept_id = s.dept_id);
Show answerHide answer
Correct answer: (D) SELECT stu_id
FROM student s
WHERE result > (SELECT AVG(result) FROM student WHERE dept_id = s.dept_id);
Explanation
To compare each student with their own department's average, the subquery must be correlated: WHERE dept_id = s.dept_id links it to the outer row. Option A's subquery returns several averages, and B uses an aggregate in WHERE, which is not allowed.
Which of the following is true about the page table?
AThe page table contains the data of each process.
BThe page table maps virtual addresses to physical addresses.
CThe page table is used only in non-paging systems.
DThe page table stores the instructions for memory management.
Show answerHide answer
Correct answer: (B) The page table maps virtual addresses to physical addresses.
Explanation
A page table holds, for each page of a process, the frame number in physical memory, so it translates virtual (logical) addresses into physical addresses. It holds no process data or instructions.
In order to grant a user named 'Deepak' the ability to read data from a table called
'Customers', which SQL statement should be used?
AGRANT SELECT ON Customers TO Deepak;
BGRANT READ ON Customers TO Deepak;
CGRANT ACCESS ON Customers TO Deepak;
DGIVE SELECT ON Customers TO Deepak;
Show answerHide answer
Correct answer: (A) GRANT SELECT ON Customers TO Deepak;
Explanation
SELECT is the privilege that allows reading rows from a table, so GRANT SELECT ON Customers TO Deepak; is correct. READ and ACCESS are not SQL privileges, and GIVE is not an SQL command.
Which of following accounting concept states that every accounting transaction has two
aspects?
AMatching concept
BConservatism concept
CDual aspect concept
DRealization concept
Show answerHide answer
Correct answer: (C) Dual aspect concept
Explanation
The dual aspect concept says every transaction has two equal effects, a debit and a credit, which is the basis of the equation Assets = Liabilities + Capital.
Which is NOT a valid way to include a comment in SQL-99?
AMultiline Comments or Block Comments: Multiline comments start with /* and end with
*/
BSingle-line comments start with -- double hyphens
CInline Comments: Inline comments start with -- after the SQL statement on the same
line
D// This is used for giving a comment
Show answerHide answer
Correct answer: (D) // This is used for giving a comment
Explanation
Standard SQL supports -- for single-line (and end-of-line) comments and /* ... */ for block comments. // is a comment in C++/Java/JavaScript, not in SQL-99.
Standard SQL requires the keyword INTO in an INSERT statement: INSERT INTO table VALUES (...). Omitting INTO is only accepted by some vendors such as MySQL or SQL Server, so D is invalid in standard SQL.
Which of the following statements about WITH CHECK OPTION in SQL views is true?
AIt ensures that inserted/updated rows satisfy the view’s WHERE clause.
BIt prevents any alter through the view.
CIt allows only ALTER operations on the view.
DIt makes the view read-only.
Show answerHide answer
Correct answer: (A) It ensures that inserted/updated rows satisfy the view’s WHERE clause.
Explanation
WITH CHECK OPTION rejects any INSERT or UPDATE through the view that would produce a row not satisfying the view's WHERE condition (a row that would vanish from the view).
SELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM
student);
ASELECT result FROM student WHERE ROWNUM = 2 ORDER BY result DESC;
BSELECT TOP 2 result FROM student ORDER BY result DESC;
CSELECT result FROM student ORDER BY result DESC LIMIT 1 OFFSET 1;
DSELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM
student);
Show answerHide answer
Correct answer: (D) SELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM
student);
Explanation
Note: the question statement is missing in the source paper; only the SQL query shown above and the options were printed. The official answer key marks option 4 (the same query as the one shown).
While creating a new table ProductOrder_2026, which SQL statement correctly inserts
all the records from the ProductOrder_2026 table into ProductOrder?
ACREATE TABLE ProductOrder_2026 AS CREATE * FROM ProductOrder;
BCREATE TABLE ProductOrder_2026 AS SELECT * FROM ProductOrder;
CCREATE TABLE ProductOrder_2026 AS UPDATE * FROM ProductOrder;
DCREATE TABLE ProductOrder_2026 AS INSERT * FROM ProductOrder ;
Show answerHide answer
Correct answer: (B) CREATE TABLE ProductOrder_2026 AS SELECT * FROM ProductOrder;
Explanation
CREATE TABLE new_table AS SELECT * FROM old_table creates the new table and copies all rows of the old one into it. CREATE, UPDATE or INSERT cannot follow AS here.
Given the array a = [10, 20, 30, 40, 50, 60] with 6 elements,
What will the array look like after inserting the value 45 at index 4?
A[10, 20, 30, 40, 45, 50, 60]
B[10, 20, 25, 30, 40, 45, 50]
C[10, 20, 25, 30, 40, 45, 60]
D[10, 25, 20, 30, 40, 45, 50]
Show answerHide answer
Correct answer: (A) [10, 20, 30, 40, 45, 50, 60]
Explanation
Inserting 45 at index 4 shifts 50 and 60 one place right, giving [10, 20, 30, 40, 45, 50, 60]. The other options contain 25, which was never in the array.
R2 - 2R1 gives [0, -2, 2, 6] and R3 - 4R1 gives [0, -3, 3, 9], which is 1.5 times the new R2, so one row becomes zero. The rank is 2, so the normal form is [I2 0; 0 0].
Which of the following statements is/are true?
P: The size of a linked list can grow and shrink dynamically during runtime based on
the operations performed.
Q: Unlike arrays, linked lists allow for constant-time access to elements by index.
R: The dynamic nature of linked lists means that memory for nodes is allocated only
when necessary, leading to better space utilisation.
AP, Q, R
BOnly P and Q
COnly P and R
DOnly P
Show answerHide answer
Correct answer: (C) Only P and R
Explanation
P is true (lists grow and shrink at run time) and R is true (nodes are allocated only when needed). Q is false: linked lists need O(n) traversal to reach an index; arrays give constant-time indexed access.
Which of the following is an example of System Software?
ADatabase Management System (DBMS)
BCompiler
CWeb Browser
DWord Processor
Show answerHide answer
Correct answer: (B) Compiler
Explanation
A compiler is system software (a language translator) that supports program development. DBMS, web browsers and word processors are application software.
Which of the following SQL expressions evaluates to TRUE, according to SQL-99?
ANULL <= NULL returns UNKNOWN
BNULL >= NULL returns UNKNOWN
CNULL IS NULL returns FALSE
DNULL IS NULL returns TRUE
Show answerHide answer
Correct answer: (D) NULL IS NULL returns TRUE
Explanation
Any ordinary comparison involving NULL (=, <=, >= etc.) gives UNKNOWN, not TRUE. The IS NULL predicate is the special test for nulls, so NULL IS NULL is TRUE.
The schema is the overall logical design (structure) of the database, which rarely changes. An instance is the data stored in the database at a particular moment.
____________ is NOT allowed in a SQL:1999 view definition.
AUse of subqueries
BUse of nested queries
CUse of aggregate formulas
DUse of ORDER BY clause
Show answerHide answer
Correct answer: (D) Use of ORDER BY clause
Explanation
A view is a virtual table, and standard SQL (SQL:1999) does not allow ORDER BY in the view's defining query; ordering is applied when the view is queried. Subqueries and aggregates are allowed.
Select the correct SQL statement which will correctly insert a new row into the Customer table
with only the CustomerID, Name, and Product columns specified, assuming the table allows
NULLs for other columns.
AINSERT Customer SET CustomerID=101, Name='Alice', Product='Pen';
BINSERT INTO Customer VALUES (101, 'Alice', 'Pen');
CINSERT INTO Customer (101, 'Alice', 'Pen');
DINSERT INTO Customer (CustomerID, Name, Product) VALUES (101, 'Alice', 'Pen');
To insert values into only some columns, list those columns after the table name and give matching values: INSERT INTO table (cols) VALUES (...). Option B gives no column list, so it expects values for all columns.
Which SQL statement is used to update data in a table?
ACHANGE
BMODIFY
CUPDATE
DSET
Show answerHide answer
Correct answer: (C) UPDATE
Explanation
UPDATE ... SET ... WHERE ... is the DML command that changes existing rows. SET is only a clause of UPDATE, and MODIFY is used with ALTER TABLE in some systems.
Which of the following statements is correct about the divide and conquer approach of binary
search technique?
AThe recurrence relation of binary search is written as T(n) = 2T(n/2) + O(1), where n is the number of elements in the array.
BThe worst-case time complexity of binary search is O(log n).
CThe best-case time complexity of binary search is O(log n).
DThe average-case time complexity of binary search is O(n).
Show answerHide answer
Correct answer: (B) The worst-case time complexity of binary search is O(log n).
Explanation
Each step compares with the middle element and discards half the array, so T(n) = T(n/2) + O(1), giving O(log n) in the worst case. The best case is O(1) and the average case is O(log n), and the recurrence has T(n/2) once, not twice.
On 15 December 2024, a fire occurred in the godown of M Ltd., and the entire stock was destroyed. The value of the stock salvaged was ₹3,00,000. The following transactions took place between 1 October 2024 and 15 December 2024 (Purchases, Sales, Wages, Opening Stock, Gross Profit).
[The figures of this table are not reproduced in the source paper.]
The value of stock lost by fire was ____.
A₹2,55,000
B₹6,30,000
C₹6,75,000
D₹5,92,000
Show answerHide answer
Correct answer: (B) ₹6,30,000
Explanation
Note: the figures of the table (Purchases, Sales, Wages, Opening Stock, Gross Profit) are missing in the source paper. The official answer key marks ₹6,30,000.
Select an appropriate ROM type from the options, where data can be erased or destroyed
using ultraviolet light.
AEEPROM
BFlash ROM
CEPROM
DPROM
Show answerHide answer
Correct answer: (C) EPROM
Explanation
EPROM (Erasable PROM) is erased by exposing its quartz window to ultraviolet light. EEPROM and flash are erased electrically, and PROM cannot be erased.
Which of the following is a software application that helps developers to build attractive website layouts and apps with ease?
ADatabase design tools
BFront-end development tools
CLogic programming tools
DBack-end development tools
Show answerHide answer
Correct answer: (B) Front-end development tools
Explanation
Front-end development tools help developers build attractive website layouts and user interfaces quickly. Back-end tools deal with servers and databases.
Which of the following refers to a planned system of collecting, storing and disseminating data in the form of information needed to carry out the functions of management?
AComputer Networks
BSoftware Engineering
CManagement Information System
DDatabase Management System
Show answerHide answer
Correct answer: (C) Management Information System
Explanation
A Management Information System is a planned system for collecting, storing and sharing information that managers need to do their work.
Which of the following statement is correct for DATEDIFF function in SQL?
I. This function reports difference between the arguments ‘startdate’ and ‘enddate’.
II. In this, ‘datepart’ argument/value can be specified in a variable.
AOnly I
BNeither I nor II
CBoth I and II
DOnly II
Show answerHide answer
Correct answer: (A) Only I
Explanation
DATEDIFF returns the difference between startdate and enddate in the given datepart, so I is correct. The datepart cannot be supplied through a user-defined variable or quoted string, so II is wrong.
Which of the following notation of ERD (Entity – Relationship Diagram) shows the
‘Weak Entity’?
A
B
C
D
Show answerHide answer
Correct answer: (C)
Explanation
A weak entity is drawn as a double rectangle (option C). A single rectangle is a strong entity, a diamond a relationship, and a double diamond an identifying relationship.
Which of the following normal form of normalization in relational model, disallows
relations within relations or relations as attribute values within tuples?
AFourth
BFirst
CSecond
DThird
Show answerHide answer
Correct answer: (B) First
Explanation
First Normal Form requires atomic attribute values, so it disallows nested relations or relations as attribute values within tuples.
How to use these DSSSB TGT / PGT Computer Science questions
Every question here was asked in a real DSSSB TGT / PGT paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full DSSSB TGT / PGT papers as timed tests to check your speed under exam conditions.