You are on page 1of 14

04/10/2021, 11:51 DSA Unit Test- I AY2021-22

DSA Unit Test- I AY2021-22


Hi, Himanshu. When you submit this form, the owner will see your name and email address.

* Required

Roll Number *

23129

Name *

Himanshu Marathe

Which of the following points is/are not true about Linked List data
structure when it is compared with array?

*
(1 Point)

a) Arrays have better cache locality that can make them better in terms of performance

b) It is easy to insert and delete elements in Linked List


https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 1/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

c) Random access is not allowed in a typical implementation of Linked Lists

d) Access of elements in linked list takes less time than compared to arrays

´Consider the linear array AAA [5:50]

 Suppose Base (AAA) =300 and w=4 word per memory cell for AAA. Find the
address of AAA [15] *
(1 Point)

340

320

300

260

Choose correct output for the following sequence of operations.

push(5), push(8), pop, push(2), push(5), pop, pop, pop, push(1), pop *
(1 Point)

a)8 5 2 5 1

b)8 5 5 2 1

c)8 2 5 5 1

d)8 1 2 5 5

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 2/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

Suppose a circular queue of capacity (n – 1) elements is implemented with an


array of n elements. Assume that the insertion and deletion operation are
carried out using REAR and FRONT as array index variables, respectively.
Initially, REAR = FRONT = 0. The conditions to detect queue full and queue
empty are______________. *
(1 Point)

a)Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT

b)Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR

c)Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT

d)Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT

Merge sort uses which of the following technique to implement sorting?

*
(1 Point)

a) backtracking

b) greedy algorithm

c) divide and conquer

d) dynamic programming

What is the functionality of the following piece of code?

*
(1 Point)

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 3/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

a) Find and delete a given element in the list

b) Find and return the given element in the list

c) Find and return the position of the given element in the list

d) Find and insert a new element in the list

Which of the following is not a disadvantage to the usage of array? *


(1 Point)

a) Fixed size

b) There are chances of wastage of memory space if elements inserted in an array are
lesser than the allocated size

c) Insertion based on position

d) Accessing elements at specified positions

10

Internal sorting algorithm is the__________ *


(1 Point)

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 4/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

Algorithm that uses tape or disk during the sort

Algorithm that uses main memory during the sort

Algorithm that involves swapping

Algorithm that are considered ‘in place’

11

The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag
variable)The number of iterations in selection sort and bubble sort respectively
are,

answer choices *
(1 Point)

5 and 4

1 and 4

0 and 4

4 and 1

12

Choose the correct option for the following statements.

1. the worst-case time complexity of merge sort is O( n log n) and Quick Sort is
O(n^2)

2.the worst-case time complexity of merge sort is O(n^2) and Quick Sort is O(
n log n)

3.the worst-case time complexity of Quicksort is O(n^2) and it is stable

4.the best-case complexity of quick and merge sort is O( n log n) *


(1 Point)

a)1 and 3 is correct

b)2 and 3 is correct

c)1 and 4 is correct

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 5/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

d)3 and 4 is correct

13

Given an array arr = {45,77,89,90,94,99,100} and key = 100; What are the mid
values(corresponding array elements) generated in the first and second
iterations?

*
(1 Point)

a) 90 and 99

b) 90 and 100

c) 89 and 94

d) 94 and 99

14

Choose the appropriate code that does binary search using recursion. *
(1 Point)

a) 1.return recursive(arr,mid+1,high,key); 2.return recursive(arr,low,mid-1,key);


https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 6/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

b) 1. return recursive(arr,mid-1,high,key); 2. return recursive(arr,low,mid+1,key);

c) 1. return recursive(arr,mid,high,key); 2. return recursive(arr,low,mid-1,key);

d) 1.return recursive(arr,mid,high-1,key); 2. return recursive(arr,low,mid-1,key);

15

Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence


after first phase, pivot is first element? *
(1 Point)

6 4 3 7 11 9 14 12

6 3 4 7 9 14 11 12

7 6 14 11 9 4 3 12

7 6 4 3 9 14 11 12

16

If front==rear ,then the queue is? *


(1 Point)

a)full

b)one elemet

c)overflow

d)empty

17

What is the time complexity of inserting at the end in dynamic arrays? *


(1 Point)

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 7/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

a) O(1)

b) O(n)

c) O(logn)

d) Either O(1) or O(n)

18

One difference between a queue and a stack is:

*
(1 Point)

a)Queues require dynamic memory, but stacks do not

b)Stacks require dynamic memory, but queues do not.

c)Queues use two ends of the structure; stacks use only one.

d)Stacks use two ends of the structure, queues use only one.

19

A queue of characters currently contained A,B,C,D. What would be the contents


of queue after the following operation DELETE, ADD W, ADD X, DELETE, ADD Y.

*
(1 Point)

a)A,B,C,W,Y

b)C,D,W,X,Y

c)W,Y,X,C,D

d)A,B,C,D,W

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 8/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

20

What is the running time of an insertion sort algorithm if the input is pre-
sorted?

*
(1 Point)

a) O(N2)

b) O(N log N)

c) O(N)

d) O(M log N)

21

Consider the following statements:

(i) First-in-first out types of computations are efficiently supported by STACKS.

(ii) Implementing LISTS on linked lists is more efficient than implementing LISTS
on an array for almost all the basic LIST operations.

(iii) Implementing QUEUES on a circular array is more efficient than


implementing QUEUES on a linear array with two indices.

(iv) Last-in-first-out type of computations are efficiently supported by QUEUES.

*
(1 Point)

(a) (ii) and (iii) are true

(b) (i) and (ii) are true

(c) (iii) and (iv) are true

(d) (ii) and (iv) are true

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q4… 9/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

22

Let the following circular queue can accommodate maximum six elements with
the following data

front = 2 rear = 4

queue = L, M, N, ___, ___

What will happen after 'ADD O, P' and 'DEL' operation takes place?

*
(1 Point)

a)front = 3 rear = 0, queue = M, N, O, P

b)front = 3 rear = 6, queue = L, M, N, O, P

c)front = 4 rear = 4, queue = L, M, N, O, P

d)front = 2 rear = 0, queue = M, N, O, P

23

What is the error in the following code fragment?


float average [20];

average[20] = 13.25; *
(1 Point)

A cast is required

data not initialized

A two-dimensional array is required

Array Out-of-bounds error

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q… 10/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

24

"Linked lists are not suitable to for the implementation of?"

*
(1 Point)

a) Insertion sort

b) Merge sort

c) Polynomial manipulation

d) Binary search

25

Which of the following sorting algorithm is not stable?

*
(1 Point)

a)Bubble Sort

b)Insertion Sort

c)Merge Sort

d)Quick Sort

26

In a circular queue, how do you increment the rear end of the queue?

*
(1 Point)

a)rear++

b)(rear+1) % Number of Item

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q… 11/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

c)(rear % Number of Item)+1

(rear+1) % Number of Item-1

27

Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence


after first phase, pivot is first element?

*
(1 Point)

a) 6 4 3 7 11 9 14 12

b) 6 3 4 7 9 14 11 12

c) 7 6 14 11 9 4 3 12

d) 7 6 4 3 9 14 11 12

28

In linked list implementation of a queue, a new element be inserted _____and


deleted________.

*
(1 Point)

a)at the tail of the link list, at the head of link list,

b)at the head of link list, at the centre position in the link list

c)at the head of link list, at the tail of the link list

d)at any position, at the head of link list,

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q… 12/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

29

You are given pointers to first and last nodes of a singly linked list, which
of the following operations are dependent on the length of the linked list?
*
(1 Point)

a) Delete the first element

b) Insert a new element as a first element

c) Delete the last element of the list

d) Add a new element at the end of the list

30

What is the time complexity to count the number of elements in the linked list?

*
(1 Point)

a) O(1)

b) O(n)

c) O(logn)

d) O(n^2)

31

Which of the following sorting algorithms can be used to sort a random


linked list with minimum time complexity?

*
(1 Point)

a) Insertion Sort

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q… 13/14
04/10/2021, 11:51 DSA Unit Test- I AY2021-22

b) Quick Sort

c) Bubble Sort

d) Merge Sort

32

Consider the situation where no other data structure like arrays, linked list is
available to you. How many stacks are needed to implement a queue.

*
(1 Point)

Submit

This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is not
responsible for the privacy or security practices of its customers, including those of this form owner. Never give out your
password.

Powered by Microsoft Forms | Privacy and cookies | Terms of use

https://forms.office.com/pages/responsepage.aspx?id=PaYKCtCCoUu5CdeYbs5MTFqlQcj_0bhNr5zX40xkSbdURUVRSzVWOThWNU1PN0xPR0Q… 14/14

You might also like