Flipkart GRiD DSA Quiz 1

Question 1

Time: 00:00:00
Statement 1: The worst-case complexity of a typical implementation of Quick Sort is o(n2). It is when the array is sorted or reverse-sorted.

Statement 2: The best-case complexity of a typical implementation of insertion sort is O(n). It is when the input array is sorted.

Both statements are true.

Both statements are true.

Both statements are false.

Both statements are false.

Only statement 1 is true.

Only statement 1 is true.

Only statement 2 is true.

Only statement 2 is true.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

Time: 00:00:00
You are given a task to implement a linked list. Which of the following is a valid way to implement it?

Stack

Stack

Static array

Static array

Structure and pointers

Structure and pointers

Both static array and structure and pointers

Both static array and structure and pointers

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

Time: 00:00:00
Suppose you are given two binary trees b1 and b2.b1 has a height of 4 and b2 has a height of 5. Which of the following is true?

Maximum number of nodes in b1 - Maximum number of nodes in b2 = 31

Maximum number of nodes in b1 - Maximum number of nodes in b2 = 31

Maximum number of nodes in b1 - Maximum number of nodes in b2 = 32

Maximum number of nodes in b1 - Maximum number of nodes in b2 = 32

Maximum number of nodes in b1 - Maximum number of nodes in b2 = -32

Maximum number of nodes in b1 - Maximum number of nodes in b2 = -32

Maximum number of nodes in b1 - Maximum number of nodes in b2 = -31

Maximum number of nodes in b1 - Maximum number of nodes in b2 = -31

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
Choose the option in which Kadane’s algorithm will not answer correctly.

{-1,-2,-3,-4}

{-1,-2,-3,-4}

{-9,-5,-8,-8}

{-9,-5,-8,-8}

Both inputs will work correctly

Both inputs will work correctly

Both are wrong

Both are wrong

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
Suppose you are given an array of size 10. You want to delete the 5th element (from the start of the array). Which of the following approach is correct?

Move each of the last 5 elements (i.e. elements from the 6th index to the 10th index) one index to the left

Move each of the last 5 elements (i.e. elements from the 6th index to the 10th index) one index to the left

Move each of the last 5 elements (i.e. elements from the 10th index to 6th index) one index to the right

Move each of the last 5 elements (i.e. elements from the 10th index to 6th index) one index to the right

Change the value of the 5th element to 0

Change the value of the 5th element to 0

All of them are correct.

All of them are correct.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

Time: 00:00:00
Which of the data structures has a back edge ?

Singly linked list

Singly linked list

Tree

Tree

Graph

Graph

All of these

All of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
Identify the correct set of sorting techniques which has the same best-case time complexity from the given below options :

Bubble sort and selection sort

Bubble sort and selection sort

Selection sort and insertion sort

Selection sort and insertion sort

Insertion sort and bubble sort

Insertion sort and bubble sort

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00
What is the worst-case deletion time complexity in an array?

O(n)

O(n)

O(n^2)

O(n^2)

O(log(n))

O(log(n))

O(n log(n))

O(n log(n))

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
Suppose you are given a stack and 5 elements{1,2,3,4,5}. You have inserted three elements into the stack in the given order: 1 -> 2 -> 3 -> 4 -> 5. Now you have reversed the stack. After reversing, which will be the top element of the stack?

3

3

5

5

1

1

4

4

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
Consider a queue q={23,20,19,45,89,67}, You have performed enqueue(45), dequeue(), dequeue() operations consecutively, enqueue(k) will add element k at the end of the queue, dequeue() removes elements from the starting of the queue. Now the queue will look like:

45,23,20,18,45

45,23,20,18,45

25,23,23,20,18

25,23,23,20,18

23,20,19,45,89

23,20,19,45,89

19,45,89,67,45

19,45,89,67,45

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]