DSSSB TGT / PGT · Topic-wise previous year questions

Computer Science Previous Year Questions (page 3)

1995 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.

  • 1995 questions
  • 19 topics
  • Official answer key
  • Free

Practise by topic

Q101From DSSSB TGT Computer Science Practice Set 4
A thread is also called :
  1. AA scheduler
  2. BA virtual process
  3. CA heavyweight process
  4. DA lightweight process
Show answerHide answer

Correct answer: (D) A lightweight process

Explanation

A thread is called a lightweight process. Threads of the same process share its code, data and files, so creating and switching between them costs little.

Q102From DSSSB TGT Computer Science Practice Set 4
Consider the following dictionary: Num = {10 : 'Ten', 100 : 'Hundred', 10: 'Decimal'} What shall be the output of print (Num)?
  1. A{10 : 'Ten', 100 : 'Hundred', 10 : 'Decimal'}
  2. B{10 : 'Ten', 100 : 'Hundred'}
  3. C{10 : 'Decimal', 100 : 'Hundred'}
  4. DError
Show answerHide answer

Correct answer: (C) {10 : 'Decimal', 100 : 'Hundred'}

Explanation

Dictionary keys must be unique. The second 10 overwrites the first value but keeps the key's original position, giving {10: 'Decimal', 100: 'Hundred'}.

Q103From DSSSB TGT Computer Science Practice Set 4
Identify the term, which is an unauthorized real-time interception or monitoring of private communication between two entities over a network.
  1. AEavesdropping
  2. BPhishing
  3. CSnooping
  4. DCyberstalking
Show answerHide answer

Correct answer: (A) Eavesdropping

Explanation

Eavesdropping is secretly intercepting or listening to private communication in real time over a network without permission.

Q104From DSSSB TGT Computer Science Practice Set 4
Which of the following method is used to move the file pointer to read the content from a specific position in a text file inside a Python program?
  1. AMove
  2. BTell
  3. CFind
  4. DSeek
Show answerHide answer

Correct answer: (D) Seek

Explanation

seek(offset) moves the file pointer to a given position. tell() only reports the current position.

Q105From DSSSB TGT Computer Science Practice Set 4
Which out of the following mode is required to be used while opening a binary file to allow read as well as write operations in a Python program?
  1. Aab
  2. Bwb
  3. Cr+
  4. Drb+
Show answerHide answer

Correct answer: (D) rb+

Explanation

'rb+' opens an existing binary file for both reading and writing. 'r+' is the text-mode version, and 'wb'/'ab' only write or append.

Q106From DSSSB TGT Computer Science Practice Set 4
What is the purpose of the legend() function in Matplotlib?
  1. ATo add a title to a plot
  2. BTo add annotations to a plot
  3. CTo label different lines or markers on a plot
  4. DTo label the x and y axes of a plot
Show answerHide answer

Correct answer: (C) To label different lines or markers on a plot

Explanation

legend() adds a legend box that labels each line or marker on the plot, using the label= values given when plotting.

Q107From 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.

Q108From DSSSB TGT Computer Science Practice Set 4
As per NEP 2020, from which class will vocational education be introduced?
  1. AClass 7
  2. BClass 8
  3. CClass 9
  4. DClass 6
Show answerHide answer

Correct answer: (D) Class 6

Explanation

NEP 2020 introduces vocational education from Class 6, including internships, so every student learns at least one vocation.

Q109From DSSSB TGT Computer Science Practice Set 4
Which approach of learning out of the following, engages participants in activity, leads them to reflect on their activity critically and obtain useful insight and learning?
  1. ACollaboration
  2. BPassive learning
  3. CObservation
  4. DExperiential learing
Show answerHide answer

Correct answer: (D) Experiential learing

Explanation

Experiential learning (Kolb) is learning by doing: learners take part in an activity, reflect on it critically, and draw insights they can apply.

Q110From DSSSB TGT Computer Science Practice Set 4
Which of the following is not a valid variable name in JavaScript ?
  1. ANumber10
  2. B_myNumber
  3. C10Number
  4. Dmy_Number
Show answerHide answer

Correct answer: (C) 10Number

Explanation

JavaScript identifiers cannot start with a digit, so 10Number is invalid. Names can start with a letter, _ or $.

Q111From DSSSB TGT Computer Science Practice Set 4
The style definitions are normally saved in external files that have the extension as :
  1. A.html
  2. B.css
  3. C.js
  4. D.stl
Show answerHide answer

Correct answer: (B) .css

Explanation

External style sheets are saved with the .css extension and linked to HTML pages with the <link> tag.

Q112From DSSSB TGT Computer Science Practice Set 4
A binary search tree with N integers may have height ______ in the best case, and ______ in the worst case.
  1. AO(N), O(N)
  2. BO(N²), N
  3. CO(log₂N), O(N²)
  4. DO(log₂N), N−1
Show answerHide answer

Correct answer: (D) O(log₂N), N−1

Explanation

A balanced BST has height O(log₂N). If keys are inserted in sorted order the tree becomes a chain with height N−1.

Q113From DSSSB TGT Computer Science Practice Set 4
Intellectual Property Rights (IPR) protect the use of information and ideas that are of:
  1. ATraditional value
  2. BHistorical value
  3. CCommercial value
  4. DEthical value
Show answerHide answer

Correct answer: (C) Commercial value

Explanation

IPR protects creations of the mind, such as inventions, designs and brands, that have commercial value, giving the creators exclusive rights to use them.

Q114From DSSSB TGT Computer Science Practice Set 4
What will be the result of the following expression? 3−(−3−3)−3
  1. A6
  2. B0
  3. C−3
  4. D3
Show answerHide answer

Correct answer: (A) 6

Explanation

3 − (−3 − 3) − 3 = 3 − (−6) − 3 = 3 + 6 − 3 = 6.

Q115From DSSSB TGT Computer Science Practice Set 4
Which of the following operations have the highest level of precedence?
  1. A( )
  2. B+ −
  3. C* /
  4. D^ (exponentiation)
Show answerHide answer

Correct answer: (D) ^ (exponentiation)

Explanation

Among the arithmetic operators, exponentiation (^) has the highest precedence, above * and /, which are above + and −. Parentheses are grouping symbols, not operations.

Q116From DSSSB TGT Computer Science Practice Set 4
Which topologies of networks is represented in the following diagram ? Diagram: a main cable with two computers attached to it branches out into three separate cables (lines); each branch cable has several computers attached to it (4 on the upper branch, 5 on the middle branch, 3 on the lower branch).
  1. ABUS
  2. BRING
  3. CSTAR
  4. DTREE
Show answerHide answer

Correct answer: (D) TREE

Explanation

Several bus segments branch out from a main backbone cable, making a hierarchy of buses. This is a tree topology.

Q117From 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.

Q118From 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">.

Q119From 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".

Q120From DSSSB TGT Computer Science Practice Set 4
This question is based on the following C++ code segment and class FUN : class FUN class FUN { int CODE ; public : FUN ( ); //Function1 FUN (int C); //Function2 FUN (FUN & F); //Function3 void DISP ( ); //Function4 ~FUN ( ); //Function5 }; void main ( ) { FUN F1 ; ______ // BLANK ______ ______} Which of the following is an example of default constructor?
  1. AFunction 1
  2. BFunction 2
  3. CFunction 3
  4. DFunction 5
Show answerHide answer

Correct answer: (A) Function 1

Explanation

A default constructor takes no arguments, so FUN() (Function 1) is the default constructor. FUN(int) is parameterized, FUN(FUN&) is the copy constructor, and ~FUN() is the destructor.

Q121From DSSSB TGT Computer Science Practice Set 4
Which of the following is depicted from the flowchart shown below? Flowchart (top to bottom, one straight path): P=1000 → R=10 → T=2 → SI=P*R*T/100 → PRINT SI
  1. ASequencing
  2. BBranching
  3. CLooping
  4. DOverloading
Show answerHide answer

Correct answer: (A) Sequencing

Explanation

The flowchart runs straight from top to bottom with no decisions or loops, which is sequencing (sequential control flow).

Q122From DSSSB TGT Computer Science Practice Set 4
Assume the values of X, Y and Z variables are assigned with values as −10, 20 and −30 respectively find out, which of following expression will evaluate to true ?
  1. AX > Z and Y >= Z
  2. BX > Y and X <= Z
  3. CX >= Z and Z <= Y
  4. DY <= X and Z <= Y
Show answerHide answer

Correct answer: (A) X > Z and Y >= Z

Explanation

Answer as per the book's key (a). Note that option (c) also evaluates to true for these values.

Q123From 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.

Q124From DSSSB TGT Computer Science Practice Set 4
Which of the following search algorithm requires a sorted array ?
  1. ALinear search
  2. BHash search
  3. CBinary search
  4. DAll of these
Show answerHide answer

Correct answer: (C) Binary search

Explanation

Binary search repeatedly halves the search range by comparing with the middle element, which only works if the array is sorted. Linear search works on unsorted data.

Q125From DSSSB TGT Computer Science Practice Set 4
With an IP address of 100, you currently have 80 subnets. What subnet mask should you use to maximize the number of available hosts ?
  1. A192
  2. B224
  3. C248
  4. D252
Show answerHide answer

Correct answer: (D) 252

Explanation

Note: the answer key gives (D) 252, but 252 adds only 6 subnet bits (64 subnets). 80 subnets need 7 bits (2⁷ = 128), which makes the octet 254 (255.254.0.0 for network 100). The question is garbled.

Q126From DSSSB TGT Computer Science Practice Set 4
The ______ houses the switches in token ring.
  1. ATransceiver
  2. BNine-pin connector
  3. CMAU
  4. DNIC
Show answerHide answer

Correct answer: (C) MAU

Explanation

In Token Ring, the MAU (Multistation Access Unit) is the hub-like device that houses the switches and connects the stations into a logical ring.

Q127From 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.

Q128From DSSSB TGT Computer Science Practice Set 4
The diagram given below represents Diagram: Processes enter a 'ready queue' which feeds the 'CPU'; an arrow leaves the CPU (exit). From the CPU, four paths lead back to the ready queue: 1. I/O request → I/O queue → I/O → back to ready queue 2. time slice expired → back to ready queue 3. fork a child → child executes → back to ready queue 4. wait for an interrupt → interrupt occurs → back to ready queue
  1. AProcess creation
  2. BProcess state
  3. CQueuing diagram
  4. DCommunication model
Show answerHide answer

Correct answer: (C) Queuing diagram

Explanation

The diagram shows the ready queue, the I/O queues and the events that move a process between them. This is the queueing diagram of process scheduling.

Q129From DSSSB TGT Computer Science Practice Set 4
The figure below represents a Figure: an arrow points to a root node R; R has two arrows going down, one to a triangle (subtree) labelled A on the left and one to a triangle (subtree) labelled B on the right.
  1. ABinary tree
  2. BRecursive tree
  3. CInsert sort
  4. DUnitary tree
Show answerHide answer

Correct answer: (A) Binary tree

Explanation

The figure shows a root with a left subtree A and a right subtree B. This is the recursive definition of a binary tree.

Q130From 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.

Q131From DSSSB TGT Computer Science Practice Set 4
Consider an arbitrary number system with the independent digits as 0, 1 and X. What is the radix of this number system ?
  1. A1
  2. B2
  3. C3
  4. D4
Show answerHide answer

Correct answer: (C) 3

Explanation

The radix (base) of a number system equals its number of distinct digits. 0, 1 and X are three digits, so the radix is 3.

Q132From DSSSB TGT Computer Science Practice Set 4
The following diagram shows a Diagram: inputs A and B enter an XOR-shaped gate that has an inversion bubble at its output; output Y = (A⊕B)'.
  1. AExclusive-Nor gate
  2. BNAND gate
  3. CAND gate
  4. DOR gate
Show answerHide answer

Correct answer: (A) Exclusive-Nor gate

Explanation

An XOR gate with an inverting bubble at the output computes (A⊕B)', which is the Exclusive-NOR gate.

Q133From DSSSB TGT Computer Science Practice Set 4
Consider the following statements : S1 : a small page size causes large page tables, S2 : internal fragmentation is increaseked with small pages. S3 : I/O transfers are more efficient with large pages. Which of the following is true?
  1. AS1 is true and S3 is false
  2. BS1 and S2 are true
  3. CS2 and S3 are true
  4. DS1 is true and S2 is false
Show answerHide answer

Correct answer: (D) S1 is true and S2 is false

Explanation

S1 is true, because small pages mean more pages and so bigger page tables. S2 is false, because small pages reduce internal fragmentation. S3 is true, because large pages make I/O more efficient. So the statement "S1 is true and S2 is false" holds.

Q134From 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.

Q135From DSSSB TGT Computer Science Practice Set 4
Assume X and Y are non-zero positive integers. Consider the following pseudo-code fragment: while X<>Y do if X>Y then X ← X−Y else Y ← Y−X endif end while print (X) What is the code doing?
  1. AIt computes the GCD of two numbers.
  2. BIt computes the LCM of two numbers.
  3. CIt finds the smallest of two numbers.
  4. DIt divides the largest number by the smaller.
Show answerHide answer

Correct answer: (A) It computes the GCD of two numbers.

Explanation

Subtracting the smaller number from the larger until both are equal is Euclid's subtraction method, so the final X is the GCD.

Q136From DSSSB TGT Computer Science Practice Set 4
Which of the following is the correct declaration of linked list?
  1. AStruct node* { int data; node * link; }
  2. BStruct node { int data; struct node* link; }
  3. CStruct node { int data; node link; }
  4. DStruct node* { int data; struct node* link; }
Show answerHide answer

Correct answer: (B) Struct node { int data; struct node* link; }

Explanation

A self-referential structure has a pointer to its own type: struct node { int data; struct node *link; };. A member of type node itself would be infinitely recursive.

Q137From 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.

Q138From DSSSB TGT Computer Science Practice Set 4
Which of the following is a special effect in motion pictures and animations that changes one image/picture into another through a seamless transition?
  1. AModeling
  2. BMorphing
  3. CAnimating
  4. DWrapping
Show answerHide answer

Correct answer: (B) Morphing

Explanation

Morphing smoothly transforms one image into another through a seamless series of in-between frames.

Q139From DSSSB TGT Computer Science Practice Set 4
Consider the following Java code segment: public class while /* line 1*/ { public void loop ( ) { int x = 0; While (1)/* line-6*/ { system. out. println("x plus one is" + (x+1)): } } } Which of the following is true ?
  1. AThere is a syntax error in line-1
  2. BThere are syntax errors in line- 1 and line- 6
  3. CThere is a syntax error in line- 6
  4. DNo syntax error
Show answerHide answer

Correct answer: (A) There is a syntax error in line-1

Explanation

while is a reserved keyword in Java, so it cannot be used as a class name. "public class while" is a syntax error on line 1.

Q140From DSSSB TGT Computer Science Practice Set 4
In the context of while loop and do-while loop in C++, which of the following is not true?
  1. ABoth the loops are repetitive in nature
  2. BBoth are conditional loops
  3. CBoth will be executed at least once
  4. DBoth are terminated when the condition becomes false.
Show answerHide answer

Correct answer: (C) Both will be executed at least once

Explanation

A do-while loop always runs at least once because it checks the condition after the body. A while loop may run zero times, so (C) is not true.

Q141From DSSSB TGT Computer Science Practice Set 4
Which of the following is not correct in C++?
  1. Ax−=2; is the same as x = x−2;
  2. Bx*= 2; is the same as x = x*2;
  3. Cx% =2; is the same as x = x/2;
  4. Dx/=2; is the same as x = x/2;
Show answerHide answer

Correct answer: (C) x% =2; is the same as x = x/2;

Explanation

x %= 2 means x = x % 2 (remainder), not x = x / 2 (division). So (C) is incorrect.

Q142From DSSSB TGT Computer Science Practice Set 4
Run-time polymorphism is achieved by ______.
  1. AFriend function
  2. BVirtual function
  3. COperator overloading
  4. DFunction overloading
Show answerHide answer

Correct answer: (B) Virtual function

Explanation

Virtual functions give run-time (dynamic) polymorphism: the function called is chosen at run time from the object's actual type. Overloading is resolved at compile time.

Q143From DSSSB TGT Computer Science Practice Set 4
Hardware mechanism that enables a device to notify the CPU is called:
  1. ABusy-waiting
  2. BInterrupt
  3. CPolling
  4. DDMA
Show answerHide answer

Correct answer: (B) Interrupt

Explanation

An interrupt is a hardware signal that a device sends to the CPU to request attention. Polling and busy-waiting are software checks made by the CPU.

Q144From DSSSB TGT Computer Science Practice Set 4
The address resolution protocol (ARP) is used for
  1. AFinding the IP address from DNS
  2. BFinding the IP address of the default gateway
  3. CFinding the IP address that corresponds to a MAC address
  4. DFinding the MAC address that corresponds to an IP address
Show answerHide answer

Correct answer: (D) Finding the MAC address that corresponds to an IP address

Explanation

ARP maps a known IP address to the matching MAC (hardware) address on a local network. RARP does the reverse.

Q145From DSSSB TGT Computer Science Practice Set 4
The number of crosspoints needed for 10 lines in a crosspoint switch, which is full duplex in nature and there is no self-connection, is
  1. A100
  2. B45
  3. C50
  4. D90
Show answerHide answer

Correct answer: (B) 45

Explanation

With full-duplex lines and no self-connection, each pair of lines needs one crosspoint. So the count is n(n−1)/2 = 10 × 9 / 2 = 45.

Q146From DSSSB TGT Computer Science Practice Set 4
In Huffman's coding, if the symbol A has probability 0.3, B has probability 0.15, C has probability 0.1, D has probability 0.25 and E has probability 0.2, then the minimum number of bits required to represent all the symbols together is
  1. A14
  2. B11
  3. C12
  4. D15
Show answerHide answer

Correct answer: (C) 12

Explanation

Huffman merges: 0.1 + 0.15 = 0.25, then 0.2 + 0.25 = 0.45, then 0.25 + 0.3 = 0.55, then 1. The code lengths are A 2, D 2, E 2, B 3, C 3, totalling 2 + 2 + 2 + 3 + 3 = 12 bits.

Q147From DSSSB TGT Computer Science Practice Set 4
X.21 is
  1. AA method of determining which device has access to the transmission medium at any time
  2. BA method access control technique or multiple access transmission media
  3. CVery common but oriented at linked protocol issued to ISO
  4. DA network access standard for connecting stations to a circuit switch network
Show answerHide answer

Correct answer: (D) A network access standard for connecting stations to a circuit switch network

Explanation

X.21 is an ITU-T standard interface for connecting stations (DTE) to circuit-switched digital networks.

Q148From DSSSB TGT Computer Science Practice Set 4
Which of the following activities does not belong to implementation phase of SDLC?
  1. AProgram testing
  2. BFile conversion
  3. CUser training
  4. DNew changes to the system
Show answerHide answer

Correct answer: (D) New changes to the system

Explanation

New changes to the system belong to maintenance. Testing, file conversion and user training are done in the implementation phase.

Q149From DSSSB TGT Computer Science Practice Set 4
Project risk factor is considered in
  1. AWaterfall model
  2. BPrototyping model
  3. CSpiral model
  4. DIterative enhancement model
Show answerHide answer

Correct answer: (C) Spiral model

Explanation

Boehm's spiral model explicitly analyses project risks in every cycle (a risk analysis quadrant), unlike the waterfall or prototyping models.

Q150From DSSSB TGT Computer Science Practice Set 4
According to PUTNAM, the project effort is inversely proportional to the fourth power of the development time. Doubling the development schedule for a 100 Person-Month (PM) project would reduce the project effort to
  1. A50 PM
  2. B7.16 PM
  3. C25 PM
  4. D6.25 PM
Show answerHide answer

Correct answer: (D) 6.25 PM

Explanation

Effort ∝ 1/t⁴, so doubling the time divides effort by 2⁴ = 16: 100 ÷ 16 = 6.25 PM.

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