Ds Lab Quiz Final

10 Questions | Total Attempts: 34

SettingsSettingsSettings
Please wait...
Ds Lab Quiz Final


Questions and Answers
  • 1. 
    ........ is a type of tree in which left sub tree height differs from right sub tree height by at most 1 
    • A. 

      Binary Search tree

    • B. 

      AVL Tree

    • C. 

      B-Tree

    • D. 

      Red Black Tree

  • 2. 
    Merge sort has time complexity
    • A. 

      O (log n)

    • B. 

      O(n log n)

    • C. 

      O(n)

    • D. 

      O(n2)

  • 3. 
    The depth of Complete Binary tree is
    • A. 

      N log n

    • B. 

      N log n +1

    • C. 

      Log n

    • D. 

      Log n +1

  • 4. 
    One can convert a binary search tree into its mirror image by traversing it in
    • A. 

      Inorder

    • B. 

      Preorder

    • C. 

      Postorder

    • D. 

      None of the above

  • 5. 
    Overflow condition for circular queue is
    • A. 

      Front=Max-1

    • B. 

      Rear= Max-1

    • C. 

      Front = 0 and Rear = Max-1

    • D. 

      Front = Max-1 and Rear = 0

  • 6. 
    Prefix expression for the given infix expression is:(A + B) * C + D / (E + F * G) - H
    • A. 

      A B + C * D E F G * + / + H -

    • B. 

      A B *C + D E F G * + / + H -

    • C. 

      A B + C * D E F G * + +/ H -

    • D. 

      A B + C * D E F G * + / + -H

  • 7. 
    Int foo(int n1, int n2); int main() { int n1, n2; printf("Enter two positive integers: "); scanf("%d %d", &n1, &n2); printf("%d and %d is %d.", n1, n2, foo(n1,n2)); return 0; } int foo(int n1, int n2) { if (n2 != 0) return foo(n2, n1%n2); else return n1; } The function foo determines:
    • A. 

      GCD

    • B. 

      LCM

    • C. 

      Factorial

    • D. 

      Factors

  • 8. 
    Static void find(struct Node** head_ref){    struct Node* prev   = NULL;    struct Node* current = *head_ref;    struct Node* next;    while (current != NULL)    {        next  = current->next;          current->next = prev;           prev = current;        current = next;    }    *head_ref = prev;}What does the above function does? 
    • A. 

      Exchange the values of simultaneous node in list

    • B. 

      Points the last node to first

    • C. 

      Reverses a linked list

    • D. 

      None

  • 9. 
    Breadth First Traversal Technique uses
    • A. 

      Queue

    • B. 

      Stack

    • C. 

      Linked List

    • D. 

      Array

  • 10. 
    What will be the output of the following program?#include <stdlib.h> #include <stdio.h> enum {false, true}; int main() { int i = 1; do { printf("%d\n", i); i++; if (i < 15) continue; } while (false); getchar(); return 0; }
    • A. 

      1

    • B. 

      14

    • C. 

      15

    • D. 

      13

Back to Top Back to top