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.
When the rules of the programming language are not followed it gives ________ errors.
ASyntax
BLogical
Crun time
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.
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
AOnly I
BOnly II
CBoth I and II
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.
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
AA-iv, B-i, C-iii, D-ii
BA-ii, B-i, C-iii, D-iv
CA-i, B-iii, C-ii, D-iv
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.
Object-oriented programming is organised around objects. Procedural programming is built on procedures, functional programming on functions, and logic programming on facts and rules.
In Object Oriented Programming, when a new class created from an existing class using principle of inheritance, then the new class is known as ________.
ANew class
BChild class
CMember class
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.
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.
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.
AOnly I
BOnly II
CBoth I and II
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.
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
AI-A, II-B, III-C
BI-C, II-A, III-B
CI-B, II-A, III-C
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.
Which statement is true about condition of overflow in the circular Queue?
I. Front = 1 and Rear = N
II. Front = Rear + 1
AOnly I
BOnly II
CBoth I and II
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).
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?
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.
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?
A628
B614
C630
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).
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?
AB, C, E, I, F, D, G, H, J, K
BB, F, I, E, C, D, G, H, J, K
CB, C, E, I, F, D, G, H, K, J
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.
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?
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.
AOnly I
BOnly II
CBoth I and II
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.
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)
AOnly I
BOnly II
CBoth I and II
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.
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
Ai-A, ii-C, iii-B
Bi-C, ii-B, iii-A
Ci-C, ii-A, iii-B
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.