DSSSB TGT / PGT · Computer Science

Data Structures Previous Year Questions (page 3)

144 Data Structures (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.

  • 144 questions
  • Official answer key
  • Free

Other Computer Science topics

Q101DSSSB TGT Computer Science (Technical), 13 Sep 2025, Shift 3 (5:00 PM)
Which of the following is an advantage of the linked list over an array?
  1. ALinked list takes less storage to store the n elements as compared to array.
  2. BLinked list takes less time to access the ith element as compared to array.
  3. CInserting an element at beginning of the linked list takes less time as compared to array.
  4. DInserting an element as last element of the linked list takes less time as compared to array.
Show answerHide answer

Correct answer: (C) Inserting an element at beginning of the linked list takes less time as compared to array.

Explanation

Inserting at the beginning of a linked list only changes the head pointer, which is O(1). An array must shift every element, which is O(n). Array access by index is faster.

Q102DSSSB TGT Computer Science (Technical), 13 Sep 2025, Shift 3 (5:00 PM)
Which of the following library file functions in C program is/are correct? fwrite()- This function is used for writing an entire block to a given file. fseek()- This function is used for setting the file position pointer at the specified byte. ftell()- This function is used to move the file position pointer to the beginning of the file.
  1. Afwrite(), ftell()
  2. Bfwrite(), fseek()
  3. Cfseek(), ftell()
  4. Dfwrite(), fseek(), ftell()
Show answerHide answer

Correct answer: (B) fwrite(), fseek()

Explanation

fwrite() writes a block of data, and fseek() sets the file position pointer. ftell() only returns the current position; rewind() is the function that moves to the beginning.

Q103DSSSB TGT Computer Science (Technical), 13 Sep 2025, Shift 3 (5:00 PM)
What is the primary advantage of a doubly linked list over a singly linked list?
  1. AIt has faster insertion and deletion operations.
  2. BIt is easier to implement.
  3. CIt uses less memory.
  4. DIt allows traversal in both directions.
Show answerHide answer

Correct answer: (D) It allows traversal in both directions.

Explanation

A doubly linked list has both next and prev pointers, so it can be traversed forward and backward. It uses more memory than a singly linked list.

Q104DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
In a message queue, how are messages stored?
  1. AIn a queue structure
  2. BIn a circular buffer
  3. CIn a stack structure
  4. DIn a linked list
Show answerHide answer

Correct answer: (A) In a queue structure

Explanation

A message queue stores messages in FIFO order: messages are added at the rear and the receiver takes them from the front.

Q105DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
A 2D array B[4][5] is stored in row-major order. The base address of the array is 5000, and each element occupies 2 bytes. What is the address of B[2][3]?
  1. A5054
  2. B5039
  3. C5048
  4. D5026
Show answerHide answer

Correct answer: (D) 5026

Explanation

Row-major address = Base + (i × columns + j) × size = 5000 + (2 × 5 + 3) × 2 = 5000 + 26 = 5026.

Q106DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
Which of the following is a correct way of declaring an array of 15 integer elements in C?
  1. Aarray int[15];
  2. Barray int(15);
  3. Cint array[15];
  4. Dint array(15);
Show answerHide answer

Correct answer: (C) int array[15];

Explanation

In C an array is declared as type name[size], so int array[15]; declares 15 integers. The other forms are not valid C syntax.

Q107DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
Consider the given memory representation of the singly linked list where start points to the address of first node of the linked list, which is memory location 0. Memory representation of the singly linked list Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 2 2 | B | NULL 3 | | 4 | C | 1 If a new node whose data value is X is inserted after the node whose data value is E in any free location available in the memory, then what will the memory representation be after inserting the new node?
  1. AMemory representation of the linked list after inserting node X Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 2 2 | B | NULL 3 | X | 1 4 | C | 3
  2. BMemory representation of the linked list after inserting node X Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 3 2 | B | NULL 3 | X | 2 4 | C | 1
  3. CMemory representation of the linked list after inserting node X Memory location | Item value | Pointer to next element 0 | A | 3 1 | E | 2 2 | B | NULL 3 | X | 4 4 | C | 1
  4. DMemory representation of the linked list after inserting node X Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 2 2 | B | 3 3 | X | NULL 4 | C | 1
Show answerHide answer

Correct answer: (B) Memory representation of the linked list after inserting node X Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 3 2 | B | NULL 3 | X | 2 4 | C | 1

Explanation

The list is A(0) → C(4) → E(1) → B(2). X goes into free location 3. E's pointer changes to 3, and X points to B at 2, giving A → C → E → X → B as in option B.

Q108DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
Suppose the two dimensional array is declared as int arr[2][2] = {{1,2},{3,4}}; Then which of the following will not give the output 4?
  1. A*(*arr + 1)
  2. Barr[1][1]
  3. C*(arr[1] + 1)
  4. D*(*(arr + 1) + 1)
Show answerHide answer

Correct answer: (A) *(*arr + 1)

Explanation

*arr is arr[0], so *(*arr + 1) is arr[0][1] = 2, not 4. The other three expressions all mean arr[1][1] = 4.

Q109DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
Which of the following is INCORRECT about singly linked list data structure?
  1. AIt is a linear data structure.
  2. BThe elements of the linked list are sequentially accessible.
  3. CThe list's head node is the first node, while the last node pointer field points to NULL to denote the list's end.
  4. DThe elements of the linked list are randomly accessible.
Show answerHide answer

Correct answer: (D) The elements of the linked list are randomly accessible.

Explanation

Option D is incorrect: a singly linked list has no index arithmetic, so you must walk from the head node by node to reach an element. It has sequential access, not random access.

Q110DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
What happens to the stack pointer (SP) when the CALL instruction is executed?
  1. AIt remains unchanged.
  2. BIt points to the next instruction in the subroutine.
  3. CIt increases by 2 (or 4 in 32-bit systems)
  4. DIt decreases by 2 (or 4 in 32-bit systems)
Show answerHide answer

Correct answer: (D) It decreases by 2 (or 4 in 32-bit systems)

Explanation

CALL pushes the return address onto the stack. The stack grows downward, so SP is decreased by 2 (or by 4 on 32-bit systems) before the address is stored.

Q111DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)
Calculate the worst-case time complexity of searching for an element in a singly linked list with 'n' elements.
  1. AO(log 1)
  2. BO(n)
  3. CO(1 log)
  4. DO(1)
Show answerHide answer

Correct answer: (B) O(n)

Explanation

A linked list must be traversed node by node from the head. In the worst case the key is the last node or is missing, which needs n comparisons, so the time is O(n).

Q112DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What ensures the integrity of a digital signature?
  1. AThe encryption algorithm used
  2. BHash value of the original message
  3. CThe Certificate Authority’s approval
  4. DThe private key of the receiver
Show answerHide answer

Correct answer: (B) Hash value of the original message

Explanation

The sender signs a hash (message digest) of the message. The receiver recomputes the hash and compares it; any change to the message gives a different hash, so the hash value guarantees integrity.

Q113DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
In the context of array types, what is the key difference between int *arr[5] and int (*arr) [5]?
  1. ABoth are syntactically incorrect
  2. BFirst is a pointer to an array, second is an array of pointers
  3. CThey are identical in their functionality
  4. DFirst is an array of pointers to integers, second is a pointer to an array of integers
Show answerHide answer

Correct answer: (D) First is an array of pointers to integers, second is a pointer to an array of integers

Explanation

[] binds tighter than *, so int *arr[5] is an array of 5 pointers to int. The parentheses in int (*arr)[5] make arr a single pointer to an array of 5 ints.

Q114DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is true about passing arguments by reference in PHP functions?
  1. AArguments passed by reference cannot be modified within the function.
  2. BThe original value of the argument is changed when passed by reference.
  3. CPHP does not support passing arguments by reference.
  4. DArguments passed by reference must be of type array.
Show answerHide answer

Correct answer: (B) The original value of the argument is changed when passed by reference.

Explanation

In PHP, a parameter declared with & (function f(&$x)) is a reference to the caller's variable, so changing it inside the function changes the original value. Any type can be passed by reference.

Q115DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Suppose there are 15 elements in the array that apply bubble sort technique to sort the elements of the array. What is the maximum number of comparisons, in worst case, required to sort the elements of array in ascending order?
  1. A120
  2. B210
  3. C105
  4. D225
Show answerHide answer

Correct answer: (C) 105

Explanation

Bubble sort makes (n-1) + (n-2) + ... + 1 = n(n-1)/2 comparisons in the worst case. For n = 15 that is 15 x 14 / 2 = 105.

Q116DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider a singly linked list containing n elements in which A is the address of the starting node of the linked list. If we first convert the linked list to an array, then sort the array elements, and then create a new linked list from the elements of the sorted array, what is the number of operations required to traverse the linked list and store its data values ​in an additional array before applying sorting?
  1. AO(n log n)
  2. BO(log n)
  3. CO(n)
  4. DO(n²)
Show answerHide answer

Correct answer: (C) O(n)

Explanation

Copying the data needs a single pass through the list, visiting each of the n nodes once, so it takes O(n) operations. The later sorting step is what needs O(n log n).

Q117DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Suppose there are n elements in an array. If we want to delete the beginning element of an array, then how many shift operations are required to fill the gap left by the deleted element?
  1. An*(n − 1)/2
  2. Bn − 1
  3. C1
  4. Dn²
Show answerHide answer

Correct answer: (B) n − 1

Explanation

After deleting a[0], each of the remaining n - 1 elements must move one position left, so n - 1 shift operations are needed.

Q118DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider the given memory representation of singly linked list where start points to the address of the starting node of the linked list, which is in memory location 0. Memory representation of the linked list Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 3 2 | B | NULL 3 | X | 2 4 | C | 1 If you traverse all the elements from the given linked list, then which of the following is correct order?
  1. AA, B, C, E, X
  2. BA, E, B, X, C
  3. CA, C, X, E, B
  4. DA, C, E, X, B
Show answerHide answer

Correct answer: (D) A, C, E, X, B

Explanation

Start at location 0 (A, next 4), then 4 (C, next 1), 1 (E, next 3), 3 (X, next 2), 2 (B, next NULL). So the order is A, C, E, X, B.

Q119DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which sorting algorithm performs the worst when the input array is nearly sorted?
  1. ABubble Sort
  2. BInsertion Sort
  3. CHybrid Sort
  4. DMax Sort
Show answerHide answer

Correct answer: (B) Insertion Sort

Explanation

Note: the answer key gives (B), but insertion sort is actually the best choice for a nearly sorted array: each element moves only a few places, so it runs in close to O(n) time. The question seems to have intended "best" rather than "worst".

Q120DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Suppose in C program, the variable j is declared as int *j. What is the meaning of operator * in this declaration?
  1. AAllocating memory to j
  2. BMakes variable j as pointer to an integer
  3. CMakes variable j as integer to float
  4. DAn integer is multiplied by the value contained in j
Show answerHide answer

Correct answer: (B) Makes variable j as pointer to an integer

Explanation

In a declaration, * makes j a pointer variable that can store the address of an int. It does not allocate the pointed-to memory or multiply anything.

Q121DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
In C programming, which of the following is correct about why all pointers should be set to NULL if they are not pointing to anything?
  1. AWhen a pointer is initialized to NULL, it does not help in avoiding dangling pointers (pointers that reference invalid or deallocated memory).
  2. BSetting pointers to NULL is merely a norm and has no effect on program execution.
  3. CIf a pointer is not pointing to anything, the program won’t execute at all, giving a syntax error message.
  4. DWhen a pointer is initialized to NULL, it signifies that the pointer does not currently reference any valid memory location.
Show answerHide answer

Correct answer: (D) When a pointer is initialized to NULL, it signifies that the pointer does not currently reference any valid memory location.

Explanation

A NULL pointer explicitly marks that the pointer refers to no valid memory, so the code can test if (p == NULL) before use, avoiding accidental use of garbage or dangling addresses.

Q122DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
In an acyclic graph directory structure, what is a common method used to implement shared directories or files?
  1. AFile duplication
  2. BSymbolic (soft) links
  3. CHard links
  4. DDirectory pointers
Show answerHide answer

Correct answer: (B) Symbolic (soft) links

Explanation

In an acyclic-graph directory, a shared file or subdirectory is usually implemented with a link, a special directory entry (symbolic link) that holds the path of the real file, so the same file appears in several directories without copying.

Q123DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
What does the first dimension and the second dimension represents in a two-dimensional character array?
  1. AThe first dimension stores the length of each name, and the second stores the number of names.
  2. BThe first dimension represents the number of names in the array, and the second dimension represents the maximum length of each name.
  3. CThe first dimension represents the maximum length of the names, and the second dimension represents the number of names.
  4. DThe first dimension holds the total number of characters, and the second dimension stores the number of names.
Show answerHide answer

Correct answer: (B) The first dimension represents the number of names in the array, and the second dimension represents the maximum length of each name.

Explanation

In char names[N][L], the first dimension is the number of strings (rows) and the second is the maximum length of each string, including the null character.

Q124DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
What will be the output of the C program given below? #include <stdio.h> int* func() { static int arr[5] = { 1, 2, 3, 4, 5 }; return arr; } int main() { int* ptr = func(); printf("Array Elements: "); for (int i = 0; i < 5; i++) { printf("%d ", *ptr); } return 0; }
  1. A1 1 3 4 1
  2. B2 3 4 5 0
  3. C1 2 3 4 5
  4. D1 1 1 1 1
Show answerHide answer

Correct answer: (D) 1 1 1 1 1

Explanation

ptr is never incremented inside the loop, so *ptr always reads arr[0] = 1, printing 1 five times (after "Array Elements: "). To print 1 2 3 4 5 the loop would need ptr[i] or *(ptr + i).

Q125DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
Which sorting technique is best for sorting a linked list with n elements?
  1. AInsertion sort
  2. BBubble sort
  3. CMerge sort
  4. DSelection sort
Show answerHide answer

Correct answer: (C) Merge sort

Explanation

Merge sort suits linked lists: it needs only sequential access, splits the list by moving pointers, merges without extra arrays and runs in O(n log n). Other sorts are O(n²) or need random access.

Q126DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
Which of the following PHP functions is used to sort an array in ascending order without affecting the keys?
  1. Aksort()
  2. Barray_sort()
  3. Casort()
  4. Dsort()
Show answerHide answer

Correct answer: (C) asort()

Explanation

asort() sorts an array by value in ascending order while keeping each key associated with its value. sort() re-indexes the keys, and ksort() sorts by key.

Q127DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
Which of the following is NOT a correct way of declaring and initializing array in C?
  1. Achar arr[6] ={2};
  2. Bchar arr[ ] = “consultancy”;
  3. Cchar arr[6];              arr = “consultancy”;
  4. Dchar arr[6] ={ };
Show answerHide answer

Correct answer: (C) char arr[6];              arr = “consultancy”;

Explanation

An array name is not a modifiable lvalue, so a string cannot be assigned with arr = "..." after declaration (and "consultancy" needs 12 chars, more than 6). Strings must be given at initialisation or copied with strcpy.

Q128DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
In singly linked list, each node of the list consists of ___________.
  1. Adata value and address of next node
  2. BNULL and address of the next node
  3. CNULL and address of the previous node
  4. Ddata value and address of previous node
Show answerHide answer

Correct answer: (A) data value and address of next node

Explanation

Each node of a singly linked list holds the data and a pointer (address) to the next node; the last node's pointer is NULL. A previous-node pointer is used in doubly linked lists.

Q129DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
Which of the following is a disadvantage of singly linked list?
  1. AAccessing an element in a singly linked list requires traversal from the head, making it slower than arrays.
  2. BDeletion operation at the beginning of the linked list is performed in O(1) time.
  3. CInsertion operation at the beginning of the linked list is performed in O (1) time.
  4. DLinked lists have a variable size.
Show answerHide answer

Correct answer: (A) Accessing an element in a singly linked list requires traversal from the head, making it slower than arrays.

Explanation

To reach the k-th element in a singly linked list you must traverse from the head, O(n), whereas arrays allow direct access by index. O(1) insertion and deletion at the start and variable size are advantages.

Q130DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)
Calculate the time complexity of deleting an element from the beginning of a dynamic array.
  1. AO(log)
  2. BO(1)
  3. CO(log n)
  4. DO(n)
Show answerHide answer

Correct answer: (D) O(n)

Explanation

Removing the first element of a dynamic array requires shifting the remaining n - 1 elements one place left, so it takes O(n) time.

Q131DSSSB TGT Computer Science, 25 Jun 2023, Shift 1 (8:30 AM)
Which of the following types of XML parsers is an object that contains all the information of an XML document and is composed like a tree structure?
  1. ADOS
  2. BSAX
  3. CDOM
  4. DSAY
Show answerHide answer

Correct answer: (C) DOM

Explanation

A DOM parser loads the whole XML document into memory as a tree of objects. SAX is event-based and builds no tree.

Q132DSSSB TGT Computer Science, 25 Jun 2023, Shift 1 (8:30 AM)
The operations of a ______ require that the first element that is inserted is the first one to be removed?
  1. Aunion
  2. Bgraph
  3. Cstack
  4. Dqueue
Show answerHide answer

Correct answer: (D) queue

Explanation

A queue is FIFO (first in, first out), so the first element inserted is the first removed. A stack is LIFO.

Q133DSSSB TGT Computer Science, 25 Jun 2023, Shift 1 (8:30 AM)
Which of the following is a java primitive data type?
  1. AArray
  2. BString
  3. CClasses
  4. DByte
Show answerHide answer

Correct answer: (D) Byte

Explanation

byte is one of Java's eight primitive types (byte, short, int, long, float, double, char, boolean). Arrays, String and classes are reference types.

Q134DSSSB TGT Computer Science, 25 Jun 2023, Shift 1 (8:30 AM)
Which of the following is true with reference to Queue Data Structure in the C programming language? (i) Insertion can take place from the front end. (ii) Deletion can take place from the rear end.
  1. ANeither (i) nor (ii)
  2. BBoth (i) and (ii)
  3. COnly (i)
  4. DOnly (ii)
Show answerHide answer

Correct answer: (A) Neither (i) nor (ii)

Explanation

Neither statement is true. In a queue, insertion (enqueue) happens at the rear and deletion (dequeue) at the front.

Q135DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
In a path-graph having 'n' vertices, where 'n' > 2, is the number ofvefiices with degree 2.
  1. A3
  2. Bn − 2
  3. C2
  4. D0
Show answerHide answer

Correct answer: (B) n − 2

Explanation

In a path graph the two end vertices have degree 1 and every other vertex has degree 2, so n − 2 vertices have degree 2.

Q136DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of the following inflations describes how demand for goods and services can drive up their prices?
  1. ACost-push inflation
  2. BBuilt-in Inflation
  3. CDemand-pull inflation
  4. DDemand-push inflation
Show answerHide answer

Correct answer: (C) Demand-pull inflation

Explanation

Demand-pull inflation happens when total demand exceeds supply and pulls prices up. Cost-push inflation comes from rising production costs.

Q137DSSSB TGT Computer Science, 7 Feb 2024, Shift 2 (12:30 PM)
In Python language, which of following mode for opening the file, opens the file for both reading and writing and file pointer will be placed at the start of the file?
  1. Aab
  2. Brb
  3. Cr⁺
  4. Da⁺
Show answerHide answer

Correct answer: (C) r⁺

Explanation

"r+" opens a file for reading and writing with the file pointer at the beginning. "a+" places it at the end; "rb" is read-only and "ab" append-only.

Q138DSSSB TGT Computer Science, 7 Feb 2024, Shift 2 (12:30 PM)
Which of the following is a one-dimensional labelled array capable of holding any data type (integers, strings, floating point numbers, python objects, etc) in data handling with pandas?
  1. ASeries
  2. BMissing data
  3. CData frames
  4. DIteration
Show answerHide answer

Correct answer: (A) Series

Explanation

A pandas Series is a one-dimensional labelled array that can hold any data type. A DataFrame is two-dimensional.

Q139DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
What is the main difference between a stack and a queue data structure?
  1. AA queue is more efficient for inserting and deleting elements at any position, while a stack is more efficient for inserting and deleting elements at the front and back.
  2. BA stack is more efficient for inserting and deleting elements at any position, while a queue is more efficient for inserting and deleting elements at the front and back.
  3. CA stack follows a LIFO (last-in, first-out) order, while a queue follows a FIFO (first-in, first-out) order.
  4. DA queue follows a LIFO (last-in, first-out) order, while a stack follows a FIFO (first-in, first-out) order.
Show answerHide answer

Correct answer: (C) A stack follows a LIFO (last-in, first-out) order, while a queue follows a FIFO (first-in, first-out) order.

Explanation

A stack is LIFO: the last element pushed is the first popped. A queue is FIFO: the first element enqueued is the first dequeued.

Q140DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
What is the main difference between a depth-first search (DFS) and a breadth-tint search (BFS) algorithm?
  1. ABFS is used for traversing a tree, while DFS is used for traversing a graph.
  2. BDFS is used for traversing a tree, while BFS is used for traversing a graph.
  3. CDFS explores as far as possible along each branch before backtracking, while BFS visits all the vertices at the current depth before moving on to the next level.
  4. DBFS explores as far as possible along each branch before backtracking, while DFS visits all the vertices at the current depth before moving on to the next level.
Show answerHide answer

Correct answer: (C) DFS explores as far as possible along each branch before backtracking, while BFS visits all the vertices at the current depth before moving on to the next level.

Explanation

DFS goes as deep as possible along one branch before backtracking (using a stack). BFS visits all vertices at the current level before the next level (using a queue).

Q141DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
data structures represent a collection of values that are indexed by a key.
  1. AURI
  2. BArray
  3. CDictionary<TKey,TValue>
  4. DList<T>
Show answerHide answer

Correct answer: (C) Dictionary<TKey,TValue>

Explanation

Dictionary<TKey,TValue> is a .NET collection of key-value pairs, where values are looked up by a unique key.

Q142DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
What is the main difference between a dynamic array and a static array in C programming?
  1. AStatic arrays are stored in the stack, while dynamic arrays are stored in the heap.
  2. BDynamic arrays can be resized during runtime, while static arrays have a fixed size.
  3. CStatic arrays can be resized during runtime, while dynamic arrays have a fixed size.
  4. DDynamic arrays are stored in the stack, while static arrays are stored in the heap.
Show answerHide answer

Correct answer: (B) Dynamic arrays can be resized during runtime, while static arrays have a fixed size.

Explanation

A static array's size is fixed at compile time. A dynamic array (created with malloc or realloc) can be resized at runtime.

Q143DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)
What are the data structures categorised as a linear list?
  1. ABinary tree
  2. BGraphs
  3. CCircular queue
  4. DArray
Show answerHide answer

Correct answer: (D) Array

Explanation

In a linear list, elements are arranged in a sequence where each has one successor. An array is the classic linear list. Trees and graphs are non-linear structures.

Q144DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)
What is the name of the .NET collection class that enables an element to be accessed using a unique key?
  1. ALinked list
  2. BHashtable
  3. CDouble linked list
  4. DArray list
Show answerHide answer

Correct answer: (B) Hashtable

Explanation

The .NET Hashtable class stores key/value pairs and lets each element be accessed by its unique key using hashing. ArrayList and linked lists are accessed by index or position.

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