Data Structure interview questions

893 questions. Tap “Show answer” to check yourself.

Advertisement
  1. When is insertion sort a good choice for sorting an array?

    1. The array has only a few elements out of place
    2. Each element of array requires a small amount of memory
    3. The processor speed is fast
    4. Each element of array requires a large amount of memory
    Show answer

    A. The array has only a few elements out of place

  2. A binary tree in which all its levels except the last, have maximum numbers of nodes, and all the nodes in the last level have only one child it will be its left child. Name the tree.

    1. Threaded tree
    2. Complete binary tree
    3. M-way search tree
    4. Full binary tree
    Show answer

    B. Complete binary tree

  3. Which of following data structure is more appropriate for implementing quick sort iteratively?

    1. Deque
    2. Queue
    3. Stack
    4. Priority queue
    Show answer

    C. Stack

  4. The number of edges in a complete graph of n vertices is

    1. n(n+1)/2
    2. n(n-1)/2
    3. n2/2
    4. n
    Show answer

    B. n(n-1)/2

  5. If two trees have same structure and but different node content, then they are called ___

    1. Synonyms trees
    2. Joint trees
    3. Equivalent trees
    4. Similar trees
    Show answer

    D. Similar trees

  6. If two trees have same structure and node content, then they are called ____

    1. Synonyms trees
    2. Joint trees
    3. Equivalent trees
    4. Similar trees
    Show answer

    C. Equivalent trees

  7. A vertex of in-degree zero in a directed graph is called a/an

    1. Root vertex
    2. Isolated vertex
    3. Sink
    4. Articulation point
    Show answer

    C. Sink

  8. A graph is a tree if and only if graph is

    1. Directed graph
    2. Contains no cycles
    3. Planar
    4. Completely connected
    Show answer

    B. Contains no cycles

  9. An index is a pair of elements comprising key and a file pointer or record number. A file in which indices are is known as ____

    1. Index file
    2. Sort file
    3. Key file
    4. None of above
    Show answer

    A. Index file

  10. A data item that can be used to distinguish between two entities (records) is known as

    1. Alternate key
    2. Primary key
    3. Primary data item
    4. Unique data item
    Show answer

    B. Primary key

  11. A data structure whose elements form a sequence is known as

    1. Heterogeneous data structure
    2. Homogeneous data structure
    3. Linear data structures
    4. Non- linear data structure
    Show answer

    C. Linear data structures

  12. Which of the following data structure is used to represent hierarchical relationship among its elements?

    1. Queue
    2. Hash table
    3. Tree
    4. Graph
    Show answer

    C. Tree

  13. Advertisement
  14. Which of the following statements about a binary tree is not correct?

    1. Every binary tree has at least one node
    2. Every non-empty tree has exactly one root node
    3. Every node has at most two children
    4. Every non-root node has exactly one parent
    Show answer

    A. Every binary tree has at least one node

  15. The average case complexity of quick sort for sorting n numbers is

    1. O(n2)
    2. O(nlog2n)
    3. O(n)
    4. O(log2n)
    Show answer

    B. O(nlog2n)

  16. A dequeue operation removes an element

    1. From the front of the queue
    2. From any place in the queue
    3. From the rear of the queue
    4. None of above
    Show answer

    A. From the front of the queue

  17. What is the minimum number of nodes in a complete binary tree with depth 3?

    1. 4
    2. 5
    3. 6
    4. 7
    Show answer

    A. 4

  18. What is the number of nodes in a full binary tree with depth 3?

    1. 5
    2. 6
    3. 7
    4. 8
    Show answer

    C. 7

  19. Which of the following operation is not supported by a queue?

    1. Inserting element at rear
    2. Removing element from front
    3. Removing element from middle
    4. None of above
    Show answer

    C. Removing element from middle

  20. Which of the following piece of information does the data type to the compiler provide?

    1. The way the data is to be interpreted
    2. Range of values
    3. Amount of memory a data element uses
    4. All of above
    Show answer

    D. All of above

  21. The elements of a linked list are stored

    1. In a structure
    2. In an array
    3. Anywhere the computer has space for them
    4. In contiguous memory locations
    Show answer

    C. Anywhere the computer has space for them

  22. A parentheses checker program would be best implemented using

    1. List
    2. Queue
    3. Stack
    4. Any of the above
    Show answer

    C. Stack

  23. To perform level-order traversal on a binary tree, which of the following data structure will be required?

    1. Hash table
    2. Queue
    3. Binary search tree
    4. Stack
    Show answer

    B. Queue

  24. Which of the following data structure is required to convert arithmetic expression in infix to its equivalent postfix notation?

    1. Queue
    2. Linked list
    3. Binary search tree
    4. None of above
    Show answer

    D. None of above

  25. An enqueue operation adds an element

    1. At any position in the queue
    2. To the front of the queue
    3. To the rear of the queue
    4. None of above
    Show answer

    C. To the rear of the queue

  26. Advertisement
  27. Which of the following is not an entity?

    1. Book
    2. Student
    3. Employee
    4. Roll number
    Show answer

    D. Roll number

  28. What kind of list is best to answer many questions such as “what is the item at position n?”

    1. Singly-linked lists
    2. Doubly-linked lists
    3. Lists implemented with an array
    4. Circular- linked lists
    Show answer

    C. Lists implemented with an array

  29. Which of following operations are generally not performed on report files?

    1. Updation
    2. Maintenance
    3. Retrieval
    4. All of above
    Show answer

    D. All of above

  30. Name the tree in which, for every node, the height of left sub tree and height of right sub tree can differ by at most one

    1. AVL tree
    2. B-tree
    3. Threaded tree
    4. Complete tree
    Show answer

    A. AVL tree

  31. Which of the following statements about a binary tree is correct?

    1. No binary tree is both complete and full
    2. Every full binary tree is also a complete binary tree
    3. Every complete binary tree is also a full binary tree
    4. Every binary tree is either complete or full
    Show answer

    B. Every full binary tree is also a complete binary tree

  32. What is the worst-case time for binary search finding a single item in an array?

    1. Quadratic time
    2. Linear time
    3. Logarithmic time
    4. Constant time
    Show answer

    C. Logarithmic time

Advertisement