Data Structure And Algorithm

20 Questions | Total Attempts: 605

SettingsSettingsSettings
Please wait...
Data Structure And Algorithm

Questions and Answers
  • 1. 
    The _____________ algorithm works by repeatedly scanning through the list, comparing adjacent elements, and swapping them if they are in the wrong order.
    • A. 

      Bubble sort

    • B. 

      Insertion Sort

    • C. 

      Merge Sort

    • D. 

      Selection sort

  • 2. 
    The _____________ algorithm works by repeatedly scanning through the list, comparing adjacent elements, and swapping them if they are in the wrong order.
    • A. 

      Bubble sort

    • B. 

      Insertion Sort

    • C. 

      Merge Sort

    • D. 

      Selection sort

  • 3. 
    A __________ is a list of elements in which items are always inserted at one end and deleted from the other end.
    • A. 

      Queue

    • B. 

      Linked List

    • C. 

      Array

    • D. 

      Stack

  • 4. 
    In ______________ traversal method, the root is processed before traversing the left and right subtrees.
    • A. 

      Preorder

    • B. 

      Inorder

    • C. 

      Postorder

    • D. 

      Preorder and postorder

  • 5. 
    Identify the degree of a node B in the given figure.
    • A. 

      1

    • B. 

      2

    • C. 

      3

    • D. 

      0

  • 6. 
    Which of the following Big O Notations has constant order of growth?
    • A. 

      O(n)

    • B. 

      O(1)

    • C. 

      O(n2)

    • D. 

      O(log n)

  • 7. 
    What is the order of growth of the bubble sort algorithm?
    • A. 

      Constant

    • B. 

      Linear

    • C. 

      Quadratic

    • D. 

      Logarithmic

  • 8. 
    To implement __________ search algorithm, the list should be sorted.
    • A. 

      Linear

    • B. 

      Binary

    • C. 

      Both

    • D. 

      None

  • 9. 
    Consider the algorithm to insert a node at the beginning of the link list and identify the error: 1. Assign value to the data field of the new node 2. Allocate memory for the new node 3. Make the next field of the new node point to the first node in the list. 4. Make START point to the new node.
    • A. 

      There is no error

    • B. 

      Step 3 to be changed as, Make the next field of the new node point to NULL.

    • C. 

      The sequence is wrong, the correct sequence is 2->1->3->4

    • D. 

      Step 4 to be changed as, Make the new node point to START.

  • 10. 
    Which of the following will be the postfix expression for the given infix expression:  ((C+(D*E))-F)
    • A. 

      CDE*+F-

    • B. 

      CDE+*F-

    • C. 

      CDF*+E-

    • D. 

      DCF*+E-

  • 11. 
    What address would a node with an empty left child of a threaded binary tree store?
    • A. 

      Inorder successor

    • B. 

      Preorder predecessor

    • C. 

      Preorder successor

    • D. 

      Inorder predecessor

  • 12. 
    • A. 

      D H B E A F C I G J

    • B. 

      A B D H E C F G I J

    • C. 

      H D E B F I J G C A

    • D. 

      A B D H E F C G J I

  • 13. 
    Which of the following stack operations could result in stack underflow?
    • A. 

      Is_empty

    • B. 

      Pop

    • C. 

      Push

    • D. 

      Two or more of the above answers

  • 14. 
    If a stack is represented in memory by using a linked list, then insertion and deletion of data will be done ___.
    • A. 

      At the end of the list

    • B. 

      At the beginning of the list

    • C. 

      Anywhere in the list

    • D. 

      At the beginning and end of the list respectively

  • 15. 
    If a stack is represented in memory by using an array, then what will be the stack overflow condition?
    • A. 

      Top=-1

    • B. 

      Top=0

    • C. 

      Top=SIZE-1

    • D. 

      Top=SIZE

  • 16. 
    If a queue is represented in memory by using a linked list, then what will be the stack empty condition?
    • A. 

      FRONT=0

    • B. 

      FRONT=-1

    • C. 

      FRONT=REAR

    • D. 

      FRONT=NULL

  • 17. 
    • A. 

      Statement A is true and B is False

    • B. 

      Statement B is true and A is False

    • C. 

      Statement A is False and B is False

    • D. 

      Statement A is true and B is True

  • 18. 
    In a binary search tree, all values in the left subtree of a node are ________ than the value of the node.
    • A. 

      Smaller

    • B. 

      Greater

    • C. 

      Equal

    • D. 

      Greater or Equal

  • 19. 
    • A. 

      The right child field of the header node is a thread pointing to itself

    • B. 

      The left child field of the header node is NULL

    • C. 

      The left child field of the header node is a thread pointing to itself

    • D. 

      The root is NULL

  • 20. 
    Consider the algorithm of deleting a node from the beginning of a linked list and identify the error:                         1. Mark the first node in the list as current                         2. Make START point to the next node in sequence.                         3. Release the memory for the node marked as current.
    • A. 

      The algorithm has no error

    • B. 

      The sequence is wrong, the correct one is 3->1->2

    • C. 

      The sequence is wrong, the correct one is 2->1->3

    • D. 

      The sequence is wrong, the correct one is 3->2->1