DSSSB TGT / PGT · Topic-wise previous year questions

Computer Science Previous Year Questions (page 11)

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

Q501DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which symbol is used to represent an input/output operation in the flow chart?
  1. AOval
  2. BCircle
  3. CRectangle
  4. DParallelogram
Show answerHide answer

Correct answer: (D) Parallelogram

Explanation

In flowcharts a parallelogram shows input/output, a rectangle shows processing, an oval marks start/end and a diamond marks decisions.

Q502DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following is false regarding the machine language?
  1. AIt is machine dependent
  2. BIt easier to modify
  3. CIt is made up of 1's and 0's
  4. DIt is difficult to program
Show answerHide answer

Correct answer: (B) It easier to modify

Explanation

Machine language is hard to read and modify because it is pure binary and machine-dependent. So "easier to modify" is false.

Q503DSSSB PGT Computer Science (Technical), 11 Jul 2021
When the rules of the programming language are not followed it gives ________ errors.
  1. ASyntax
  2. BLogical
  3. Crun time
  4. DPrinting
Show answerHide answer

Correct answer: (A) Syntax

Explanation

Breaking the grammar rules of a language (e.g., a missing semicolon or misspelt keyword) causes syntax errors, which the compiler or interpreter reports.

Q504DSSSB PGT Computer Science (Technical), 11 Jul 2021
The speed of supercomputer is measured in ________.
  1. AFloating -point operations per hour
  2. BFloating -point operations per day
  3. CFloating -point operations per second
  4. DFloating-point operations per minute
Show answerHide answer

Correct answer: (C) Floating -point operations per second

Explanation

Supercomputer speed is measured in FLOPS (floating-point operations per second), e.g., petaFLOPS.

Q505DSSSB PGT Computer Science (Technical), 11 Jul 2021
What does the Form.StartPosition property represent in Visual Basic?
  1. AIt determine the end position of the form
  2. BIt determines the initial position of the form
  3. CIt determines the current position of the form
  4. DIt determines the next position of the form
Show answerHide answer

Correct answer: (B) It determines the initial position of the form

Explanation

Form.StartPosition sets where the form first appears when it opens (e.g., CenterScreen or Manual), that is, its initial position.

Q506DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following statement(s) is/are true about Break All Visual Basic toolbar buttons? I. Delete the selected item II. Pauses execution of your program
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (B) Only II

Explanation

The Break All button pauses (breaks) execution of the running program so it can be debugged. It does not delete items.

Q507DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which is not an acceptable control name in visual basic?
  1. AtxtAge
  2. BbtnCalc
  3. ClblDistance
  4. DtxtFirst+Last Name
Show answerHide answer

Correct answer: (D) txtFirst+Last Name

Explanation

Control names must be one word made of letters, digits and underscores. "txtFirst+Last Name" contains a + sign and a space, so it is invalid.

Q508DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the full form of IDE in visual basic?
  1. AIntegration development environment
  2. BIntegrated development environment
  3. CIntegrated drive electronics
  4. DIntegrated development electronics
Show answerHide answer

Correct answer: (B) Integrated development environment

Explanation

IDE means Integrated Development Environment: the editor, designer, compiler and debugger combined in one tool.

Q509DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the shortcut key of Step Over in Visual Basic?
  1. AF9
  2. BF10
  3. CF6
  4. DF11
Show answerHide answer

Correct answer: (B) F10

Explanation

In the Visual Studio/VB.NET debugger, F10 is Step Over (it runs a procedure call as one step), F11 is Step Into and F9 toggles a breakpoint.

Q510DSSSB PGT Computer Science (Technical), 11 Jul 2021
Match the following window of visual basic with their function. A. Immediate window — i. It Display the properties for the current object B. Properties window — ii. It design the form C. Project explorer windows — iii. It list the forms and modules for the current projects D. Design window — iv. It give current values of variables
  1. AA-iv, B-i, C-iii, D-ii
  2. BA-ii, B-i, C-iii, D-iv
  3. CA-i, B-iii, C-ii, D-iv
  4. DA-iv, B-iii, C-ii, D-i
Show answerHide answer

Correct answer: (A) A-iv, B-i, C-iii, D-ii

Explanation

The Immediate window shows/evaluates current variable values, the Properties window shows the selected object's properties, Project Explorer lists forms and modules, and the Design window is where the form is designed.

Q511DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which one of the following is correct regarding Programming Languages?
  1. AProcedural programming – Functions
  2. BObject-oriented programming – Objects
  3. CFunctional programming – Logical unit
  4. DLogical Programming – Function
Show answerHide answer

Correct answer: (B) Object-oriented programming – Objects

Explanation

Object-oriented programming is organised around objects. Procedural programming is built on procedures, functional programming on functions, and logic programming on facts and rules.

Q512DSSSB PGT Computer Science (Technical), 11 Jul 2021
In a modular programming approach problem is further divided into ________.
  1. AQuestion
  2. BSolution
  3. CModules
  4. DObject
Show answerHide answer

Correct answer: (C) Modules

Explanation

Modular programming breaks a problem into smaller, independent modules that are developed and tested separately.

Q513DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following statement(s) is/are correct about modular programming approach? I. Ease of use II. Reusability
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (C) Both I and II

Explanation

Breaking a program into modules makes it easier to use and maintain, and lets the modules be reused in other programs.

Q514DSSSB PGT Computer Science (Technical), 11 Jul 2021
How the object interact with each other in object oriented programming?
  1. ABy ringing
  2. BBy text
  3. CBy sending message
  4. DBy transmitting signal
Show answerHide answer

Correct answer: (C) By sending message

Explanation

Objects communicate by message passing, that is, one object calls another object's methods.

Q515DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the relation between object and class in an object oriented programming?
  1. AObject is keyword of class
  2. BObject is scope of class
  3. CObject is instance of class
  4. DObject is type of class
Show answerHide answer

Correct answer: (C) Object is instance of class

Explanation

A class is a blueprint, and an object is an instance of that class created in memory.

Q516DSSSB PGT Computer Science (Technical), 11 Jul 2021
In Object Oriented Programming, when a new class created from an existing class using principle of inheritance, then the new class is known as ________.
  1. ANew class
  2. BChild class
  3. CMember class
  4. DDerived class
Show answerHide answer

Correct answer: (D) Derived class

Explanation

A class created from an existing class by inheritance is called a derived class (subclass). The existing class is the base class.

Q517DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following is NOT an object oriented feature?
  1. AInheritance
  2. BAbduction
  3. CAbstraction
  4. DPolymorphism
Show answerHide answer

Correct answer: (B) Abduction

Explanation

Inheritance, abstraction, polymorphism and encapsulation are OOP features. Abduction is a form of logical reasoning, not an OOP feature.

Q518DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which one is NOT a feature of Python language?
  1. AHigh level language
  2. BInterpreted language
  3. CCase insensitive
  4. DPortable
Show answerHide answer

Correct answer: (C) Case insensitive

Explanation

Python is case sensitive (Name and name are different variables), so "case insensitive" is not one of its features. It is high-level, interpreted and portable.

Q519DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the meaning of >>> in Python Language?
  1. A3 left shift
  2. B3 right shift
  3. CInterpreter is ready to take instruction
  4. DCompiler is ready to take instruction
Show answerHide answer

Correct answer: (C) Interpreter is ready to take instruction

Explanation

>>> is the prompt of Python's interactive interpreter (shell), meaning it is ready to accept a statement.

Q520DSSSB PGT Computer Science (Technical), 11 Jul 2021
The given declaration statement in Python Language belongs to which data type? >>> Student = {'SUBJECT' : 'Compiler', 'Marks' : '50', 'Grade' : 'C'}
  1. ANumbers
  2. BSequence
  3. CSets
  4. DDictionary
Show answerHide answer

Correct answer: (D) Dictionary

Explanation

Curly braces holding key : value pairs create a dictionary (dict) in Python.

Q521DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which statement(s) is/are NOT true about the variables in Python Language: I. Values of every variable can be changed once a variable has been created and assigned value. II. Assignment statement is used to create a new variable and assign value.
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (A) Only I

Explanation

Statement II is true: assignment creates a variable and binds a value. Statement I is treated as not true because a variable can only be rebound; values of immutable objects such as strings and tuples cannot be changed in place.

Q522DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the output of this code in Python Language: >>> x = 125 >>> y = 13 >>> x //= y >>> x
  1. A9
  2. B125/13
  3. C10
  4. D9.62
Show answerHide answer

Correct answer: (A) 9

Explanation

x //= y is floor division: 125 // 13 = 9 (13 × 9 = 117, remainder 8), so x becomes 9.

Q523DSSSB PGT Computer Science (Technical), 11 Jul 2021
Match the following with respect to Event Driven Programming. I. Event — A. Perform said event II. Event listener — B. User interaction III. Event handler — C. Event monitored by code
  1. AI-A, II-B, III-C
  2. BI-C, II-A, III-B
  3. CI-B, II-A, III-C
  4. DI-B, II-C, III-A
Show answerHide answer

Correct answer: (C) I-B, II-A, III-C

Explanation

Note: the answer key gives (C), but the logical match is (D): an event is a user interaction, an event listener monitors for the event, and an event handler performs the action for it.

Q524DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is responsibility of event queue in event driven programming?
  1. ACreate new event
  2. BDelete the event
  3. CMake a sequence in which event is executed
  4. DChange the event
Show answerHide answer

Correct answer: (C) Make a sequence in which event is executed

Explanation

The event queue holds incoming events and decides the order (sequence) in which they are dispatched and handled.

Q525DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is output of the code in Python Language: >>> str1 = 'All the Best' >>> str1[-3]
  1. A'l'
  2. B'e'
  3. C'h'
  4. D'B'
Show answerHide answer

Correct answer: (B) 'e'

Explanation

'All the Best' has 12 characters, so index −3 is index 9. Indexes 8-11 are B, e, s, t, so str1[-3] is 'e'.

Q526DSSSB PGT Computer Science (Technical), 11 Jul 2021
A complete binary tree T have n leaf nodes. What is the number of nodes with degree of 2 in tree T?
  1. An
  2. Bn/2
  3. Cn − 1
  4. D2n
Show answerHide answer

Correct answer: (C) n − 1

Explanation

In any binary tree, the number of leaf nodes is one more than the number of nodes with two children, so n leaves means n − 1 nodes of degree 2.

Q527DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the value of the (Start → Next) → Next) → Info in the given list? Start → [125] → [140] → [128] → [130 | ×]
  1. A125
  2. B140
  3. C128
  4. D130
Show answerHide answer

Correct answer: (C) 128

Explanation

Start→Next is the node holding 140, and its Next is the node holding 128, so the Info is 128.

Q528DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which statement is true about condition of overflow in the circular Queue? I. Front = 1 and Rear = N II. Front = Rear + 1
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (C) Both I and II

Explanation

In a 1-based circular queue of size N, it is full (overflow) when Front = 1 and Rear = N, or when Front = Rear + 1 (rear has wrapped round to just behind front).

Q529DSSSB PGT Computer Science (Technical), 11 Jul 2021
The numbers 70, 50, 10, 80, 30, 60, 100, 90, 40, 20 are inserted in the given order in to a binary search tree. What is the in-order traversal sequence of the resultant binary search tree?
  1. A70, 50, 10, 80, 30, 60, 100, 90, 40, 20
  2. B100, 90, 80, 70, 60, 50, 40, 30, 20, 10
  3. C10, 30, 50, 70, 90, 20, 40, 60, 80, 100
  4. D10, 20, 30, 40, 50, 60, 70, 80, 90, 100
Show answerHide answer

Correct answer: (D) 10, 20, 30, 40, 50, 60, 70, 80, 90, 100

Explanation

In-order traversal of any binary search tree visits the keys in ascending sorted order: 10, 20, ..., 100.

Q530DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is balance factor of an AVL tree?
  1. A|h(TL)| ≤ 1
  2. B|h(TR)| ≤ 1
  3. C|h(TL) − h(TR)| ≤ 1
  4. D|h(TL) + h(TR)| ≤ 1
Show answerHide answer

Correct answer: (C) |h(TL) − h(TR)| ≤ 1

Explanation

In an AVL tree, the heights of the left and right subtrees of every node differ by at most 1: |h(TL) − h(TR)| ≤ 1.

Q531DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the average number of comparisons required in sequential search to find an element?
  1. An²
  2. Bn(n + 1)/2
  3. Cn
  4. D(n + 1)/2
Show answerHide answer

Correct answer: (D) (n + 1)/2

Explanation

If the item is equally likely to be at any position, the average number of comparisons is (1 + 2 + ... + n)/n = (n + 1)/2.

Q532DSSSB PGT Computer Science (Technical), 11 Jul 2021
Arrange the following complexity of the algorithm in ascending order. O(2ⁿ), O(n), O(log₂n), O(n log₂n), O(n²)
  1. AO(log₂n), O(n), O(n log₂n), O(n²), O(2ⁿ)
  2. BO(n), O(log₂n), O(n log₂n), O(n²), O(2ⁿ)
  3. CO(n), O(n²), O(log₂n), O(n log₂n), O(2ⁿ)
  4. DO(log₂n), O(n log₂n), O(n), O(n²), O(2ⁿ)
Show answerHide answer

Correct answer: (A) O(log₂n), O(n), O(n log₂n), O(n²), O(2ⁿ)

Explanation

For large n the growth order is log n < n < n log n < n² < 2ⁿ.

Q533DSSSB PGT Computer Science (Technical), 11 Jul 2021
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?
  1. A2i + 2j
  2. B2i + j − 2
  3. Ci + j
  4. 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.

Q534DSSSB PGT Computer Science (Technical), 11 Jul 2021
How many different binary search trees can be constructed with 6 different nodes?
  1. A64
  2. B128
  3. C32
  4. D132
Show answerHide answer

Correct answer: (D) 132

Explanation

The number of distinct BSTs on n keys is the Catalan number C(n) = (2n)!/((n+1)! n!). For n = 6 this is 132.

Q535DSSSB PGT Computer Science (Technical), 11 Jul 2021
Consider a sorted array of 10,00,000 elements. What is the maximum number of comparison required to find the location an item using binary search?
  1. A20
  2. B6
  3. C31
  4. D7
Show answerHide answer

Correct answer: (A) 20

Explanation

Binary search needs at most ⌈log₂(n+1)⌉ comparisons. 2²⁰ = 1,048,576 ≥ 10,00,000, so the maximum is 20.

Q536DSSSB PGT Computer Science (Technical), 11 Jul 2021
Using division method [n(k) = k mod m], at which position 177 and 197 key values are stored in hash table when the size of hash table is 57?
  1. A6, 26
  2. B7, 27
  3. C26, 6
  4. D27, 7
Show answerHide answer

Correct answer: (A) 6, 26

Explanation

177 mod 57 = 177 − 171 = 6 and 197 mod 57 = 197 − 171 = 26.

Q537DSSSB PGT Computer Science (Technical), 11 Jul 2021
Consider an array A[2 : 8, −4 : 1, 6 : 10]. Base address of array A is = 400 and size of each element = 2 word per memory cell. What is the address of A[5, −1, 8] in row major form?
  1. A628
  2. B614
  3. C630
  4. D626
Show answerHide answer

Correct answer: (A) 628

Explanation

Note: DSSSB allowed option (a) as correct (the computed value 614 does not match the official key).

Q538DSSSB PGT Computer Science (Technical), 11 Jul 2021
Inorder and postorder traversal of a binary tree are given. In: E, I, C, F, B, G, D, J, H, K Post: I, E, F, C, G, J, K, H, D, B What is the preorder traversal of the binary tree?
  1. AB, C, E, I, F, D, G, H, J, K
  2. BB, F, I, E, C, D, G, H, J, K
  3. CB, C, E, I, F, D, G, H, K, J
  4. DB, C, E, F, G, H, K, D, J, I
Show answerHide answer

Correct answer: (A) B, C, E, I, F, D, G, H, J, K

Explanation

The root is B (last in postorder). Left subtree {E,I,C,F} has root C, with E (right child I) and F. Right subtree {G,D,J,H,K} has root D, with left G and right H (J, K). Preorder: B, C, E, I, F, D, G, H, J, K.

Q539DSSSB PGT Computer Science (Technical), 11 Jul 2021
Two way merge sort algorithm is used to sort the following elements in ascending order. 200, 470, 150, 80, 90, 40, 400, 300, 120, 70. What is the order of these elements after second pass of the merge sort algorithm?
  1. A40, 70, 80, 90, 120, 150, 200, 300, 400, 470
  2. B200, 470, 80, 150, 40, 90, 300, 400, 70, 120
  3. C80, 150, 200, 470, 40, 90, 300, 400, 70, 120
  4. D40, 80, 90, 150, 200, 300, 400, 470, 70, 120
Show answerHide answer

Correct answer: (C) 80, 150, 200, 470, 40, 90, 300, 400, 70, 120

Explanation

Pass 1 merges pairs: (200,470)(80,150)(40,90)(300,400)(70,120). Pass 2 merges runs of two into fours: 80,150,200,470 | 40,90,300,400 | 70,120.

Q540DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the complexity of selection sort algorithms?
  1. AO(n)
  2. BO(n log₂n)
  3. CO(n²)
  4. DO(2n)
Show answerHide answer

Correct answer: (C) O(n²)

Explanation

Selection sort always makes about n²/2 comparisons, scanning the unsorted part for the minimum on each of n passes, so it is O(n²) in every case.

Q541DSSSB PGT Computer Science (Technical), 11 Jul 2021
In C++, namespace defines a ________ for the identifiers that are used in a program.
  1. Asize
  2. Bscope
  3. Csyntax
  4. Dstandard
Show answerHide answer

Correct answer: (B) scope

Explanation

A namespace defines a named scope for identifiers, so names such as std::cout do not clash with the same names elsewhere.

Q542DSSSB PGT Computer Science (Technical), 11 Jul 2021
In C++, operator '>>' is used along with object cin for reading input is known as ________.
  1. Aextraction
  2. Boutput
  3. Cget in
  4. Dput to
Show answerHide answer

Correct answer: (A) extraction

Explanation

>> with cin is the extraction (get from) operator, and << with cout is the insertion (put to) operator.

Q543DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following statement(s) is/are correct regarding void keyword in C++? I. To specify the return type of a function when it is not returning any value. II. To indicate an empty argument list to a function.
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (C) Both I and II

Explanation

void is used as the return type of a function that returns nothing, and as in f(void) it shows an empty argument list.

Q544DSSSB PGT Computer Science (Technical), 11 Jul 2021
In C++, bool data type is used to hold how many values?
  1. An²
  2. B2
  3. C2n
  4. D2ⁿ
Show answerHide answer

Correct answer: (B) 2

Explanation

bool holds only two values: true and false.

Q545DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which of the following is specified by function prototype in C++? I. Return Type II. Function name III. Number and types of argument
  1. AI and II
  2. BI and III
  3. CII and III
  4. DI, II and III
Show answerHide answer

Correct answer: (D) I, II and III

Explanation

A function prototype states the return type, the function name, and the number and types of its arguments.

Q546DSSSB PGT Computer Science (Technical), 11 Jul 2021
What is the symbol and associativity of the assignment operator in C++?
  1. A=, left to right
  2. B==, left to right
  3. C(R), right to left
  4. D=, right to left
Show answerHide answer

Correct answer: (D) =, right to left

Explanation

The assignment operator is = and it associates right to left, so a = b = c assigns c to b first, then b to a.

Q547DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which statement is correct about static member function in C++? I. It can access to only other static members declared in the same class. II. It cannot be called using the class name (instead of its objects)
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (A) Only I

Explanation

A static member function can access only static members of its class, and it can be called with the class name (Class::f()). So only I is correct.

Q548DSSSB PGT Computer Science (Technical), 11 Jul 2021
Which statement is NOT correct regarding ternary operator in C++?
  1. AIts symbol is?:
  2. BIt is also known as conditional operator
  3. COperator overloading is possible in it
  4. DIt is similar to if else
Show answerHide answer

Correct answer: (C) Operator overloading is possible in it

Explanation

The ternary operator ?: is one of the C++ operators that cannot be overloaded, along with ::, . and .*. The other statements about it are true.

Q549DSSSB PGT Computer Science (Technical), 11 Jul 2021
By default in C++, the member of a class are ________, while, by default the member of structure are ________.
  1. APrivate; private
  2. BPublic; public
  3. CPrivate; public
  4. DPublic; private
Show answerHide answer

Correct answer: (C) Private; public

Explanation

In C++, class members are private by default, while struct members are public by default.

Q550DSSSB PGT Computer Science (Technical), 11 Jul 2021
Match the following. i. Overriding — A. Allows a function of operator to be given more then one definition ii. Over loading — B. A function that is called to deallocate memory iii. Destructor — C. The ability to change the definition of an inherited method
  1. Ai-A, ii-C, iii-B
  2. Bi-C, ii-B, iii-A
  3. Ci-C, ii-A, iii-B
  4. Di-B, ii-C, iii-A
Show answerHide answer

Correct answer: (C) i-C, ii-A, iii-B

Explanation

Overriding redefines an inherited method in a derived class, overloading gives one function or operator several definitions, and a destructor releases memory/resources when an object is destroyed.

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