What is data structure & Algorithms?
A data structure is a way of organizing and storing data in memory,
such as arrays, lists, stacks, queues, trees, graphs, etc. An algorithm is
a step-by-step procedure for solving a problem or performing a task, such
as sorting, searching, hashing, encryption, etc.
An Abstract Data Type (ADT) is a model for data structures that
defines the type of data stored, the operations that can be performed on
the data, and the types of parameters of the operation.
Linear Data Structure:
Data structure where data elements are arranged sequentially or linearly
where each and every element is attached to its previous and next
adjacent is called a linear data structure. Its examples
are array, stack, queue, linked list, etc.
Non-linear Data Structure :
Data structures where data elements are not arranged sequentially or
linearly are called non-linear data structures. Its examples are trees and graphs.
When new data are to be inserted into a data structure, but there is not available space; this
situation is usually called ….
a.
Underflow
b.
overflow
c.
houseful
d.
saturated
The operation of processing each element in the list is known as
a.
Sorting
b.
Merging
c.
Inserting
d.
Traversal
Which of these algorithmic approach tries to achieve localized optimum solution −
a.
Greedy approach
b.
Divide and conquer approach
c.
Dynamic approach
d.
All of the above
What is the worst case run-time complexity of binary search algorithm?
a.
Ο(n2)
b.
Ο(nlog n)
c.
Ο(n3)
d.
Ο(n)
Time complexity of Depth First Traversal of is
a.
Θ(|V|+|E|)
b.
Θ(|V|)
c.
Θ(|E|)
d.
Θ(|V|*|E|)
Minimum number of moves required to solve a Tower of Hanoi puzzle is
a.
2n2
b.
2n-1
c.
2n - 1
d.
2n - 1
The amount of time the computer needs to run to completion is known as_____.
a.
Space complexity
b.
Time complexity
c.
Recursive function
d.
None of the above
There is an extra element at the head of the list called a ……….
a.
Antinel
b.
Sentinel
c.
List header
d.
List head
What data structure is used for breadth first traversal of a graph?
a.
queue
b.
stack
c.
list
d.
none of the above
Prefix notation is also known as
a.
Reverse Polish Notation
b.
Reverse Notation
c.
Polish Reverse Notation
d.
Polish Notation
Identify the data structure which allows deletions at both ends of the list but insertion at only
one end.
a.
Input restricted dequeue
b.
Output restricted qequeue
c.
Priority queues
d.
Stack
The postfix form of the expression (A + B)∗(C∗D − E)∗F / G is
a.
AB + CD∗E − FG /∗∗
/ AB + CD ∗ E − F ∗∗G /
b.
AB + CD ∗ E − ∗F ∗ G /
c.
AB + CDE ∗ − ∗ F ∗ G /
d.
What is the postfix form of the following prefix expression -A/B*C$DE ?
a.
ABCDE$*/-
b.
A-BCDE$*/-
c.
ABC$ED*/-
d.
A-BCDE$*/
What data structure would you mostly likely see in a non recursive implementation of a
recursive algorithm?
a.
Stack
b.
Linked list
c.
Queue
d.
Trees
Which data structure is needed to convert infix notation to postfix notation?
a.
Branch
b.
Queue
c.
Tree
d.
Stack
If the two strings are identical, then strcmp() function returns
a.
-1
b.
1
c.
0
d.
Yes
Quick sort running time depends on the selection of
a.
size of array
b.
pivot element
c.
sequence of values
d.
none of the above
Which one of the following is the overflow condition if a circular queue is implemented using
array having size MAX?
1. rear= MAX-1
2. rear=MAX
3. front=(rear+1) mod max
4. None of the above
The necessary condition to be checked before deletion from the Queue is__
1. Overflow
2. Underflow
3. Rear value
4. Front value
Which one of the following data structures are preferred in database-system implementation?
1. AVL tree
2. B-tree
3. B+ - tree
4. Splay tree
What are the worst case and average case complexities of a binary search tree?
1. O(n), O(n)
2. O(log n), O(log n)
3. O(logn), O(n)
4. O(n), O(log n)
Which hashing technique is free from clustering?
1. Linear Probing
2. Double hashing
3. Quadratic hashing
4. Rehashing
Why we need to a binary tree which is height balanced?
1. to avoid formation of skew trees
2. to save memory
3. to attain faster memory access
4. to simplify storing
What is the worst case time complexity of inserting n elements into an empty linked list, if
the linked list needs to be maintained in sorted order ?
Θ(n)
Θ(n log n)
Θ(n2)
Θ(1)
What function is used to append a character at the back of a string in C++?
push_back()
append()
push()
insert()
Hide
Maps in C++ are implemented using which of the following data structures?
Red-Black Trees.
Binary Search Trees.
AVL Trees.
Hash Tables.
Which of the following data structure is non-linear type?
A. Strings
B. Lists
C. Stacks
D. None of above
The depth of a complete binary tree is given by
A. Dn = n log2n
B. Dn = n log2n+1
C. Dn = log2n
D. Dn = log2n+1
The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
A. ABFCDE
B. ADBFEC
C. ABDECF
D. ABDCEF
. The complexity of linear search algorithm is
A. O(n)
B. O(log n)
C. O(n^2)
D. O(n log n)
9. The complexity of Binary search algorithm is
A. O(n)
B. O(log )
C. O(n^2)
D. O(n log n)
10. The complexity of Bubble sort algorithm is
A. O(n)
B. O(log n)
C. O(n^2)
D. O(n log n)
The result of evaluating prefix expression */b+-dacd, where a = 3, b = 6, c = 1, d = 5 is
A. 0
B. 5
C. 10
D. 15
Worst case efficiency of binary search is
A. log2 n + 1
B. n
C. 2n
D. log n.
For the bubble sort algorithm, what is the time complexity of the best/worst case? (assume
that the computation stops as soon as no more swaps in one pass)
A. best case: O(n) worst case: O(n*n)
B. best case: O(n) worst case: O(n*log(n))
C. best case: O(n*log(n)) worst case: O(n*log(n))
D. best case: O(n*log(n)) worst case: O(n*n)
A. best case: O(n) worst case: O(n*n)
2. For the quick sort algorithm, what is the time complexity of the best/worst case?
A. best case: O(n) worst case: O(n*n)
B. best case: O(n) worst case: O(n*log(n))
C. best case: O(n*log(n)) worst case: O(n*log(n))
D. best case: O(n*log(n)) worst case: O(n*n)
The optimal solution to a problem is a combination of optimal solutions to its subproblems. This is
known as
A. Principleof Duality
B. Principle of Feasibility
C. Principle of Optimality
D. Principle of Dynamicity.
The divide and conquer merge sort algorithm’s time complexity can be defined as
A. (long n)
B. (n)
C. Ω (n log n)
D. (n log n)
19. Which algorithm is used in the top tree data structure?
a) Backtracking
b) Divide and Conquer
c) Branch
d) Greedy
Which of the following is the most widely used external memory data structure?
a) B-tree
b) Red-black tree
c) AVL tree
d) Both AVL tree and Red-black tree
What is the time complexity for searching a key or integer in Van Emde Boas data structure?
a) O (M!)
b) O (log M!)
c) O (log (log M))
d) O (M2)
28. What is the use of the bin data structure?
a) to have efficient traversal
b) to have efficient region query
c) to have efficient deletion
d) to have efficient insertion