**Data Structure Multiple choice and objective type questions.**

**1) If the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack, the sequence of popped out values are ?**

- 2, 2, 1, 1, 2
- 2, 2, 1, 2, 2
- 2, 1, 2, 2, 1
- 2, 1, 2, 2, 2

Show/Hide Answer

**Answer = A**

Explanation:The elements are popped from the top of the stack.

Explanation:

**2) Queue can be used to implement ?**

- radix sort
- quick sort
- recursion
- depth first search

Show/Hide Answer

**Answer = A**

Explanation:A simple version of an LSD radix sort can be achieved using queues as buckets.

Explanation:

**3) A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can approximately sort ?**

- 400 names
- 800 names
- 750 names
- 800 names

Show/Hide Answer

**Answer = A**

Explanation:For sorting 200 names bubble sort makes 200 x 199/2 = 19900 comparisons. The time needed for 1 comparison is 200 sec. In 800 sec it can make 80,000 comparisons. We have to fine n, such that n(n - 1)/2 = 80,000. From this n is approximately 400.

Explanation:

**4) A machine needs a minimum of 100 sec to sort 1000 names by quick sort.The minimum time needed to sort 100 names will be approximately ?**

- 50.2 sec
- 6.7 sec
- 72.7 sec
- 11.2 sec

Show/Hide Answer

**Answer = B**

Explanation:In the best case quick sort algorithm makes n

Explanation:

*log*(n) comparisons. so 1000 x

*log*(1000) = 9000 comparisons, which takes 100 sec. To sort 100 names a minimum of 100

*log*(100) = 600 comparisons are needed. This takes 100 x 600/9000 = 6.7 sec.

**5) The number of binary trees with 3 nodes which when traversed in post order gives the sequence A,B,C is ?**

- 3
- 9
- 7
- 5

Show/Hide Answer

**6) The average search time of hashing with linear probing will be less if the load factor ?**

- is far less than one
- equals one
- is far greater than one
- none of above

Show/Hide Answer

**Answer = A**

Explanation:Load factor is the ratio number of records that are currently present and the total number of records that can be present. If the load factor is less, free space will be more. This means probability of collision is less. So the search time will be less.

Explanation:

**7) A binary tree that has n leaf nodes. The number of nodes of degree 2 in this tree is ?**

- log
_{2}n - n - 1
- n
- 2
^{n}

Show/Hide Answer

**Answer = B**

Explanation:It can be proved by induction that a binary tree with n leaf nodes will have total of 2n - 1 nodes. So number of non-leaf nodes is (2n - 1)-n=n-1

Explanation:

**8) The principal of locality justifies the use of ?**

- Interrupts
- DMA
- Polling
- Cache memory

Show/Hide Answer

**Answer = D**

Explanation:In principal of phenomenon the same value or same memory location is being used frequently.

Explanation:

**9) Sparse matrices have ?**

- many zero entries
- many non- zero entries
- higher dimension
- none of above

Show/Hide Answer

**Answer = A Explanation:**A sparse matrix is a matrix populated primarily with zeros

**10) The postfix expression for * + a b - c d is?**

- ab + cd - *
- ab cd + - *
- ab + cd * -
- ab + - cd *

Show/Hide Answer

**Answer = A**

Explanation:No Explanation

Explanation:

Do You Like This? Please take 5 seconds to share with your firends.

## 0 comments:

## Post a Comment