DSSSB TGT / PGT · Computer Science

DBMS & SQL Previous Year Questions

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.

  • 227 questions
  • Official answer key
  • Free

Other Computer Science topics

Q1From DSSSB TGT Computer Science Practice Set 5
Name the tag and the attribute to be used to change the sequence of the list items in an ordered list from numbers to upper case letters
  1. ATag-<OL>, Attribute - START
  2. BTag-<OL>, Attribute - VALUE
  3. CTag-<OL>, Attribute - TYPE
  4. DTag-<OL>, Attribute - CASE
Show answerHide answer

Correct answer: (C) Tag-<OL>, Attribute - TYPE

Explanation

The TYPE attribute of <OL> sets the numbering style; TYPE="A" gives upper-case letters (A, B, C...). START only sets the starting value, and VALUE belongs to <LI>.

Q2From DSSSB TGT Computer Science Practice Set 5
Which of the following best describes an attribute/column in a table?
  1. AIt is a set of numeric values in a table
  2. BIt is a set of string values in a table
  3. CIt is a vertical subset of a table
  4. DIt is a horizontal subset of a table
Show answerHide answer

Correct answer: (C) It is a vertical subset of a table

Explanation

Corrected: the book's key says (a), but its own explanation says a column is a vertical subset of a table.

Q3From DSSSB TGT Computer Science Practice Set 5
This question is based on the following SQL Table. Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as follow : Table Name : MYSTUDENT ROLLNO | NAME | SEC | MARKS 80105 | MARIA | A | 83.0 80108 | AMAR | B | 44.0 80109 | MANPREET | A | 92.0 80112 | SAMEER | A | 81.0 80115 | AKBAR | B | NULL Identify the most Suitable Command to display the merit List of his students where the details will be displayed in descending order of their marks. If some students have same MARKs, their detail will be displayed in ascending order of their ROLLNO.
  1. ASELECT * FROM MYSTUDENT ORDER BY DESC MARKS, ASC ROLLNO;
  2. BSELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;
  3. CSELECT * FROM MYSTUDENT ORDER BY MARKS; ROLLNO DESC, ASC;
  4. DSELECT * FROM MYSTUDENT ORDER BY MARKS DESC; ROLLNO ASC;
Show answerHide answer

Correct answer: (B) SELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;

Explanation

ORDER BY takes the column first and the direction after it, separated by commas: ORDER BY MARKS DESC, ROLLNO ASC sorts by marks high to low and breaks ties by roll number ascending. The other options have wrong syntax.

Q4From DSSSB TGT Computer Science Practice Set 5
This question is based on the following SQL Table. Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as follow : Table Name : MYSTUDENT ROLLNO | NAME | SEC | MARKS 80105 | MARIA | A | 83.0 80108 | AMAR | B | 44.0 80109 | MANPREET | A | 92.0 80112 | SAMEER | A | 81.0 80115 | AKBAR | B | NULL Which of the following command can display the SEC wise Average of the student ?
  1. ASELECT SEC, AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
  2. BSELECT SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY MARKS;
  3. CSELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;
  4. DSELECT AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
Show answerHide answer

Correct answer: (C) SELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;

Explanation

Section-wise averages need GROUP BY SEC with SELECT SEC, AVG(MARKS); ORDER BY only sorts and does not form groups, and GROUP BY MARKS groups the wrong column. Option C is the intended query (the "*" is a printing slip).

Q5From DSSSB TGT Computer Science Practice Set 5
Consider two database relations R and S having 3 tuples in R and 2 tuples in S. What is the maximum number of tuples that could appear in the natural join of R and S?
  1. A6
  2. B2
  3. C3
  4. D5
Show answerHide answer

Correct answer: (A) 6

Explanation

At most, the natural join can produce every combination, as when there are no common attributes or every row shares the same common value. That is 3 × 2 = 6 tuples.

Q6From DSSSB TGT Computer Science Practice Set 5
The ______ attribute of <TABLE> tag is used to control the distance between the data in a cell and the boundaries of the cell.
  1. AColspan
  2. BRowspan
  3. CCellpadding
  4. DCellspacing
Show answerHide answer

Correct answer: (C) Cellpadding

Explanation

CELLPADDING sets the space between a cell's content and its border. CELLSPACING sets the space between neighbouring cells.

Q7From DSSSB TGT Computer Science Practice Set 5
File operations that manipulate the 'open-count' maintained for each entry in open-file table include:
  1. AOpen, write
  2. BRead, write
  3. CWrite, close
  4. DOpen, close
Show answerHide answer

Correct answer: (D) Open, close

Explanation

The open-count records how many processes have the file open. open() increments it and close() decrements it, and the entry is removed when it reaches zero.

Q8From DSSSB TGT Computer Science Practice Set 5
______ operation preserves those tuples that would be lost in ______.
  1. ANatural join, outer join
  2. BOuter join, natural join
  3. CLeft outer join, right outer join
  4. DLeft outer join, natural join
Show answerHide answer

Correct answer: (B) Outer join, natural join

Explanation

An outer join keeps the unmatched tuples, padded with NULLs, that a natural join would drop.

Q9From DSSSB TGT Computer Science Practice Set 5
Which of the following is correct recurrence relation for worst caset of binary search?
  1. AT(n) = 2T(n/2) + O(1), T(1) = T(0) = O(1)
  2. BT(n) = T(n/2) + O(n), T(1) = T(0) = O(1)
  3. CT(n) = T(n/2) + O(1), T(1) = T(0) = O(1)
  4. DT(n) = T(n/2) + O(log n), T(1) = T(0) = O(1)
Show answerHide answer

Correct answer: (C) T(n) = T(n/2) + O(1), T(1) = T(0) = O(1)

Explanation

Each binary search step does a constant amount of work and continues in one half of the array, giving T(n) = T(n/2) + O(1), which solves to O(log n).

Q10From DSSSB TGT Computer Science Practice Set 5
A hash table of length 10 uses open addressing with hash function h(k) = kmod 10 and linear probing. After inserting 6 values into an empty hash table, the table is shown below: Slot | Key 0 | 1 | 2 | 42 3 | 23 4 | 34 5 | 52 6 | 46 7 | 33 8 | 9 | Which of the following choices gives a possible order in which the key values could have been inserted in the table?
  1. A46, 42, 34, 52, 23, 33
  2. B34, 42, 23, 52, 33, 46
  3. C46, 34, 42, 23, 52, 33
  4. D42, 46, 33, 23, 34, 52
Show answerHide answer

Correct answer: (C) 46, 34, 42, 23, 52, 33

Explanation

Order C reproduces the table: 46→6, 34→4, 42→2, 23→3, 52→2 (taken) then 3, 4 (taken) so 5, and 33→3 then 4, 5, 6 (taken) so 7.

Q11From DSSSB TGT Computer Science Practice Set 5
Which of the following MySQL query is syntactically correct and most preferred one?
  1. ASELECT SECTION, COUNT(*) FROM STUDENT ORDER BY SECTION GROUP BY SECTION WHERE MARKS<33 AND COUNT(*)>0;
  2. BSELECT SECTION, COUNT(*) FROM STUDENT WHERE MARKS<33 HAVING COUNT(*)>0 GROUP BY SECTION ORDER BY SECTION;
  3. CSELECT SECTION, COUNT(*) FROM STUDENT WHERE MARKS<33 GROUP BY SECTION HAVING COUNT(*)>0 ORDER BY SECTION;
  4. DSELECT SECTION COUNT(*) FROM STUDENT GROUP BY SECTION WHERE MARKS<33 AND COUNT(*)>0 ORDER BY SECTION;
Show answerHide answer

Correct answer: (C) SELECT SECTION, COUNT(*) FROM STUDENT WHERE MARKS<33 GROUP BY SECTION HAVING COUNT(*)>0 ORDER BY SECTION;

Explanation

The clauses must come in the order WHERE, GROUP BY, HAVING, ORDER BY. Conditions on groups such as COUNT(*) > 0 go in HAVING, not WHERE.

Q12From DSSSB TGT Computer Science Practice Set 5
Which of the following MySQL query will display all the NAME from the table STUDENT, which are having maximum five characters and starting with the alphabet 'A'?
  1. ASELECT NAME FROM STUDENT WHERE NAME LIKE 'A____';
  2. BSELECT NAME FROM STUDENT WHERE NAME = 'A____';
  3. CSELECT NAME FROM STUDENT WHERE NAME = 'A%%%%;
  4. DSELECT NAME FROM STUDENT WHERE NAME LIKE 'A%%%%'
Show answerHide answer

Correct answer: (A) SELECT NAME FROM STUDENT WHERE NAME LIKE 'A____';

Explanation

LIKE with the wildcard _ matches exactly one character, so 'A____' matches names that start with A and have five characters. The = operator does not treat wildcards specially.

Q13From DSSSB TGT Computer Science Practice Set 5
Select the correct output of the following C++ program segment assuming all necessary header files are correctly included: void main( ) { char *S = "MySQL"; S += 2; cout << S <<endl; }
  1. ASQL
  2. BQL
  3. CMy
  4. DMyS
Show answerHide answer

Correct answer: (A) SQL

Explanation

S points to "MySQL". S += 2 moves it past 'M' and 'y' to 'S', so cout prints the string from there: SQL.

Q14From DSSSB TGT Computer Science Practice Set 5
The term ______ is used for the larger, more powerful computers other than supercomputers. It supports a large database, has elaborate I/O hardware, and is used in a central data processing facility.
  1. AMinicomputer
  2. BSupercomputer
  3. CMainframe
  4. DMicrocomputer
Show answerHide answer

Correct answer: (C) Mainframe

Explanation

A mainframe is a large, powerful computer below a supercomputer that supports large databases and extensive I/O, and is used in central data processing.

Q15From DSSSB TGT Computer Science Practice Set 4
Match List-I with List-II and select the correct answer using the codes given below the Lists: List-I A. All-pairs shortest path B. Quicksort C. Minimum weight spanning tree D. Connected components List-II 1. Greedy 2. Depth-first search 3. Dynamic programming 4. Divide and conquer Codes: A B C D
  1. A2 4 1 3
  2. B3 4 1 2
  3. C3 4 2 1
  4. D4 1 2 3
Show answerHide answer

Correct answer: (B) 3 4 1 2

Explanation

All-pairs shortest path (Floyd-Warshall) uses dynamic programming, quicksort uses divide and conquer, minimum spanning tree (Prim/Kruskal) is greedy, and connected components are found with DFS. That gives 3, 4, 1, 2.

Q16From DSSSB TGT Computer Science Practice Set 4
In a relational database model, cardinality of a relation means :
  1. AThe number of constraints
  2. BThe number of tuples
  3. CThe number of attributes
  4. DThe number of tables
Show answerHide answer

Correct answer: (B) The number of tuples

Explanation

Cardinality of a relation is its number of tuples (rows). Degree is its number of attributes (columns).

Q17From DSSSB TGT Computer Science Practice Set 4
Which of the following statements best describes the main reasons for normalizing relational database? I. To Achieve physical data independence. II. To remove data anomalies (insertion. update, deletion, anomalies). III. To save space on disk.
  1. AI, II and III
  2. BI and II only
  3. CI and III only
  4. DII and III only
Show answerHide answer

Correct answer: (D) II and III only

Explanation

Normalization removes redundancy, which prevents insert, update and delete anomalies and saves storage space. It does not provide physical data independence, which comes from the three-level architecture.

Q18From DSSSB TGT Computer Science Practice Set 4
Which command in MySQL is used to list all (non-temporary) tables in a given database?
  1. ADESCRIBE TABLES
  2. BDISPLAY TABALES
  3. CVIEW TABLES
  4. DSHOW TABLES
Show answerHide answer

Correct answer: (D) SHOW TABLES

Explanation

SHOW TABLES lists all the non-temporary tables in the current MySQL database.

Q19From DSSSB TGT Computer Science Practice Set 4
Identify the error in the following HTML code: <HTML> <BODY> <FORM ID = "FORM1" METHOD = POST> <BR> SELECT YOUR FAVOURITE CHANNEL : NETFLIX <INPUT TYPE = CHECKSELECT> AMAZON PRIME <INPUT TYPE = CHECKSELECT> </FORM> </BODY> </HTML> (a) NAME instead of ID and CHECKBOX instead of CHECKSELECT. (b) METHOD = GET instead of POST.
  1. AOnly (a) is correct
  2. BBoth (a) and (b) are correct
  3. COnly (b) is correct
  4. DThe code is correct and has no errors
Show answerHide answer

Correct answer: (A) Only (a) is correct

Explanation

Form controls need a NAME attribute to be submitted, and the input type for tick boxes is CHECKBOX. CHECKSELECT does not exist. METHOD = POST is valid, so only (a) is correct.

Q20From DSSSB TGT Computer Science Practice Set 4
The ______ attribute of the <A> tag is used to specify the Section names while creating an internal link.
  1. AHREF
  2. BID
  3. CACTION
  4. DNAME
Show answerHide answer

Correct answer: (D) NAME

Explanation

In older HTML an internal link target is made with <A NAME="section">, and you link to it with <A HREF="#section">.

Q21From DSSSB TGT Computer Science Practice Set 4
Select the correct output of the following C++ program segment assuming all necessary header files are correctly included. void main () { char *S = "Inheritance"; S +=6 ; cout<<S<< endl; }
  1. Aitence
  2. Btance
  3. CTence
  4. DInheri
Show answerHide answer

Correct answer: (B) tance

Explanation

S points to "Inheritance". S += 6 moves it to index 6 (I0 n1 h2 e3 r4 i5 t6), so cout prints "tance".

Q22From DSSSB TGT Computer Science Practice Set 4
In order to add a new column to an existing table in SQL, we can use the command
  1. AMODIFY TABLE
  2. BEDIT TABLE
  3. CALTER TABLE
  4. DALTER COLUMNS
Show answerHide answer

Correct answer: (C) ALTER TABLE

Explanation

ALTER TABLE ... ADD column_name datatype adds a new column to an existing table. MODIFY TABLE and EDIT TABLE are not SQL commands.

Q23From DSSSB TGT Computer Science Practice Set 4
A program is a/an ______ entity.
  1. AActive
  2. BPassive
  3. CDormant
  4. DHyperactive
Show answerHide answer

Correct answer: (B) Passive

Explanation

A program is a passive entity, just code stored on disk. A process is an active entity, a program in execution.

Q24From DSSSB TGT Computer Science Practice Set 4
The command used to see the fields of the table alongwith their datatypes in SQL is
  1. ASelect fields from dual where table = "MANAGER";
  2. BSelect field_names, datatype from dual where table_ name = "MANAGER";
  3. CDesc MANAGER;
  4. DSelect description from dual where table_ name = "MANAGER";
Show answerHide answer

Correct answer: (C) Desc MANAGER;

Explanation

DESC (DESCRIBE) table_name shows the table's columns with their data types and constraints.

Q25From DSSSB TGT Computer Science Practice Set 4
The addressing mode used in an instruction of the form ADD X, Y is :
  1. AIndex
  2. BAbsolute
  3. CImmediate
  4. DIndirect
Show answerHide answer

Correct answer: (B) Absolute

Explanation

In ADD X, Y the operands are given by their memory addresses directly in the instruction. This is absolute (direct) addressing.

Q26From DSSSB TGT Computer Science Practice Set 4
Consider the relation Emp-Dept with SSn as key. Ename | SSn (key) | EAddr | Dept. No. | Dept. Name | Dept. Manager | SSn Which of the following is (are) invalid operations (s)? (i) Inserting an employee without name and address. (ii) Inserting an employee with only SSn. (iii) Inserting a department with no employee. (iv) Inserting an employee without SSn.
  1. A(i)
  2. B(iv)
  3. C(iii) and (iv)
  4. D(ii) and (iii)
Show answerHide answer

Correct answer: (B) (iv)

Explanation

SSn is the primary key, and by entity integrity a key cannot be null. So inserting an employee without an SSn is invalid. Name and address may be null.

Q27From DSSSB TGT Computer Science Practice Set 4
An entity set that does not have sufficient attributes to form a key is termed as :
  1. APrimary entity set
  2. BStrong entity set
  3. CWeak entity set
  4. DSimple entity set
Show answerHide answer

Correct answer: (C) Weak entity set

Explanation

A weak entity set has no primary key of its own. It is identified through a strong (owner) entity set plus its partial key (discriminator).

Q28From DSSSB TGT Computer Science Practice Set 3
In the relation R = {(1,2), (2,3)}, the minimum number of ordered pairs that must be added to this set, so that the enlarged relation is reflexive, symmetric and transitive, is
  1. A4
  2. B5
  3. C6
  4. D7
Show answerHide answer

Correct answer: (D) 7

Explanation

Since 1~2 and 2~3, all of 1, 2 and 3 fall into one equivalence class. That needs all 3 × 3 = 9 ordered pairs. R already has 2, so 9 − 2 = 7 pairs must be added.

Q29From DSSSB TGT Computer Science Practice Set 3
Which of the following statements is false with respect to Relational DBMS?
  1. AA disadvantage of highly normalized tables is that queries may require too many time consuming joins.
  2. BForeign key constraints are referential integrity constraints.
  3. CA primary key uniquely indentifies a row in a table.
  4. DNulls reduce space requirements in tables.
Show answerHide answer

Correct answer: (D) Nulls reduce space requirements in tables.

Explanation

Nulls do not reduce storage space, so (D) is false. The other statements are true: heavy normalization means more joins, foreign keys enforce referential integrity, and a primary key uniquely identifies a row.

Q30From DSSSB TGT Computer Science Practice Set 3
What result set is returned from the following SQL query ? Select customer_name, telephone From customers Where city in ('Jaipur','Delhi','Agra');
  1. AThe customer_name of all customers who are not living in Jaipur, Delhi or Agra.
  2. BThe customer_name and telephone of all customers.
  3. CThe customer_name and telephone of all customers living in either Jaipur, Delhi or Agra.
  4. DThe customer_name and telephone of all customers living in Jaipur, Delhi and Agra.
Show answerHide answer

Correct answer: (C) The customer_name and telephone of all customers living in either Jaipur, Delhi or Agra.

Explanation

IN matches any value in the list, so the query returns customer_name and telephone of customers whose city is Jaipur, Delhi or Agra. A customer cannot live in all three cities at once.

Q31From DSSSB TGT Computer Science Practice Set 3
Select the correct output for the following Python code. for I in range (6, 1, -2) : print (end = '*$$')
  1. A*$$*$$
  2. B*$$ *$$ *$$
  3. C*$$*$$*$$
  4. D*$$ *$$
Show answerHide answer

Correct answer: (C) *$$*$$*$$

Explanation

range(6, 1, −2) gives 6, 4 and 2, so the loop runs 3 times. print(end='*$$') prints only '*$$' with no newline, giving *$$*$$*$$.

Q32From DSSSB TGT Computer Science Practice Set 3
3NF is based on the concept of :
  1. AFunctional dependency
  2. BClosure dependency
  3. CTransitive dependency
  4. DNormal dependency
Show answerHide answer

Correct answer: (C) Transitive dependency

Explanation

3NF removes transitive dependencies, where a non-key attribute depends on another non-key attribute. 2NF removes partial dependencies.

Q33From DSSSB TGT Computer Science Practice Set 3
Which of the following is not an example of Database Application ?
  1. APayroll Management
  2. BDigital Drawing
  3. CHR Management
  4. DInvoicing System
Show answerHide answer

Correct answer: (B) Digital Drawing

Explanation

Digital drawing is a graphics application. Payroll, HR management and invoicing all store and manage records in databases.

Q34From DSSSB TGT Computer Science Practice Set 3
An attribute, which can be referenced to connect with primary key of another table is known as:
  1. ACandidate key
  2. BAlternate key
  3. CReferpoint key
  4. DForeign key
Show answerHide answer

Correct answer: (D) Foreign key

Explanation

A foreign key is an attribute in one table that refers to the primary key of another table, linking the two tables.

Q35From DSSSB TGT Computer Science Practice Set 3
Which of the following SQL command will delete the structure as well as content of a table EMPLOYEE ?
  1. AERASE EMPLOYEE;
  2. BDELETE FROM EMPLOYEE;
  3. CDROP EMPLOYEE;
  4. DDROP TABLE EMPLOYEE;
Show answerHide answer

Correct answer: (D) DROP TABLE EMPLOYEE;

Explanation

DROP TABLE EMPLOYEE removes the table's structure and all its data. DELETE FROM only removes rows and keeps the structure.

Q36From DSSSB TGT Computer Science Practice Set 3
In Visual Basic, different items appearing in the same value list of a SELECT CASE block must be separated by :
  1. A, (COMMA)
  2. B; (SEMI COLON)
  3. C: (COLON)
  4. D# (HASH)
Show answerHide answer

Correct answer: (A) , (COMMA)

Explanation

In a VB Select Case statement, multiple values in one Case are separated by commas, for example Case 1, 3, 5.

Q37From DSSSB TGT Computer Science Practice Set 3
Refer to the monostable multivibrator circuit in the figure below. The trigger terminal (pin 2 of the IC ) is driven by a symmetrical pulsed waveform of 10 kHz. Determine the duty cycle of the output waveform. Circuit: a 555 timer IC; pins 4 and 8 are connected to Vcc; a 10 K resistor is connected from Vcc to pins 6 and 7 (joined together); a 0.01 capacitor is connected from pins 6,7 to ground; pin 5 is connected to ground through a 0.01 capacitor; pin 1 is grounded; the Trigger Input is applied to pin 2; the Output is taken from pin 3.
  1. A0.56
  2. B0.55
  3. C0.57
  4. D0.58
Show answerHide answer

Correct answer: (B) 0.55

Explanation

Answer as per the book's key (b).

Q38From DSSSB TGT Computer Science Practice Set 3
In a Schmitt trigger inverter circuit, the two trip points are observed to occur at 1.8 and 2.8 V. At what input voltage levels will this device make (a) HIGH-to-LOW transition and (b) LOW-to-HIGH transition?
  1. A2.8 V & 1.8 V
  2. B3 V & 2 V
  3. C4 V & 2.2 V
  4. D2.6 V & 1.5 V
Show answerHide answer

Correct answer: (A) 2.8 V & 1.8 V

Explanation

In a Schmitt trigger inverter, the output goes HIGH to LOW when a rising input crosses the upper trip point, 2.8 V. It goes LOW to HIGH when a falling input crosses the lower trip point, 1.8 V.

Q39From DSSSB TGT Computer Science Practice Set 3
Given the following two statements about SQL. (A) An SQL query can contain HAVING clause only if it has GROUP BY clause. (B) In an SQL query "SELECT_FROM_WHERE_GROUP BY_HAVING". HAVING is executed before WHERE. Which of the following is correct?
  1. A(A) and (B) both are true
  2. B(A) is true, (B) is false
  3. C(A) is false, (B) is true
  4. D(A) and (B) both are false
Show answerHide answer

Correct answer: (D) (A) and (B) both are false

Explanation

Corrected: the book's key says (b). HAVING can be used without GROUP BY (the whole result is one group), and WHERE is applied before HAVING, so both statements are false.

Q40From DSSSB TGT Computer Science Practice Set 3
Given an instance of the relation R(ABCD). A | B | C | D a₁ | b₁ | c₁ | d₁ a₁ | b₂ | c₂ | d₂ a₂ | b₂ | c₂ | d₃ a₃ | b₃ | c₄ | d₃ Which of the following functional dependencies hold?
  1. A{A B} → D and D → A
  2. B{A B → C} and B → D
  3. C{A B} → C and B → C
  4. D{A B} → D and A → D
Show answerHide answer

Correct answer: (C) {A B} → C and B → C

Explanation

AB → C holds because every (A, B) pair is unique, and B → C holds because b1→c1, b2→c2 (twice) and b3→c4. B → D fails (b2 gives d2 and d3), as do D → A and A → D.

Q41From DSSSB TGT Computer Science Practice Set 2
Which data type is mostly returned by fetchall() method in Python-MySQL connectivity? Select the most common answer
  1. AA single list or an empty list, if no more rows are available.
  2. BA list of tuples or an empty list, if no more rows are available.
  3. CA list of dictionaries or an empty list, if no more rows are available.
  4. DA single tuples or an empty tuple, if no more rows are available.
Show answerHide answer

Correct answer: (B) A list of tuples or an empty list, if no more rows are available.

Explanation

cursor.fetchall() returns the remaining rows as a list of tuples (one tuple per row), or an empty list if no rows are left.

Q42From DSSSB TGT Computer Science Practice Set 2
XML is designed to ______ and ______ data. Select the best pair of answers from the following options.
  1. ADesign, transport
  2. BStore, design
  3. CStore, transport
  4. DFormat, design
Show answerHide answer

Correct answer: (C) Store, transport

Explanation

XML was designed to store and transport data, while HTML was designed to display data.

Q43From DSSSB TGT Computer Science Practice Set 2
This question is based on following table : TABLE : DELIVERY SNO | DBOY | ITEM | STAR | AMOUNT 1001 | AMAN | FOOD | 5 | 3000 1005 | JONES | MEDICINE | 3 | 5000 1008 | AMAN | MEDICINE | 2 | 4000 1009 | RAZID | FOOD | 4 | 4500 1010 | JONES | GIFT | 5 | 5000 1018 | AMAN | FOOD | 5 | 3000 1022 | RAZID | MEDICINE | 4 | 5000 Which of the following SQL commands will remove the rows, which have column value of STAR less than 5 ?
  1. AREMOVE FROM DELIVERY WHERE STAR < 5;
  2. BDROP TABLE DELIVERY WHERE STAR < 5;
  3. CDELETE FROM DELIVERY WHERE STAR < 5;
  4. DDELETE * FROM DELIVERY WHERE STAR < 5;
Show answerHide answer

Correct answer: (C) DELETE FROM DELIVERY WHERE STAR < 5;

Explanation

DELETE FROM table WHERE condition removes matching rows. There is no REMOVE command, DROP removes the whole table, and DELETE * is not valid standard SQL.

Q44From DSSSB TGT Computer Science Practice Set 2
Consider the following tables in a database SPORTS : Table 1 : STUDENTS ADMNO | SNAME 101 | AMAR 205 | MARIA 410 | MALALA Table 2 : GAMES GAMEID | GNAME G03 | CRICKET G05 | FOOTBALL Which of the following SQL Command will produce an output as : SNAME | GNAME AMAR | CRICKET MARIA | CRICKET MALALA | CRICKET AMAR | FOOTBALL MARIA | FOOTBALL MALALA | FOOTBALL
  1. ASELECT SNAME, GNAME FROM STUDENTS, GAMES;
  2. BSELECT SNAME, GNAME FROM STUDENTS X GAMES;
  3. CSELECT SNAME FROM STUDENTS, GNAME FROM GAMES;
  4. DSELECT SNAME FROM STUDENTS, SELECT GNAME FROM GAMES;
Show answerHide answer

Correct answer: (A) SELECT SNAME, GNAME FROM STUDENTS, GAMES;

Explanation

Listing two tables with no join condition gives their Cartesian product: every student paired with every game (3 × 2 = 6 rows), which matches the output.

Q45From DSSSB TGT Computer Science Practice Set 2
Determine the function performed by the combinational circuit of the given figure. Circuit: three 2-to-1 MUXes. MUX-1 has inputs I3 (to its I1) and I2 (to its I0). MUX-2 has inputs I1 (to its I1) and I0 (to its I0). The select lines of MUX-1 and MUX-2 are tied together to S1. The output Y of MUX-1 goes to input I1 of MUX-3 and the output Y of MUX-2 goes to input I0 of MUX-3. MUX-3 has select S0 and output F.
  1. A4-to-1 multiplexer
  2. B8-to-1 multiplexer
  3. C16-to-1 multiplexer
  4. D32-to1 multiplexer
Show answerHide answer

Correct answer: (A) 4-to-1 multiplexer

Explanation

MUX-1 and MUX-2 choose between I3/I2 and I1/I0 using S1, and MUX-3 chooses between their outputs using S0. Four inputs and two select lines make a 4-to-1 multiplexer.

Q46From DSSSB TGT Computer Science Practice Set 2
Which of the following is not a transaction management SQL command ?
  1. ARollback
  2. BCommit
  3. CSelect
  4. DSavepoint
Show answerHide answer

Correct answer: (C) Select

Explanation

COMMIT, ROLLBACK and SAVEPOINT are transaction control (TCL) commands. SELECT is a data query command.

Q47From DSSSB TGT Computer Science Practice Set 2
Concurrency control in RDBMS is important for which of the following reasons ?
  1. ATo ensure data integrity when reads occur to the database in a multi-user environment.
  2. BTo ensure data integrity when updates occur to the database in a single-user environment.
  3. CTo ensure data integrity when updates occur to the database in a multi-user environment.
  4. DTo ensure data integrity when reads occur to the database in a single-user environment.
Show answerHide answer

Correct answer: (C) To ensure data integrity when updates occur to the database in a multi-user environment.

Explanation

Concurrency control keeps data consistent when several users update the database at the same time, preventing lost updates and inconsistent reads.

Q48From DSSSB TGT Computer Science Practice Set 2
If transaction A holds a shared lock R and if transaction B also requests for a shared lock on R, it will
  1. AResult in a deadlock situation
  2. BImmediately be granted
  3. CImmediately be rejected
  4. DBe granted as soon as it is released by A
Show answerHide answer

Correct answer: (B) Immediately be granted

Explanation

Shared (read) locks are compatible with each other, so B's shared-lock request on R is granted immediately.

Q49From DSSSB TGT Computer Science Practice Set 2
The difference (−) operation removes common tuples from the first relation. This operation is
  1. ACommutative and associative
  2. BNon-commutative and associative
  3. CCommutative and non-associative
  4. DNon-commutative and non-associative
Show answerHide answer

Correct answer: (D) Non-commutative and non-associative

Explanation

Corrected: the book's key says (b). Set difference is neither commutative (R − S ≠ S − R) nor associative.

Q50From DSSSB TGT Computer Science Practice Set 2
A hash function defined as f(key) = key mod 7 with linear probing is used to insert the keys 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0 to 6. What will be the location of 11?
  1. A3
  2. B4
  3. C5
  4. D6
Show answerHide answer

Correct answer: (C) 5

Explanation

37→2, 38→3, 72→2 (taken, goes to 3, then 4), 48→6, 98→0. 11 mod 7 = 4 is taken, so linear probing places 11 at slot 5.

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.

More DSSSB TGT / PGT subjects