GATE Exam: Date Structures And Algorithms! Quiz

20 Questions | Total Attempts: 69

SettingsSettingsSettings
GATE Exam: Date Structures And Algorithms! Quiz - Quiz

This quiz is a gate exam on date structures and algorithms! Before you get that degree that shows you are well capable of handling your tasks as an engineer, you are expected to pass a series of tests to see how attentive you are in class. This quiz is an example of the type of questions to expect. How about you try it out!


Questions and Answers
  • 1. 
    What is the function of  'r+' module in opening a file ?
    • A. 

      Write Only

    • B. 

      For truncating and writing

    • C. 

      Read in binary format

    • D. 

      Read and Write

  • 2. 
    Arrange the following functions P1, P2, P3, P4 in increasing order of their asymptotic complexity?  P1(n) = n^2  P2(n) = 2^n  P3(n) = Logn  P4(n) = n^(Logn)
    • A. 

      P2, P3, P4, P1

    • B. 

      P3, P1, P4, P2

    • C. 

      P3, P2, P4, P1

    • D. 

      P2, P3, P1, P4

  • 3. 
    The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is
    • A. 

      MNOPQR

    • B. 

      QMNPRO

    • C. 

      QMNPOR

    • D. 

      NQMPOR

  • 4. 
    Let A be a two dimensional array declared as follows: A: array [1 ... 15] [1 ... 10] of integer; Assuming that each integer takes one memory location, the array is stored in column-major order and the first element of the array is stored at location 100, what is the address of the element A[i][j] ?
    • A. 

      15i+ j+ 89

    • B. 

      10j+ i+ 89

    • C. 

      15j+ i+ 84

    • D. 

      10i+ j+ 84

  • 5. 
    A language with string manipulation facilities uses the following operations . head(s) – returns the first character of the string s tail(s) – returns all but the first character of the string  s concat(s1,s2) – concatenates string s1 with s2. The output of [concat(head(tail(s)), head(tail(tail(s))))] where s is abcb is :
    • A. 

      Ac

    • B. 

      As

    • C. 

      Bc

    • D. 

      Ab

  • 6. 
    If x is equal to 5 . Then what will be the output if we print the following two variables? Print( (++x)++,x) ;
    • A. 

      7,7

    • B. 

      5,6

    • C. 

      6,6

    • D. 

      6,7

  • 7. 
    A queue is implemented using a singly linked list. The queue has a head pointer and a tail pointer and next pointers, as shown in the figure. Let n denote the number of nodes in the queue. Let nodes are  enqueued at the head, and dequeued 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?
    • A. 

      Θ(n), Θ(1)

    • B. 

      Θ(1), Θ(n)

    • C. 

      Θ(n), Θ(n)

    • D. 

      Θ(1), Θ(1)

  • 8. 
    Which one of the following is not an application of Stack Data Structure?
    • A. 

      BFS Algorithm

    • B. 

      Managing function calls

    • C. 

      Recursion

    • D. 

      DFS Algorithm

  • 9. 
    A queue is implemented by which of the following strategy ?
    • A. 

      First In First Out

    • B. 

      First In Last out

    • C. 

      Random In Random Out

    • D. 

      Last In First Out

  • 10. 
    Which of the following algorithms can be used to most efficiently determine the presence of a cycle in a given graph ?
    • A. 

      Depth First Search

    • B. 

      Breadth First Search

    • C. 

      Kruskal' Minimum Spanning Tree Algorithm

    • D. 

      Prim's Minimum Spanning Tree Algorithm

  • 11. 
    User push 1 element in the stack having already five elements and having stack size as 5 then stack ___________.
    • A. 

      Overflows

    • B. 

      Underflows

    • C. 

      Crash

    • D. 

      User Flow

  • 12. 
    Tick the option in which both statement is correct : 1. According to Access strategies, Linked list is a linear one. 2.  According to Storage, Linked List is a linear one. 3.  According to Storage, Linked List is a Non-linear one. 4. According to Access strategies, Linked list is a Non-linear one.
    • A. 

      4 & 3

    • B. 

      4 & 2

    • C. 

      1 & 3

    • D. 

      1 & 2

  • 13. 
    In order traversal of binary search tree will produce −  
    • A. 

      Reverse of input

    • B. 

      Sorted list

    • C. 

      Unsorted list

    • D. 

      None of the above

  • 14. 
    You are given a list of 5 integers and these integers are in the range from 1 to 6. There are no duplicates in list. One of the integers is missing in the list. Which of the following expression would give the missing number. ^ is bitwise XOR operator. ~ is bitwise NOT operator. Let elements of list can be accessed as list[0], list[1], list[2], list[3], list[4]
    • A. 

      ~(list[0] ^ list[1] ^ list[2] ^ list[3] ^ list[4])

    • B. 

      List[0] ^ list[1] ^ list[2] ^ list[3] ^ list[4] ^ 1 ^ 2 ^ 3 ^ 2 ^ 3 ^ 4 ^ 4 ^ 5

    • C. 

      List[0] ^ list[1] ^ list[2] ^ list[3] ^ list[4] ^ 1 ^ 2 ^ 4 ^ 3 ^ 2 ^ 4 ^ 5 ^ 6 ^ 2 ^ 4

    • D. 

      List[0] ^ list[1] ^ list[2] ^ list[3] ^ list[4]

  • 15. 
    What will be the postfix expression for following infix expression - A + B * C ^ D
    • A. 

      ABCD+*^

    • B. 

      ABCD*+^

    • C. 

      ABCD^*+

    • D. 

      ABC+D*^

  • 16. 
    Change in value of a after the following operation? a = (a<<1) + a + (a>>1);
    • A. 

      Multiplies 'a' with 3

    • B. 

      Multiplies 'a' with 7

    • C. 

      Multiplies 'a' with 7.5

    • D. 

      Multiplies 'a' with 3.5

  • 17. 
    What a function is called when its defined inside a class?
    • A. 

      Another Function

    • B. 

      Module

    • C. 

      Class

    • D. 

      Method

  • 18. 
    int fun1(int n) {     if (n <= 1)              return n;     return 2*fun1(n-1); }     int fun2(int n) {     if (n <= 1)             return n;     return fun2(n-1) + fun2(n-1); } Which option is correct regarding the complexity of two functions?
    • A. 

      O(n) for fun1() and O(2^n) for fun2()

    • B. 

      O(2^n) for fun1() and O(n) for fun2()

    • C. 

      O(n) for both fun1() and fun2()

    • D. 

      O(2^n) for both fun1() and fun2()

  • 19. 
    What is the  time complexity in worst case for best possible implementation of QuickSort?
    • A. 

      O(n)

    • B. 

      O(nLogn)

    • C. 

      O(n2)

    • D. 

      O(Logn)

  • 20. 
      You are given an array A[] having N random integers and a function OR(i,j) which will take two indexes from an array as parameters and will return the result of ( A[i] OR A[j] ) i.e bitwise OR. What is the minimum no of OR calls required so as to determine all the values inside the array i.e. to determine every index of A[] ?
    • A. 

      N

    • B. 

      N-1

    • C. 

      N*(N-1)/2

    • D. 

      Not possible to determine the bit array

Back to Top Back to top