You are on page 1of 8

G. H.

Raisoni Institute of Information Technology


MCA Department
Sub:- Data Structure
Objective Questions

1. Entries in a stack are "ordered". What is the meaning of this statement?

A. A collection of stacks can be sorted.

B. Stack entries may be compared with the '<' operation.

C. The entries must be stored in a linked list.

D. There is a first entry, a second entry, and so on.

2. The operation for adding an entry to a stack is traditionally called:

A. add

B. append

C. insert

D. push

3. The operation for removing an entry from a stack is traditionally called:

A. delete

B. peek

C. pop

D. remove
4. Which of the following stack operations could result in stack underflow?

A. is_empty

B. pop

C. push

D. Two or more of the above answers

5. Which of the following applications may use a stack?

A. A parentheses balancing program.

B. Keeping track of local variables at run time.

C. Syntax analyzer for a compiler.

D. All of the above.

6. One difference between a queue and a stack is:

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.

7. If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then
removed one at a time, in what order will they be removed?

A. ABCD

B. ABDC

C. DCAB

D. DCBA
8. Which of the following expressions evaluates to true with approximate probability
equal to P? (P is double and 0 <= P <= 1).

A. rand() < P

B. rand() > P

C. rand() < P * RAND_MAX

D. rand() > P * RAND_MAX

9. Suppose we have a circular array implementation of the queue class, with


ten items in the queue stored at data[2] through data[11]. The
CAPACITY is 42. Where does the push member function place the new entry in
the array?

A. data[1]

B. data[2]

C. data[11]

D. data[12]

10. If the inorder traversal of the binary tree T is

ADBGCFE

and each node of T has either 0 or 2 children, which of the following nodes is
NOT a leaf of that tree?

a. A
b. B
c. C
d. D
e. E
11. Of the following data structures, which would be best suited for an application

where search time must be minimized and where data can be easily added?

A. Singly linked list


B. Sorted array
C. Hash table
D. Sequential file
E. Circularly linked list with two header nodes

12.Of the following, which has the most impact on the efficiency of searching for

an item in a hash table?

A.The number of nonkey fields

B.The size of the table

C.The density of the table

D.Whether the size of the table is a prime number

E.The difficulty of computing the inverse of the hash function


13. What is the least order of execution time for the following code segment, if the

segment terminates without error?

i := 1;
Count := 0;
while i < N do
begin
Current := A[i];
while (Current = A[i]) and (i < N) do
i := i + 1;
Count = Count + 1
end

A. O(log N)

B O(√N)

C O(N)

D. O(N log N)

E. O(N2)

14. In the linked-list version of the Queue class, which operations require linear time
for their worst-case behavior?

A. getFront

B. insert

C. isEmpty

D. None of these operations require linear time.

15. An array of queues can be used to implement a priority queue, with each possible
priority corresponding to its own element in the array. When is this
implementation not feasible?

A. When the number of possible priorities is huge.

B. When the number of possible priorities is small.

C. When the queues are implemented using a linked list.

D. When the queues are implemented with circular arrays.


16. If data is a circular array of CAPACITY elements, and rear is an index into that
array, what is the formula for the index after rear?

A. (rear % 1) + CAPACITY

B. rear % (1 + CAPACITY)

C. (rear + 1) % CAPACITY

D. rear + (1 % CAPACITY)

14
/ \
2 11
/ \ / \
1 3 10 30
/ /
7 40

17. There is a tree at the top of this section. How many leaves does it

have?

A. 2

B. 4

C. 6

D. 8

E. 9
18.There is a tree at the top of this section. How many of the nodes have

at least one sibling?

A. 5

B. 6

C. 7

D. 8

E. 9

19.There is a tree in the box at the top of this section. What is the value stored in the
parent node of the node containing 30?

A. 10

B. 11

C. 14

D. 40

E. None of the above


20. Consider this binary search tree:

14
/ \
2 16
/ \
1 5
/
4

Suppose we remove the root, replacing it with something from the left subtree.
What will be the new root?

A. 1

B. 2

C. 4

D. 5

E. 16

You might also like