Data Structure Question Paper GATE PSU

Data Structure Question Paper-GATE & PSU Exam

Last updated on March 20th, 2025 at 03:26 am

Here, We will see the Data Structure Question Paper from the previous year’s exam and the syllabus of Data Structure for GATE and PSU Exam.

1. Data Structure in Gate CSE and PSU Exam

Data Structures form the backbone of the GATE Computer Science (CSE) exam, testing candidates’ ability to design efficient algorithms and solve real-world computational problems. These questions assess conceptual clarity, problem-solving speed, and application of theoretical knowledge to practical scenarios.

2. Data Structure Syllabus

The Data Structure Questions asked in the GATE and PSU Exam focused on topics:

  1. Basic Structures: Arrays, Stacks, Queues, Linked Lists (singly, doubly, circular), and Recursion.
  2. Trees: Binary Trees, Binary Search Trees (BSTs), AVL Trees, Heaps (min/max), and B/B+ Trees.
  3. Graphs: Representation (adjacency matrix/list), Traversals (BFS, DFS), Shortest Path Algorithms (Dijkstra, Bellman-Ford), and Minimum Spanning Trees (Prim, Kruskal).
  4. Hashing: Collision resolution techniques (chaining, open addressing) and hash functions.
  5. Advanced Topics: Time and space complexity analysis (Big-O notation), Dynamic Programming, and Greedy Algorithms.

Q. To sort many large objects or structures, it would be most efficient to place

  1. them in an array and sort the array
  2. pointers to them in an array and sort the array
  3. them in a linked list and sort the linked list
  4. references to them in an array and sort the array
Answer

pointers to them in an array and sort the array
NIELIT 2016 MAR Scientist C

Q. Let A be a square matrix of size n×n. Consider the following program. What is the expected output?

C = 100
for i = 1 to n do
    for j = 1 to n do {
      Temp = A[i][j] + C
      A[i][j] = A[j][i]
      A[j][i] = Temp - C
    }
  for
  i = 1 to n do
    for j = 1 to n do Output(A[i][j]);
  1. The matrix A itself.
  2. Transpose of matrix A.
  3. Adding 100 to the upper diagonal elements and subtracting 100 from diagonal elements of A.
  4. None of the option
Answer

The matrix A itself.
NIELIT 2017 July Scientist B (CS)

Q. Kadane algorithm is used to find

  1. Maximum sum subsequence in an array
  2. Maximum sum subarray in an array
  3. Maximum product subsequence in an array
  4. Maximum product subarray in an array
Answer

Maximum sum subarray in an array
NIELIT 2017 July Scientist B (CS)

Q. A program P reads 500 integers in the range [0…100] representing the scores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies?

  1. An array of 50 numbers
  2. An array of 100 numbers
  3. An array of 500 numbers
  4. A dynamically allocated array of 550 numbers
Answer

An array of 50 numbers
NIELIT Scientific Assistant A 2020 November

Q. A balance factor in the AVL tree is used to check

  1. what rotation to make
  2. if all child nodes are at the same level
  3. when the last rotation occurred
  4. if the tree is unbalanced
Answer

if the tree is unbalanced
NIELIT 2017 July Scientist B (CS)

Q. A binary tree of depth K is called a full binary tree of depth K if it has exactly _________ nodes.

  1. K
  2. 2k
  3. 2k-1
  4. 2k+1
Answer

2k+1
NIELIT 2021 Dec Scientist B

Q. We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is

  1. Θ(logn)
  2. Θ(n)
  3. Θ(nlogn)
  4. Θ(n2)
Answer

Θ(n)
NIELIT 2016 MAR Scientist C

Q. The smallest element that can be found in time ________ in a binary max heap.

  1. O(nlogn)
  2. O(logn)
  3. O(n)
  4. O(n2)
Answer

O(n)
NIELIT 2018

Q. Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is

  1. Θ(log2n)
  2. Θ(nlog2log2n)
  3. Θ(n)
  4. Θ(nlog2n)
Answer

Θ(nlog2log2n)
NIELIT 2016 MAR Scientist C

  1. Structure
  2. Link List
  3. Stack
  4. Doubly link list
Answer

Link List
NIELIT 2021 Dec Scientist B

Q. The number of distinct minimum spanning trees for the weighted graph below is __________.

  1. 4
  2. 5
  3. 6
  4. 7
Answer

6
NIELIT 2022 April Scientist B

Q. You are given the postorder traversal, P, of a binary search tree on the n elements 1,2,….,n. You have to determine the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this?

  1. Θ(logn)
  2. Θ(n)
  3. Θ(nlogn)
  4. None of the above, as the tree cannot be uniquely determined.
Answer

Θ(n)
NIELIT 2016 MAR Scientist C

Q. _________ is the worst-case time complexity for all operations (i.e.,) search, update and delete) in a general Binary Search tree

  1. O(n)
  2. O(nlogn)
  3. O(logn) for search and insert, and O(n) for delete
  4. None of these
Answer

O(n)
NIELIT 2018

Q. When we perform in-order traversal on a binary tree, we get the ascending order array. The tree is:

  1. Heap tree
  2. almost complete binary tree
  3. Binary search tree
  4. Cannot be determined
Answer

Binary search tree
NIELIT Scientific Assistant A 2020 November

Q. Which of the following need not be a binary tree?

  1. Search tree
  2. Heap
  3. AVL tree
  4. B tree
Answer

B tree
NIELIT 2016 DEC Scientist B (CS)

Q. Which type of linked list stores the address of the header node in the next field of the last node?

  1. Singly-linked list
  2. Circular linked list
  3. Doubly linked list
  4. Circular header linked list
Answer

Circular header linked list
NIELIT 2021 Dec Scientist A

Q. The number of unused pointers in a complete binary tree of depth5 is:

  1. 4
  2. 8
  3. 16
  4. 32
Answer

32
NIELIT 2016 DEC Scientist B (IT)

Q. A full binary tree with n non-leaf nodes contains

  1. log2n nodes
  2. n+1 nodes
  3. 2n nodes
  4. 2n+1 nodes
Answer

2n+1 nodes
NIELIT 2016 MAR Scientist C

Q. In a full binary tree number of nodes is 63 then the height of the tree is :

  1. 2
  2. 4
  3. 3
  4. 6
Answer

3
NIELIT 2017 DEC Scientific Assistant A

Q. The height of a binary tree is the maximum number of edges in any root-to-leaf path. The maximum number of nodes in a binary tree of height h is

  1. 2h
  2. 2h-1-1
  3. 2h+1-1
  4. 2h+1
Answer

2h+1-1
NIELIT 2017 OCT Scientific Assistant A (IT)

Q. The number of possible binary trees with 4 nodes is

  1. 12
  2. 13
  3. 14
  4. 15
Answer

14
NIELIT 2017 OCT Scientific Assistant A (IT)

Q. What are the appropriate data structures for graph traversal using Breadth First Search(BFS) and Depth First Search(DFS) algorithms?

  1. Stack for BFS and Queue for DFS
  2. Queue for BFS and Stack for DFS
  3. Stack for BFS and Stack for DFS
  4. Queue for BFS and Queue for DFS
Answer

Queue for BFS and Stack for DFS
NIELIT 2017 July Scientist B (IT)

Q. When the left sub-tree of the tree is one level higher than that of the right sub-tree, then the balance factor is _______.

  1. 0
  2. 1
  3. -1
  4. 2
Answer

1
NIELIT 2021 Dec Scientist A

Q. Non-leaf nodes of B+ tree structure from a :

  1. Multilevel sparse indices
  2. Multilevel dense indices
  3. Sparse indices
  4. Multilevel clustered indices
Answer

Multilevel dense indices
NIELIT 2021 Dec Scientist A

Q. In what manner is a state-space tree for a backtracking algorithm constructed?

  1. Breadth-first search
  2. Twice around the tree
  3. Depth-first search
  4. Nearest neighbor first
Answer

Depth-first search
NIELIT 2021 Dec Scientist A

Q. _________ number of underlined graphs can be constructed using.

  1. n3
  2. 2n(n-1)/2
  3. n-1/2
  4. 2(n-1)/2
Answer

2n(n-1)/2
NIELIT 2018

Q. What data structures are used for depth-first traversal of a graph?

  1. Queue
  2. Stack
  3. List
  4. None of the above
Answer

Stack
NIELIT 2016 DEC Scientist B (IT)

Q. In the ________ traversal we process all of a vertex’s descendants before we move to an adjacent vertex.

  1. Depth First
  2. Breadth First
  3. Width First
  4. Depth Limited
Answer

Depth First
NIELIT 2016 DEC Scientist B (IT)

Q. Total number of nodes at the nth level of a full binary tree can be given as ______.

  1. 2n+1
  2. 2n2
  3. 2n
  4. 2n-1
Answer

2n
NIELIT 2021 Dec Scientist A

Q. A single array A[1…MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top 1 and top 2(top 1 < top 2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for “stack full” is

  1. (top1=MAXSIZE/2) and (top2=MAXSIZE/2 + 1)
  2. top1 + top2 = MAXSIZE
  3. (top1 = MAXSIZE/2) or (top2 = MAXSIZE)
  4. top1 = top2 -1
Answer

top1 = top2 -1
NIELIT 2022 April Scientist B

Q. Suppose a binary search tree has been constructed from the following sequence of numbers in the order in which they arrive : 6,2,10,1,5,7,11,3,9,4,8. Consider the following piece of code :

Show(root) {
  if (root != NULL) {
    printf("%d", root key);
    show(root→ right);
    show(root→ left);
  } else
    return;
}

The sequence printed will be :

  1. 6,11,10,7,8,9,2,4,3,5,1
  2. 6,11,7,9,8,10,2,5,1,3,4
  3. 6,10,11,7,9,8,2,5,3,4,1
  4. 6,10,2,11,7,9,8,5,3,4,1
    NIELIT 2021 Dec Scientist A
Answer

Q. ___________ to evaluate an expression without any embedded function calls.

  1. Two stacks are required
  2. one stack is needed
  3. Three stacks are required
  4. More than three stacks are required
Answer

one stack is needed
NIELIT 2018

Q. Evaluation of the given postfix expression 10 10+60 6/*8- is

  1. 192
  2. 190
  3. 110
  4. 92
Answer

192
NIELIT 2018

Q. Consider a max heap, represented by the array: 40,30,20,10,15,16,17,8,4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is

  1. 40,30,20,10,15,16,17,8,4,35
  2. 40,35,20,10,30,16,17,8,4,15
  3. 40,30,20,10,35,16,17,8,4,15
  4. 40,35,20,10,15,16,17,8,4,30
Answer

40,35,20,10,15,16,17,8,4,30
NIELIT 2022 April Scientist B

Q. A hash table with 10 buckets with one slot per bucket is depicted. The symbols, S1 to S7 initially emerged using a hashing function with linear probing. The maximum number of comparisons needed in searching for an item that is not present is

0S7
1S1
2
3S4
4S2
5
6S5
7
8S6
9S3
  1. 6
  2. 5
  3. 4
  4. 3
Answer

6
NIELIT 2016 MAR Scientist C

Q. The average search time of hashing, with linear probing will be less if the load factor

  1. is far less than one
  2. equals one
  3. is far greater than one
  4. none of these
Answer

is far less than one
NIELIT 2016 MAR Scientist C

Q. For a given hash table T with 10 slots that store 1000 elements, the load factor α for T is

  1. 100
  2. 0.01
  3. 200
  4. 1.05
Answer

100
NIELIT 2018

Q. Consider a complete binary tree where the left and the right sub-trees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is:

  1. Ω(logn)
  2. Ω(nlogn)
  3. Ω(n)
  4. Ω(n2)
Answer

Ω(logn)
NIELIT 2017 DEC Scientist B

Q. For the given nodes:
89,19,50,17,12,15,2,5,7,11,6,9,100
minimum _________ number of interchanges are required to convert it into a max-heap.

  1. 3
  2. 4
  3. 5
  4. 6
Answer

3
NIELIT 2018

Q. Assume that the operators +,-,× are left-associative and Λ is right-associative. The order of precedence(from highest to lowest) is Λ,×,+,-. The postfix expression corresponding to the infix expression a+b×c-dΛeΛf is

  1. abc×+defΛΛ-
  2. abc×+deΛfΛ-
  3. ab+c×d-eΛfΛ
  4. -+a×bcΛΛdef
Answer

abc×+defΛΛ-
NIELIT 2017 July Scientist B (CS)

Q. A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let ‘enqueue’ be implemented by inserting a new node at the head, and ‘dequeue’ be implemented by deletion of a node from the tail. Which one of the following is the time complexity of the most time-efficient implementation of ‘enqueue’ and ‘dequeue, respectively, for this data structure?

  1. Θ(1),Θ(1)
  2. Θ(1),Θ(n)
  3. Θ(n),Θ(1)
  4. Θ(n),Θ(n)
Answer

Θ(1),Θ(n)
NIELIT 2022 April Scientist B

Q. In a circularly linked list organization, the insertion of a record involves the modification of

  1. no pointer
  2. 1 pointer
  3. 2 pointers
  4. 3 pointers
Answer

2 pointers
NIELIT 2016 MAR Scientist C

Q. The address field of the linked list :

  1. Contains the address of the next node
  2. May contain a null character
  3. Contain the address of the next pointer
  4. Both 1 and 2
Answer

Both 1 and 2
NIELIT 2017 DEC Scientific Assistant A

Q. What does the following function do for a given Linked List with the first node as head?

void fun1(struct node * head) {
  if (head == NULL)
    return;
  fun1(head -> next);
  printf("%d", head -> data);
}
  1. Prints all nodes of linked lists
  2. Prints all nodes of the linked list in reverse order
  3. Prints alternate nodes of Linked List
  4. Prints alternate nodes in reverse order
Answer

Prints all nodes of linked list in reverse order
NIELIT 2017 July Scientist B (CS)

Q. Consider the following function that takes a reference to the head of a Doubly Linked List as a parameter. Assume that a node of a doubly linked list has the previous pointer as and the next pointer as next.

void fun(struct node ** head_ref) {
  struct node * temp = NULL;
  struct node current = head_ref;
  while (current != NULL) {
    temp = current -> prev;
    current -> prev = current -> next;
    current -> next = temp;
    current = current -> prev;
  }
  if (temp != NULL)
    *
    head_ref = temp -> prev;
}

Assume that reference of the head of the following doubly linked list is passed to the above function 1↔2↔3↔4↔5↔6. What should be the modified linked list after the function call?

  1. 2↔1↔4↔3↔6↔5
  2. 5↔4↔3↔2↔1↔6
  3. 6↔5↔4↔3↔2↔1
  4. 6↔5↔4↔3↔1↔2
Answer

6↔5↔4↔3↔2↔1
NIELIT 2017 July Scientist B (CS)

Q. Which of the following is the correct order of evaluation for the below expression?
z = x+y*z/4%2-1

  1. */%+-=
  2. =*/%+-
  3. /*%-+=
  4. *%/-+=
Answer

*/%+-=
NIELIT 2016 DEC Scientist B (IT)

Q. Suppose we have to insert the following sequence of keys into an empty binary search tree:
5,7,45,60,50,23,15,54
What would be the height of the binary search tree?

  1. 3
  2. 4
  3. 5
  4. 6
Answer

4
NIELIT Scientist B 2020 November

Q. Which table is used in MS-DOS for linked list allocation?

  1. TLB
  2. Page Table
  3. FAT
  4. Index Table
Answer

FAT
NIELIT Scientist B 2020 November

Q. Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are:
The height of a tree with a single node is 0.

  1. 4 and 15 respectively
  2. 3 and 14 respectively
  3. 4 and 14 respectively
  4. 3 and 15 respectively
Answer

3 and 15 respectively
NIELIT 2022 April Scientist B

Q. In which types of following data structure, an element is inserted at one end called Rear and deleted at the other end called Front?

  1. Stack
  2. Queue
  3. Height-balanced Avl tree
  4. Binary tree
Answer

Queue
NIELIT 2021 Dec Scientist B

Q. Mention which of the following is a special type of integrity constraint that relates two relations & maintains consistency across the relations

  1. Entity Integrity Constraints.
  2. Referential Integrity Constraints
  3. Domain Integrity Constraints
  4. Domain Constraints
Answer

Referential Integrity Constraints
NIELIT 2021 Dec Scientist B

Q. Specify, which of the following is the preferred method for enforcing data integrity.

  1. Constraints
  2. Stored procedure
  3. Triggers
  4. Cursors
Answer

Constraints
NIELIT 2021 Dec Scientist B

Q. In a binary tree, the number of internal nodes of degree 1 is 5, and the number of nodes of degree 2 is 10. The number of leaf nodes in a binary tree is:

  1. 10
  2. 11
  3. 12
  4. 15
Answer

11
NIELIT 2021 Dec Scientist B

Q. The expression 5-2-3*5-2 will evaluate to 18, if :

  1. ‘-‘ is left associative and ‘*’ has precedence over ‘-‘
  2. ‘-‘ is right-associative and ‘*’ has precedence over ‘-‘
  3. ‘-‘ is right-associative and ‘-‘ has precedence over ‘*’
  4. ‘-‘ is left associative and ‘-‘ has precedence over ‘*’
Answer

‘-‘ is left associative and ‘*’ has precedence over ‘-‘
NIELIT 2017 DEC Scientific Assistant A

Q. A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is 10,8,5,3,2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements is

  1. 10,8,7,3,2,1,5
  2. 10,8,7,2,3,1,5
  3. 10,8,7,1,2,3,5
  4. 10,8,7,5,3,2,1
Answer

10,8,7,3,2,1,5
NIELIT 2017 July Scientist B (CS)

Q. The program written for binary search, calculates the midpoint of the span as mid:=(Low+High)/2. The program works well if the number of elements in the list is small (about 32,000) but it behaves abnormally when the number of elements is large. This can be avoided by performing the calculation as:

  1. mid:= (High-Low)/2+Low
  2. mid:= (High-Low+1)/2
  3. mid:= (High-Low)/2
  4. mid := (High+Low)/2
Answer

mid := (High-Low)/2+Low
NIELIT Scientist B 2020 November

Q. A __________ is a linear list in which insertions and deletions are made from either end of the structure.

  1. Circular queue.
  2. Priority queue.
  3. Stack.
  4. Dequeue.
Answer

Dequeue.
NIELIT 2016 DEC Scientist B (IT)

Q. Which type of linked list stores the address of the header node in the next field of the last node?

  1. Singly-linked list
  2. Circular linked list
  3. Doubly linked list
  4. Hashed list
Answer

Circular linked list
NIELIT Scientist B 2020 November

Q. A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?

  1. Both operations can be performed in O(1) time.
  2. At most one operation can be performed in O(1) time but the worst-case time for the other operation will be Ω(n).
  3. The worst-case time complexity for both operations will be Ω(n).
  4. The worst-case time complexity for both operations will be Ω(logn).
Answer

Both operations can be performed in O(1) time.
NIELIT 2017 July Scientist B (CS)

Q. If the queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations?

  1. O(n),O(n)
  2. O(n),O(1)
  3. O(1),O(n)
  4. O(1),O(1)
Answer

O(1),O(1)
NIELIT 2017 OCT Scientific Assistant A (IT)

Q. Binary search tree contains the values 1,2,3,4,5,6,7,8. The tree is traversed in pre-order and the values are printed out. Which of the following sequences is a valid output?

  1. 53124786
  2. 53126487
  3. 53241678
  4. 53124768
Answer

53124768
NIELIT Scientist B 2020 November

Q. The maximum number of binary trees that can be formed with three unlabeled nodes is :

  1. 1
  2. 5
  3. 4
  4. 3
Answer

5
NIELIT 2021 Dec Scientist B

Q. Linked lists are not suitable data structures for which one of the following problems?

  1. Insertion sort
  2. Binary search
  3. Radix sort
  4. Polynomial manipulation
Answer

Binary search
NIELIT 2021 Dec Scientist B

Q. The preorder traversal of a binary search tree is given by 12,8,6,2,7,9,10,16,15,19,17,20. Then postorder traversal will be:

  1. 2,6,7,8,9,10,12,15,16,17,19,20
  2. 2,7,6,10,9,8,15,17,20,19,16,12
  3. 7,2,6,8,9,10,20,17,19,15,16,12
  4. 7,6,2,10,9,8,15,16,17,20,19,12
Answer

7,6,2,10,9,8,15,16,17,20,19,12
NIELIT 2021 Dec Scientist B

  1. Stack
  2. Set
  3. List
  4. Queue
Answer

Queue
NIELIT 2017 OCT Scientific Assistant A (IT)

Q. ________ number of queues are needed to implement a stack

  1. 1
  2. 2
  3. 3
  4. 4
Answer

2
NIELIT 2018

Q. Priority queue is implemented by :

  1. Doubly link list
  2. Graph
  3. Heap
  4. Stack
Answer

Heap
NIELIT Scientific Assistant A 2020 November

Q. Which of the following types of search is easiest to implement?

  1. Linear search
  2. Non-linear search
  3. Multidimensional search
  4. Bidirectional search
Answer

Linear search
NIELIT 2021 Dec Scientist B

Q. A stack can be implemented using a queue, but then we need to use at least:

  1. 3 queues
  2. 2 queues
  3. only one queue is sufficient
  4. none of the options
Answer

2 queues
NIELIT Scientific Assistant A 2020 November

Q. The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with n discs is:

  1. T(n) = 2T(n-2)+2
  2. T(n) = 2T(n/2)+1
  3. T(n) = 2T(n-1)+n
  4. T(n) = 2T(n-1)+1
Answer

T(n) = 2T(n-1)+1
NIELIT 2016 DEC Scientist B (IT)

Q. A recursive problem like Tower of Hanoi can be rewritten without recursion using:

  1. stack
  2. priority queue
  3. graph
  4. cycles
Answer

stack
NIELIT Scientific Assistant A 2020 November

Q. The maximum number of nodes in a binary tree of level k, k≥1 is:

  1. 2k+1
  2. 2k-1
  3. 2k-1
  4. 2k-1-1
Answer

2k-1
NIELIT 2016 DEC Scientist B (CS)

Q. In a complete k-ary tree, every internal node has exactly k children. The number of leaves in such a tree with n internal nodes is

  1. nk
  2. (n-1)k+1
  3. n(k-1)+1
  4. n(k-1)
Answer

n(k-1)+1
NIELIT 2017 July Scientist B (CS)

Q. ___________ number of leaf nodes in a rooted tree of n nodes, where each node is having 0 or 3 children

  1. n/2
  2. (2n+1)/3
  3. (n-1)/n
  4. (n-1)
Answer

(2n+1)/3
NIELIT 2018

Q. Traversing a binary tree first root and then left and right subtrees called _________ traversal.

  1. postorder.
  2. preorder.
  3. inorder.
  4. none of these.
Answer

preorder.
NIELIT 2016 MAR Scientist B

Q. In a binary search tree which traversal is used for getting ascending order values?

  1. In order
  2. Preorder
  3. Postorder
  4. None of the options
Answer

Inorder
NIELIT 2017 DEC Scientific Assistant A

Q. If for a given Binary Search Tree (BST) the pre-order traversal is 41,23,11,31,62,50,73. Then which of the following is its post-order traversal?

  1. 11,31,23,50,73,62,41
  2. 31,11,23,50,41,62,73
  3. 11,31,50,23,73,62,41
  4. 11,31,23,50,62,73,41
Answer

11,31,23,50,73,62,41
NIELIT 2017 DEC Scientist B

Q. A binary search tree contains the values-1,2,3,4,5,6,7 and 8. The tree is traversed in preorder and the values are printed out. Which of the following sequences is a valid output?

  1. 5 3 1 2 4 7 8 6
  2. 5 3 1 2 6 4 9 7
  3. 5 3 2 4 1 6 7 8
  4. 5 3 1 2 4 7 6 8
Answer

5 3 1 2 4 7 6 8
NIELIT 2017 OCT Scientific Assistant A (CS)

Q. _______ traversals are not sufficient to build a binary tree.

  1. Preorder and Inorder
  2. Postorder and Inorder
  3. Postorder and Preorder
  4. None of these
Answer

Postorder and Preorder
NIELIT 2018

Q. The Preorder traversal of a tree given below is:

  1. A B D F E C G I H J K L
  2. A B C D E G H F I J K L
  3. A B E D F C G H I J K L
  4. A B D F E C G I J H K L
Answer

A B D F E C G I H J K L
NIELIT Scientist B 2020 November

Scroll to Top