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.
A child has a schema for a dog based on his experience with his pet, then when he sees another dog in the garden, he is able to recognize the animal. Which process of cognitive development is highlighted in the statement?
AAssimilation
BAccommodation
COperation
DEquilibrium
Show answerHide answer
Correct answer: (A) Assimilation
Explanation
Fitting a new experience (another dog) into an existing schema is assimilation in Piaget's theory. Accommodation means changing the schema itself.
What will the following code result in?
import pandas as pd
pd.Series ([10,20], index = ['A', 'B', 'C'])
AValueError
BNameError
CIndexError
DSyntaxError
Show answerHide answer
Correct answer: (A) ValueError
Explanation
The data list has 2 values but the index has 3 labels. pandas cannot match the lengths, so it raises a ValueError ("Length of values does not match length of index").
Which of the following is not an example of an application of a Database ?
AVIDEO Editing
BProfile Management System
CResult Management System
DInventory Control System
Show answerHide answer
Correct answer: (A) VIDEO Editing
Explanation
Video editing works on audio and video media streams and is not organised around stored records. Profile, result and inventory systems are classic database applications.
Which of the following options appropriately represent the relationship shown in the diagram ?
Diagram: entity box E1 is joined to entity box E2 by a line labelled R; the line ends in a crow's-foot (many) symbol at the E1 side and has a plain end at the E2 side.
AONE - TO - ONE
BONE - TO - MANY
CMANY - TO - ONE
DMANY - TO - MANY
Show answerHide answer
Correct answer: (C) MANY - TO - ONE
Explanation
The crow's foot (many) is on the E1 side and the plain (one) end is on the E2 side. Many E1 entities relate to one E2 entity, so the relationship is many-to-one.
Which of the following cannot be represented as a tree ?
AUnix directory without links
BTable of Content of a book
CCustomer calls in a call centre
DArithmetic expression
Show answerHide answer
Correct answer: (C) Customer calls in a call centre
Explanation
Customer calls in a call centre are served in arrival order (first in, first out), so they form a queue, not a hierarchy. Directories, a table of contents and arithmetic expressions are naturally hierarchical trees.
______ is a sequence of memory read-write operations that are atomic.
ACritical section object
BAdaptive mutex
CTurnstile
DMemory transaction
Show answerHide answer
Correct answer: (D) Memory transaction
Explanation
In transactional memory, a memory transaction is a sequence of memory read-write operations that is atomic: either all of them take effect (commit) or none do.
In relational databases, the natural join of two tables is :
ACartesian Product always.
BCombination of Union and filtered Cartesian Product.
CCombination of Selection and filtered Cartesian Product.
DCombination of Projection and filtered Cartesian Product.
Show answerHide answer
Correct answer: (D) Combination of Projection and filtered Cartesian Product.
Explanation
A natural join takes the Cartesian product, keeps the rows where common attributes are equal (selection), then projects away the duplicate columns. So it is a projection of a filtered Cartesian product.
Consider the database table "Persons" having persons_ID as the primary key:
person_ID | Name | Age
1000 | Rajan | 40
- | Jatin | -45
1001 | Rajesh | 35
What are the constraints violated by the above table ?
ARelationship integrity
BReferential integrity only
CEntity and domain integrities
DReferential and domain integrities
Show answerHide answer
Correct answer: (C) Entity and domain integrities
Explanation
A missing person_ID breaks entity integrity, because a primary key cannot be null. An age of −45 is outside the valid domain, so domain integrity is also broken.
What is the output of the following C program?
# include
int main ( )
{
int index;
for (index = 1; index < = 5; index ++)
{
printf ("%d", index);
if (index = = 3)
continue;
}
}
A1245
B12345
C12245
D12354
Show answerHide answer
Correct answer: (B) 12345
Explanation
printf runs before the if statement, so continue only skips the (empty) rest of the loop body. Every value from 1 to 5 is printed: 12345.
Which of the following is NOT an attribute of good programming languages?
AClarity, simplicity and unity
BSupport for abstraction
CEase of program verification
DNon portability
Show answerHide answer
Correct answer: (D) Non portability
Explanation
Portability (running on different machines) is a desirable attribute of a good language, so non-portability is not one. Clarity, abstraction and ease of verification are all good attributes.
Consider a n × n tri-diagonal sparse matrix A. Suppose we want to store sparse A in a one-dimensional array. What is the index of the (i,j)th element of A in the one-dimensional array?
A2i + 2j
B2i + j − 2
Ci + j
Di + j − 1
Show answerHide answer
Correct answer: (B) 2i + j − 2
Explanation
Row-major with 1-based indexes, rows before row i hold 3(i−1) − 1 elements, and (i, j) is the (j − i + 2)th element of row i. Total = 3i − 4 + j − i + 2 = 2i + j − 2.
In C++, "Out-of-range-index" belong to ________ type exception while keyboard interrupts are called ________ exceptions.
ASynchronous; synchronous
BSynchronous; asynchronous
CAsynchronous; synchronous
DAsynchronous; asynchronous
Show answerHide answer
Correct answer: (B) Synchronous; asynchronous
Explanation
Errors such as out-of-range index come from the program's own execution, so they are synchronous. Events beyond the program's control, such as keyboard interrupts, are asynchronous.
Match the following formal relational term with informal equivalents.
i. Relation — A. Row
ii. Tuple — B. Value
iii. Attribute — C. Table
iv. Domain — D. Column
Ai-3, ii-4, iii-1, iv-2
Bi-3, ii-1, iii-4, iv-2
Ci-1, ii-3, iii-2, iv-4
Di-4, ii-3, iii-2, iv-1
Show answerHide answer
Correct answer: (B) i-3, ii-1, iii-4, iv-2
Explanation
Note: in the official paper the options refer to A, B, C, D as 1, 2, 3, 4 respectively.
Consider the following relation schema of students.
STUDENT (Rollno, Name, DOB, Marks, Gender)
Which of the given query is equivalent to this query in English? "Find the tuples of student having marks above 80".
Aσ Marks>80 (STUDENT)
BΠ Marks>80 (STUDENT)
Cσ Marks<80 (STUDENT)
DΠ Marks<80 (STUDENT)
Show answerHide answer
Correct answer: (A) σ Marks>80 (STUDENT)
Explanation
Selecting tuples (rows) that satisfy a condition uses σ: σ Marks>80 (STUDENT). Π selects columns, not rows.
Which of the following statement(s) is/are correct regarding Structured Query Language (SQL)?
I. The datatype FLOAT can hold numbers with decimal points.
II. The datatype BIGINT occupies 16 bytes.
AOnly I
BOnly II
CBoth I and II
DNeither I nor II
Show answerHide answer
Correct answer: (A) Only I
Explanation
FLOAT stores numbers with decimal points, but BIGINT occupies 8 bytes, not 16. So only I is correct.
Which of the following statement(s) is/are correct regarding COUNT functions in Structured Query Language of Relational Database Management System?
I. COUNT(*) is used to count the number of values in a column.
II. COUNT() is used to count the number of rows of the query result.
AOnly I
BOnly II
CBoth I and II
DNeither I nor II
Show answerHide answer
Correct answer: (D) Neither I nor II
Explanation
Both statements are reversed: COUNT(*) counts all rows of the result, while COUNT(column) counts the non-NULL values in a column. So neither is correct.
Which of the following statement(s) is/are correct regarding single row functions in structured query language?
I. INSERT() is a numeric function.
II. ROUND() is a numeric function.
III. LENGTH() is a character function.
ABoth I and II
BBoth II and III
COnly III
DBoth I and III
Show answerHide answer
Correct answer: (B) Both II and III
Explanation
ROUND() is a numeric function and LENGTH() is a character function. INSERT() (e.g., in MySQL) is a string function, not a numeric one.
Which of the following statement(s) is/are correct regarding Data Dictionary in Database Management System?
I. Data Dictionary is a collection of definitions, rules and advisories of data designed to be used as a reference with the data warehouse.
II. Data Dictionary is the area of memory allocated for data storage.
AOnly I
BOnly II
CBoth I and II
DNeither I nor II
Show answerHide answer
Correct answer: (A) Only I
Explanation
A data dictionary is a metadata repository that holds definitions, rules and descriptions of the data. It is not a memory area for storing data.
Which of the following is NOT a Data MINING technique?
ALink Analysis
BDatabase Segmentation
CPredictive Modeling
DEvaluation
Show answerHide answer
Correct answer: (D) Evaluation
Explanation
Link analysis, database segmentation (clustering) and predictive modelling are data mining techniques. Evaluation is a general step, not a mining technique.
Q89DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
What is the cardinality of Relation having 500 tuples and 50 attribute?
A500
B50
C450
D2500
Show answerHide answer
Correct answer: (A) 500
Explanation
Cardinality is the number of tuples (rows) in a relation, so it is 500. The number of attributes (50) is the degree.
Q90DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
How many rule does Dr. E.F. codd provides which qualify quality a database as a RDBMS?
A10
B11
C12
D13
Show answerHide answer
Correct answer: (C) 12
Explanation
E.F. Codd gave 12 rules, numbered 1-12 with an extra Rule 0 (the foundation rule), that a DBMS must satisfy to be called fully relational.
Q91DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which of the following is a type of connection trap in Entity relationship model?
I. Fan-traps
II. Chasm-traps
AOnly I
BOnly II
CBoth I and II
DNeither I nor II
Show answerHide answer
Correct answer: (C) Both I and II
Explanation
Fan traps and chasm traps are the two kinds of connection trap in ER modelling. A fan trap gives ambiguous paths between entities, and a chasm trap gives a missing path.
Q92DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which of the following symbol represent one to one cardinality relationship in Entity relationship diagram?
A─○|─ (a line with a circle and one bar)
B─|─ (a line with a single bar)
C─||─ (a line with a double bar)
D─|<─ (a line with a bar and a crow's foot)
Show answerHide answer
Correct answer: (B) ─|─ (a line with a single bar)
Explanation
In crow's-foot notation, a single bar means "one". A line with a single bar marks a one-to-one link. A crow's foot means "many", and a circle means "zero" (optional).
Q93DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which of the following is NOT an approach of database design in database management system?
ATop-down approach
BBottom-up approach
CInside-out approach
DUP-down approach
Show answerHide answer
Correct answer: (D) UP-down approach
Explanation
The recognised database design approaches are top-down, bottom-up, inside-out and mixed. There is no "up-down" approach.
Q94DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which of the following is an Aggregate operator in structured Query Language?
AMinus
BIntersect
CUnion
DCount
Show answerHide answer
Correct answer: (D) Count
Explanation
COUNT is an aggregate function: it returns one value computed over a set of rows. MINUS, INTERSECT and UNION are set operators.
Q95DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which attribute in HTML table tag defines the number of columns in a column group?
ABorder
BColspan
CRowspan
DSpan
Show answerHide answer
Correct answer: (D) Span
Explanation
The span attribute of <colgroup> or <col> sets how many columns the group covers. Colspan and rowspan are used on table cells (td or th).
Q96DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which is the value of f'(x) at x = 4 from the following table of values?
x | 1 | 2 | 3 | 4
f(x) | 20 | 22 | 27 | 34
A9.2
B9
C10.8
D9.5
Show answerHide answer
Correct answer: (D) 9.5
Explanation
Note: the answer key gives (D) 9.5, but with this table Newton's backward formula gives f′(4) = ∇f + ∇²f/2 + ∇³f/3 = 7 + 2/2 − 1/3 ≈ 7.67. No option matches, so the table is probably misprinted.
Q97DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
Which of the following is a invalid relational operator in Java?
A<=
B=>
C!=
D==
Show answerHide answer
Correct answer: (B) =>
Explanation
Java's relational operators are <, >, <=, >=, == and !=. "=>" is not a valid operator in Java.
Q98DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2
What is the description of append keyword of visual Basic net keyword?
ABoolean operation
BUsed in the declare statement
CUsed as a symbolic constant in the fileopen function
DAssembly-attribute specifier
Show answerHide answer
Correct answer: (C) Used as a symbolic constant in the fileopen function
Explanation
In VB.NET, Append is used as a symbolic constant (OpenMode.Append) in the FileOpen function, to open a file and add data at its end.
Q99DSSSB TGT Computer Science (Technical), 7 Aug 2021, Shift 3
The following keys 22, 28, 23, 12 and 13 are inserted into initially empty hash table of length 9 using open addressing with hash function h(k) = k mod 9 and linear probing. At what index key 13 is inserted?
A4
B5
C6
D7
Show answerHide answer
Correct answer: (C) 6
Explanation
22→4, 28→1, 23→5, 12→3. 13 mod 9 = 4 is taken, so linear probing tries 5 (taken), then 6, which is free. So 13 goes to index 6.
Q100DSSSB TGT Computer Science (Technical), 7 Aug 2021, Shift 3
Which gate is represented by the following truth table?
A | B | C | Output
0 | 0 | 0 | 1
0 | 0 | 1 | 1
0 | 1 | 0 | 1
0 | 1 | 1 | 1
1 | 0 | 0 | 1
1 | 0 | 1 | 1
1 | 1 | 0 | 1
1 | 1 | 1 | 0
ANOR
BNAND
CXOR
DXNOR
Show answerHide answer
Correct answer: (B) NAND
Explanation
The output is 0 only when all inputs are 1 and 1 otherwise, which is (ABC)', the NAND function.
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.