Programming and data structure miscellaneous


Programming and data structure miscellaneous

Programming & Data Structure

  1. Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ______.









  1. View Hint View Answer Discuss in Forum

    Correct Option: D


  1. Consider the following rooted tree with the vertex labeled P as the root :

    The order in which the nodes are visited during an in-order traversal of the tree is









  1. View Hint View Answer Discuss in Forum

    The in order transversal is as: left, root, middle, right \ Nodes are visited in SQPTRWUV order.

    Correct Option: A

    The in order transversal is as: left, root, middle, right \ Nodes are visited in SQPTRWUV order.



  1. The result evaluating the postfix expression 10, 5, +, 60, 6, /, *, 8, – is









  1. View Hint View Answer Discuss in Forum

    Correct Option: C


  1. Let T be a tree with 10 vertices. The sum of the degrees of all the vertices in T is _______.









  1. View Hint View Answer Discuss in Forum

    A tree with 10 vertices has 9 edges.
    Such that, n = 10, e = (n – 1) = 10 – 1 = 9
    then, ∑degree (Vi) = 2 [edges (E)] = 2 × 9 = 18.

    Correct Option: A

    A tree with 10 vertices has 9 edges.
    Such that, n = 10, e = (n – 1) = 10 – 1 = 9
    then, ∑degree (Vi) = 2 [edges (E)] = 2 × 9 = 18.



  1. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is









  1. View Hint View Answer Discuss in Forum

    Worst case of searching occurs when the element to be searched is at the end of the list so no. of comparisons required to search complete list would be n. Hence (d) is correct option.

    Correct Option: D

    Worst case of searching occurs when the element to be searched is at the end of the list so no. of comparisons required to search complete list would be n. Hence (d) is correct option.