# Data structures and algorithms multiple choice questions with answers, important interview questions in data structures, data structures questions for entrance exams

__Data Structures and Algorithms Multiple Choice Questions __

__SET 06__

**1.
If you have just executed the command “delete myPtr”, which of the following conclusions
will be TRUE?**

(a) The memory referenced by myPtr is released only if it is needed by the system.

(b) The pointer myPtr is of type void *.

(c) The pointer myPtr only exists if there was an error freeing the memory.

(d) The pointer myPtr still exists

**2.
What kind of linked list begins with a pointer to the first node, and each node
contains a pointer to the next node, and the pointer in the last node points
back to the first node? **

(a) Circular, singly-linked list.

(b) Circular, doubly-linked list.

(c) Singly-linked list.

(d) Doubly-linked list.

**3.
How many pointers are contained as data members in the nodes of a circular,
doubly linked list of integers with five nodes? **

(a) 5

(b) 8

(c) 10

(d) 15

**4.
Which of the following statements about stacks is incorrect? **

(a) Stacks can be implemented using linked lists.

(b) Stacks are first-in, first-out (FIFO) data structures.

(c) New nodes can only be added to the top of the stack.

(d) The last node (at the bottom) of a stack has a null (0) link

**5.
Given the function definition**

*void Twist(int &a,
int b)*

*{*

*int c;*

*c = a + 2;*

*a = a * 3;*

*b = c + a;*

*}*

**What
is the output of the following code fragment?**

*r =1;*

*s =2;*

*t =3;*

*Twist(t, s);*

*cout « r « ‘’ « S « ‘’ « t
« endl;*

(a) 1, 2, 3

(b) 1 10 3

(c) 1 2 14

(d) 1 2 9

**6.
T(n) = 2n2 + 2n + 3. Which of the following is true about T(n)?**

(a) T(n) is O(n^{2})

(b) T(n) is Ω(n^{2})

(c) T(n) is Θ(n^{2})

(d) All of the above

**7.
What is the minimum number of data items in a B tree of height 4 with M = 4 and
L = 4?**

(a) 4

(b) 8

(c) 16

(d) 32

**8.
A company has a huge amount of data stored on external servers. They have even
more data to add and will be performing many insert operations, which they want
to be fast. Which of the following data structures will be most suitable (in
terms of run time) for this case?**

(a) Heap

(b) Queue

(c) B-tree

(d) AVL tree

**9.
What is the worst case time complexity of creating a binary min heap from the
elements in a binary search tree containing N elements?**

(a) O(1)

(b) O(N)

(c) O(log N)

(d) None of the above

** **

**10.
What is the tight bound worst case time complexity of popping an element from a
stack of N elements which was implemented using array data structure?**

(a) O(1)

(b) O(N)

(c) O(log N)

(d) None of the above

** **

**Click here for the answers**__Answer:__

**1 – (d), 2 – (a), 3 – (c), 4 – (b), 5
– (d), 6 – (d), 7 – (d), 8 – (c), 9 – (b), 10 – (a)**

** **

###
**Related links:**

**Related links:**

## No comments:

## Post a comment