Sie sind auf Seite 1von 46

For n = 4, we get C4 = 14.

1.The smallest element of an array's index is For n = 5, we get C3 = 42.


called its
2. Which of the following numbers is the 6th
A. lower bound. Catalan number?
a) 14
B. upper bound.
b) 429
C. range. c) 132
d) None of the mentioned
D. extraction. View Answer
Answer: Option A Answer: d
2.The extra key inserted at the end of the array Explanation: Catalan numbers are given by:
is called a, (2n!)/((n+1)!n!).
First Catalan number is given by n = 0.
A. End key. So the 6th Catalan number will be given by n =
B. Stop key. 5, which is 42.

C. Sentinel. 3. Which of the following is/are applications of


Catalan numbers?
D. Transposition. a) Counting the number of Dyck words
b) Counting the number of expressions
Answer: Option C containing n pairs of parenthesis
c) Counting the number of ways in which a
3.Here is no explanation for this answer convex polygon can be cut into triangles by
connecting vertices with straight lines
The largest element of an array index is called d) All of the mentioned
its View Answer
A. lower bound. Answer: d
B. range. Explanation: Catalan numbers are used in all of
the above applications.
C. upper bound.
4. Which of the following methods can be used
D. All of these. to find the nth Catalan number?
a) Recursion
b) Binomial coefficients
Answer: Option C
c) Dynamic programming
d) All of the mentioned
4. Each array declaration need not give,
View Answer
implicitly or explicitly, the information about
Answer: d
A. the name of array
Explanation: All of the mentioned methods can
B. the data type of array be used to find the nth Catalan number.
C. the first data from the set to be stored 5. The recursive formula for Catalan number is
given by Cn = ∑Ci*C(n-i).
D. the index set of the array
Consider the following dynamic programming
Answer: Option C implementation for Catalan numbers:
1. Which of the following is NOT a Catalan #include<stdio.h>
number?
int cat_number(int n)
a) 1
b) 5 {
c) 14
int i,j,arr[n],k;
d) 43
View Answer arr[0] = 1;
Answer: d for(i = 1; i < n; i++)
Explanation: Catalan numbers are given by:
(2n!)/((n+1)!n!). {
For n = 0, we get C0 = 1. arr[i] = 0;
For n = 3, we get C3 = 5.
for(j = 0,k = i - 1; j < i; j++,k--) arr[i] = 0;
______________________; for(j = 0,k = i - 1; j < i; j++,k--)
} arr[i] += arr[j] * arr[k];
return arr[n-1]; }
return arr[n-1];
} }
int main() int main()
{ {
int ans, n = 8; int ans, n = 8;
ans = cat_number(n); ans = cat_number(n);
printf("%d\n",ans); printf("%d\n",ans);
return 0; return 0;
} }
Which of the following lines completes the a) 42
above code? b) 132
a) arr[i] = arr[j] * arr[k]; c) 429
b) arr[j] += arr[i] * arr[k]; d) 1430
c) arr[i] += arr[j] * arr[k]. View Answer
d) arr[j] = arr[i] * arr[k];
Answer: c
View Answer
Explanation: The program prints the 8th
Answer: c Catalan number, which is 429.
Explanation: The line arr[i] += arr[j] * arr[k]
8. Which of the following implementations of
reflects the recursive formula Cn = ∑Ci*C(n-i).
Catalan numbers has the largest space
6. Which of the following implementations of complexity(Don’t consider the stack space)?
Catalan numbers has the smallest time a) Dynamic programming
complexity? b) Binomial coefficients
a) Dynamic programming c) Recursion
b) Binomial coefficients d) All of the mentioned
c) Recursion View Answer
d) All of the mentioned
Answer: a
View Answer
Explanation: The space complexities are as
Answer: b follows:
Explanation: The time complexities are as Dynamic programming: O(n)
follows: Recursion: O(1)
Dynamic programming: O(n2) Binomial coefficients: O(1).
Recursion: Exponential
9. What will be the value stored in arr[5] when
Binomial coefficients: O(n).
the following code is executed?
7. What is the output of the following code?
#include<stdio.h>
#include<stdio.h>
int cat_number(int n)
int cat_number(int n)
{
{
int i,j,arr[n],k;
int i,j,arr[n],k;
arr[0] = 1;
arr[0] = 1;
for(i = 1; i < n; i++)
for(i = 1; i < n; i++)
{
{
arr[i] = 0;
for(j = 0,k = i - 1; j < i; j++,k--) }
arr[i] += arr[j] * arr[k]; a) Segmentation fault
b) Array size too large
}
c) Integer value out of range
return arr[n-1]; d) None of the mentioned
View Answer
}
Answer: c
int main() Explanation: The 100th Catalan number is too
{ large to be stored in an integer. So, the error
produced will be integer value out of range.(It
int ans, n = 10; will be a logical error and the compiler wont
ans = cat_number(n); show it).

printf("%d\n",ans); Q 1 - In order traversal of binary search tree


return 0; will produce −
} A - unsorted list
a) 14
B - reverse of input
b) 42
c) 132 C - sorted list
d) 429
View Answer D - none of the above
Answer: b
Answer : C
Explanation: The 6th Catalan number will be
stored in arr[5], which is 42. Explanation
10. Which of the following errors will occur Binary search tree yields a sorted list when
when the below code is executed? traversed in-order.
#include<stdio.h>
Q 2 - Postfix expression is just a reverse of
int cat_number(int n) prefix expression.
{
A - True
int i,j,arr[n],k;
B - False
arr[0] = 1;
for(i = 1; i < n; i++) Answer : B

{ Explanation

arr[i] = 0; Expression notations are not reverse (or so) of


each other, rather operators used in the
for(j = 0,k = i - 1; j < i; j++,k--)
expression have different arrangements.
arr[i] += arr[j] * arr[k];
}
Q 3 - Find the odd out
return arr[n-1];
} A - Prim's Minimal Spanning Tree Algorithm

int main() B- Kruskal's Minimal Spanning Tree


{ Algorithm

int ans, n = 100; C - Floyd-Warshall's All pair shortest path


ans = cat_number(n); Algorithm
printf("%d\n",ans); D- Dijkstra's Minimal Spanning Tree
return 0; Algorithm
Answer : C C - 1 → A, 2 → C, 3 → B
Explanation D - 1 → B, 2 → A, 3 → C
Floyd-Warshall's All pair shortest path
Answer : B
Algorithm uses dynamic programming
Explanation
approach. All other mentioned algorithms use
greedy programming approach
Q 7 - node.next -> node.next.next; will make

Q 4 - Binary search tree has best case run-time A - node.next inaccessible


complexity of Ο(log n). What could the worst
B - node.next.next inaccessible
case?
C - this node inaccessible
A - Ο(n)
D - none of the above
B - Ο(n2)
Answer : A
C - Ο(n3)
Explanation
D - None of the above After applying node.next ->
Answer : A node.next.next; we will not have node.next
Explanation stored anywhere if not explicitly mentioned.

In case where binary search tree is left or right


intended, the worst case can be Ο(n) Q 8 - Tower of hanoi is a classic example of

Q 5 - Apriory algorithm analysis does not A - divide and conquer


include −
B - recursive approach
A - Time Complexity
C - B but not A
B - Space Complexity
D - Both A & B
C - Program Complexity
Answer : D
D - None of the above! Explanation
Answer : C The recursive approach of tower of hanoi uses
Explanation divide and conquer method.

Algorithms are independent of programming Q 9 - The following sorting algorithms


languages, hence, program complexity is not a maintain two sub-lists, one sorted and one to
part of algorithm analysis. be sorted −

Q 6 - Match the following − A - Selection Sort


(1) Bubble B - Insertion Sort
(A) Ο(n)
Sort
(2) Shell C - Merge Sort
(B) Ο(n2)
Sort
(3) D - both A &am; B
(C) Ο(n
Selection
log n) Answer : D
Sort
A - 1 → A, 2 → B, 3 → C Explanation

B - 1 → B, 2 → C, 3 → A
Answer: Option A
Both selection sort and insertion sort
maintains two sublists and then checks 15. The smallest element of an array's index is
unsorted list for next sorted element. called
A. Lower bound
Q 10 - Project scheduling is an example of
B. Upper bound
A - greedy programming C. Range

B - dynamic programming D. Extraction


Answer: Option A
C - divide and conquer
Fibonacci sequence is the sequence of integers
D - none of the above. A. 1,3,5,7,9,11,13
Answer : B B. 0, 1, 1,2,3,5,8, 13,21,54 ....
Explanation C. 0, 1, 3, 4, 7, 11, 18, 29, 47 ...

11.Project scheduling is an exmaple of D. 0, 1, 3, 7, 15 ...


dynamic programming.
Answer: Option B
Arrays are best data structures
you wish to store a small amount of data and
A. for relatively permanent collections of data
make it available for rapid access. You do not
B. for the size of the structure and the data in the have a need for the data to be sorted,
structure are constantly changing uniqueness is not an issue and the data will
C. for both of above situation remain fairly static Which data structure might
be most suitable for this requirement?
D. for none of above situation
A. TreeSet
Answer: Option A
B. HashMap
12. Arrays are best data structures for C. LinkedList
A. relatively permanent collections of data D. an array
B. the size of the structure and the data in the Answer: Option D
structure are constantly changing
1. Which of these best describes an array?
C. both of above situation
a) A data structure that shows a hierarchical
D. none of above situation behavior
b) Container of objects of similar types
Answer: Option A c) Container of objects of mixed types
d) All of the mentioned
13.Two dimensional arrays are also called View Answer
A. tables arrays Answer: b.
B. matrix arrays 2. How do you initialize an array in C?
C. both of the above a) int arr[3] = (1,2,3);
b) int arr(3) = {1,2,3};
D. none of the above c) int arr[3] = {1,2,3};
d) int arr(3) = (1,2,3);
Answer: Option C View Answer

14.The memory address of the first element of an Answer: c


array is called
A. base address 3. How do you instantiate an array in Java?
a) int arr[] = new int(3);
B. floor address
b) int arr[];
C. foundation address c) int arr[] = new int[3];
D. first address d) int arr() = new int(3);
View Answer
Answer: c b) Run-time
4. Which of the following is a correct way to c) Not an error
declare a multidimensional array in Java? d) None of the mentioned
a) int[][] arr; View Answer
b) int arr[][];
Answer: b
c) int []arr[];
8. Which of the following concepts make
d) All of the mentioned
extensive use of arrays?
View Answer
a) Binary trees
Answer: d b) Scheduling of processes
5. What is the output of the following piece of c) Caching
code? d) Spatial locality
View Answer
public class array
Answer: d
{
9. What are the advantages of arrays?
public static void main(String args[]) a) Easier to store elements of same data type
b) Used to implement other data structures like
{ stack and queue
int []arr = {1,2,3,4,5}; c) Convenient way to represent matrices as a
2D array
System.out.println(arr[2]); d) All of the mentioned
System.out.println(arr[4]); View Answer

} Answer: d

}
10. What are the disadvantages of arrays?
a) 3 and 5 a) We must know before hand how many
b) 5 and 3 elements will be there in the array
c) 2 and 4 b) There are chances of wastage of memory
d) 4 and 2 space if elements inserted in an array are lesser
View Answer than than the allocated size
c) Insertion and deletion becomes tedious
Answer: a
d) All of the mentioned
6. What is the output of the following piece of
View Answer
code?
Answer: d
public class array
11. Assuming int is of 4bytes, what is the size
{ of int arr[15];?
a) 15
public static void main(String args[])
b) 19
{ c) 11
d) 60
int []arr = {1,2,3,4,5}; View Answer
System.out.println(arr[5]); Answer: d
} 1. Process of inserting an element in stack is called
____________
} a) Create
b) Push
a) 4
c) Evaluation
b) 5
d) Pop
c) ArrayIndexOutOfBoundsException
View Answer
d) InavlidInputException
View Answer Answer: b
Answer: c
ArrayIndexOutOfBoundsException. 2. Process of removing an element from stack
7. When does the is called __________
ArrayIndexOutOfBoundsException occur? a) Create
a) Compile-time b) Push
c) Evaluation
d) Pod during the computation?
View Answer a) 1
b) 2
Answer: d
c) 3
3. In a stack, if a user tries to remove an
d) 4 or more
element from empty stack it is called
View Answer
_________
a) Underflow Answer: b
b) Empty collection 9. What is the value of the postfix expression 6
c) Overflow 3 2 4 + – *:
d) Garbage Collection a) Something between -5 and -15
View Answer b) Something between 5 and -5
c) Something between 5 and 15
Answer: a
d) Something between 15 and 100
4. Pushing an element into stack already having
View Answer
five elements and stack size of 5 , then stack
becomes Answer: d
a) Overflow 10. Here is an infix expression: 4 + 3*(6*3-12).
b) Crash Suppose that we are using the usual stack
c) Underflow algorithm to convert the expression from infix
d) User flow to postfix notation.
View Answer The maximum number of symbols that will
appear on the stack AT ONE TIME during the
Answer: a
conversion of this expression?
5. Entries in a stack are “ordered”. What is the
a) 1
meaning of this statement?
b) 2
a) A collection of stacks is sortable
c) 3
b) Stack entries may be compared with the ‘<‘
d) 4
operation
View Answer
c) The entries are stored in a linked list
d) There is a Sequential entry that is one by one Answer: d
View Answer 1. The postfix form of the expression (A+ B)*(C*D-
E)*F / G is?
Answer : d a) AB+ CD*E – FG /**
6. Which of the following applications may use b) AB + CD* E – F **G /
a stack? c) AB + CD* E – *F *G /
a) A parentheses balancing program d) AB + CDE * – * F *G /
b) Tracking of local variables at run time View Answer
c) Compiler Syntax Analyzer
d) All of the mentioned Answer: a.
View Answer
2. The data structure required to check whether
Answer: d an expression contains balanced parenthesis is?
7. Consider the usual algorithm for determining a) Stack
whether a sequence of parentheses is balanced. b) Queue
The maximum number of parentheses that c) Array
appear on the stack AT ANY ONE TIME when d) Tree
the algorithm analyzes: (()(())(())) are: View Answer
a) 1
Answer: a
b) 2
3. What data structure would you mostly likely
c) 3
see in a non recursive implementation of a
d) 4 or more
recursive algorithm?
View Answer
a) Linked List
Answer: c b) Stack
8. Consider the usual algorithm for determining c) Queue
whether a sequence of parentheses is balanced. d) Tree
Suppose that you run the algorithm on a View Answer
sequence that contains 2 left parentheses and 3
Answer: b
right parentheses (in some order).
The maximum number of parentheses that
appear on the stack AT ANY ONE TIME
4. The process of accessing data stored in a Answer: b
serial access memory is similar to manipulating
1. The result of evaluating the postfix
data on a ________
expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
a) Heap
a) 600
b) Binary Tree
b) 350
c) Array
c) 650
d) Stack
d) 588
View Answer
View Answer
Answer: d
Answer: b
Explanation: None.
2. Convert the following infix expressions into
5. The postfix form of A*B+C/D is? its equivalent postfix expressions
a) *AB/CD+ (A + B ⋀D)/(E – F)+G
b) AB*CD/+ a) (A B D ⋀ + E F – / G +)
c) A*BC+/D b) (A B D +⋀ E F – / G +)
d) ABCD+/* c) (A B D ⋀ + E F/- G +)
View Answer d) None of the mentioned
View Answer
Answer: b
Answer: a
6. Which data structure is needed to convert
3. Convert the following Infix expression to
infix notation to postfix notation?
Postfix form using a stack
a) Branch
x + y * z + (p * q + r) * s, Follow usual
b) Tree
precedence rule and assume that the expression
c) Queue
is legal.
d) Stack
a) xyz*+pq*r+s*+
View Answer
b) xyz*+pq*r+s+*
Answer: d c) xyz+*pq*r+s*+
7. The prefix form of A-B/ (C * D ^ E) is? d) None of the mentioned
a) -/*^ACBDE View Answer
b) -ABCD*^DE
Answer: a
c) -A/B*C^DE
d) -A/BC*^DE
View Answer 4. Which of the following statement(s) about
stack data structure is/are NOT correct?
Answer: c
a) Linked List are used for implementing
8. What is the result of the following operation
Stacks
Top (Push (S, X))
b) Top of the Stack always contain the new
a) X
node
b) Null
c) Stack is the FIFO data structure
c) S
d) Null link is present in the last node at the
d) None of the mentioned
bottom of the stack
View Answer
View Answer
Answer: a
Answer: c
9. The prefix form of an infix expression p + q
– r * t is?
a) + pq – *rt 5. Consider the following operation performed
b) – +pqr * t on a stack of size 5.
c) – +pq * rt Push(1);
d) – + * pqrt Pop();
View Answer Push(2);
Push(3);
Answer: c
Pop();
10. Which data structure is used for
Push(4);
implementing recursion?
Pop();
a) Queue
Pop();
b) Stack
Push(5);
c) Array
After the completion of all operation, the
d) List
number of elements present in stack are
View Answer
a) 1 parenthesis is?
b) 2
c) 3 a) Stack
d) 4 b) Queue
View Answer c) Array
d) Tree
Answer: a
ANSWER: a) Stack
6. Which of the following is not an inherent
application of stack? 3. What data structure would you mostly
a) Reversing a string likely see in a non recursive implementation
b) Evaluation of postfix expression of a recursive algorithm?
c) Implementation of recursion
d) Job scheduling a) LinkList
View Answer b) Stack
c) Queue
Answer: d
d) Tree
7. The type of expression in which operator
ANSWER: b) Stack
succeeds its operands is?
a) Infix Expression 4. The process of accessing data stored in a
b) Prefix Expression serial access memory is similar to
c) Postfix Expression manipulating data on a ------?
d) None of the mentioned
View Answer a) Heap
b) Binary Tree
Answer: c
c) Array
Explanation: None.
d) Stack
8. Assume that the operators +,-, X are left ANSWER: d) Stack
associative and ^ is right associative. 5. The postfix form of A*B+C/D is?
The order of precedence (from highest to
lowest) is ^, X, +, -. The postfix expression for a) *AB/CD+
the infix expression a + b X c – d ^ e ^ f is b) AB*CD/+
a) abc X+ def ^^ – c) A*BC+/D
b) abc X+ de^f^ – d) ABCD+/*
c) ab+c Xd – e ^f^ ANSWER: b) AB*CD/+
d) -+aXbc^ ^def
6. Which data structure is needed to convert
View Answer
infix notation to postfix notation?
Answer: a
9. If the elements “A”, “B”, “C” and “D” are a) Branch
placed in a stack and are deleted one at a time, b) Tree
what is the order of removal? c) Queue
a) ABCD d) Stack
b) DCBA ANSWER: d) Stack
c) DCAB
7. The prefix form of A-B/ (C * D ⋀ E) is?
d) ABDC
View Answer
a) -/*⋀ACBDE
Answer: b b) -ABCD*⋀DE
c) -A/B*C⋀DE
1. The postfix form of the expression (A+ d) -A/BC*⋀DE
B)*(C*D- E)*F / G is?
ANSWER: c) -A/B*C⋀DE
a) AB+ CD*E - FG /** 8. What is the result of the following
b) AB + CD* E - F **G / operation
c) AB + CD* E - *F *G / Top (Push (S, X))
d) AB + CDE * - * F *G /
a) X
b) Null
ANSWER: a) AB+ CD*E - FG /** c) S
2. The data structure required to check d) None
whether an expression contains balanced ANSWER: a) X
9. The prefix form of an infix expression p + ANSWER: c) Stack is the FIFO data
q - r * t is? structure
15. Consider the linked list implementation
a) + pq - *rt of a stack. Which of the following node is
b) - +pqr * t considered as Top of the stack?
c) - +pq * rt
d) - + * pqrt a) First node
ANSWER: c) - +pq * rt b) Last node
c) Any node
10. Which data structure is used for d) Middle node
implementing recursion?
ANSWER: a) First node
16. Consider the following operation
a) Queue
performed on a stack of size 5.
b) Stack
Push(1);
c) Array
Pop();
d) List
Push(2);
ANSWER: b) Stack Push(3);
11. The result of evaluating the postfix Pop();
expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is? Push(4);
Pop();
a) 600 Pop();
b) 350 Push(5);
c) 650
d) 588 After the completion of all operation, the no of
ANSWER: b) 350 element present on stack are
12. Convert the following infix expressions a) 1
into its equivalent postfix expressions b) 2
(A + B ⋀D)/(E - F)+G c) 3
d) 4
a) (A B D ⋀ + E F - / G +) ANSWER: a) 1
b) (A B D +⋀ E F - / G +)
c) (A B D ⋀ + E F/- G +) 17. Which of the following is not an inherent
d) None application of stack?
ANSWER: a) (A B D ⋀ + E F - / G +)
a) Reversing a string
13. Convert the following Infix expression to b) Evaluation of postfix expression
Postfix form using a stack c) Implementation of recursion
d) Job scheduling
x + y * z + (p * q + r) * s, Follow usual ANSWER: d) Job scheduling
precedence rule and assume that the expression
is legal. 18. Which of the following operation take
worst case linear time in the array
a) xyz*+pq*r+s*+ implementation of stack?
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+ a) Push
d) none b) Pop
ANSWER: a) xyz*+pq*r+s*+ c) IsEmpty
d) None
14. Which of the following statement(s) ANSWER: d) None
about stack data structure is/are NOT
correct? 19. The type of expression in which operator
succeeds its operands is?
a) Stack data structure can be implemented
using linked list a) Infix Expression
b) New node can only be added at the top of b) pre fix Expression
the stack c) postfix Expression
c) Stack is the FIFO data structure d) None
d) The last node at the bottom of the stack has a ANSWER: c) postfix Expression
NULL link
20. Which of the following application 25. Consider the usual implementation of
generally use a stack? parentheses balancing program using stack.
What is the maximum number of
a) Parenthesis balancing program parentheses that will appear on stack at any
b) Syntax analyzer in compiler instance of time during the analysis of ( ( ) ( (
c) Keeping track of local variables at run time ) ) ( ( ) ) )?
d) All of the above
ANSWER: d) All of the above a) 1
b) 2
21. Consider the following array c) 3
implementation of stack: d) 4
ANSWER: c) 3
#define MAX 10
Struct STACK
{
Int arr [MAX]; 1. A linear list of elements in which
Int top = -1; deletion can be done from one end
} (front) and insertion can take place
only at the other end (rear) is known
If the array index starts with 0, the maximum as a ?
value of top which does not cause stack
overflow is? a) Queue
b) Stack
a) 8 c) Tree
b) 9 d) Linked list
c) 10
d) 11
ANSWER: a) 8
ANSWER: a) Queue
22. What is the minimum number of stacks
of size n required to implement a queue of
size n?
2. The data structure required for
a) One Breadth First Traversal on a graph is?
b) Two
c) Three a) Stack
d) Four b) Array
ANSWER: b) Two c) Queue
23. Assume that the operators +,-, X are left d) Tree
associative and ⋀ is right associative. The
order of precedence (from highest to lowest)
is ⋀, X, +, -. The postfix expression ANSWER: c) Queue
corresponding to the infix expression a + b X
c – d ⋀ e ⋀ f is

a) abc X+ def ⋀ ⋀ - 3. Let the following circular queue can


b) abc X+ de⋀f⋀ - accommodate maximum six elements
c) ab+c Xd – e ⋀f⋀ with the following data
d) -+aXbc⋀ ⋀def
ANSWER: a) abc X+ def ⋀ ⋀ - front = 2 rear = 4
24. If the elements “A”, “B”, “C” and “D” queue = _______; L, M, N, ___, ___
are placed in a stack and are deleted one at a What will happen after ADD O operation
time, in what order will they be removed? takes place?
a) front = 2 rear = 5
a) ABCD queue = ______; L, M, N, O, ___
b) DCBA b) front = 3 rear = 5
c) DCAB queue = L, M, N, O, ___
d) ABDC c) front = 3 rear = 4
ANSWER: b) DCBA
queue = ______; L, M, N, O, ___ b) At the tail of the link list
d) front = 2 rear = 4 c) At the centre position in the link list
queue = L, M, N, O, ___ d) None

ANSWER: a) ANSWER: b) At the tail of the link list

4. A queue is a ? 8. In the array implementation of


circular queue, which of the following
a) FIFO (First In First Out) list operation take worst case linear time?
b) LIFO (Last In First Out) list.
c) Ordered array a) Insertion
d) Linear tree b) Deletion
c) To empty a queue
d) None
ANSWER: a) FIFO (First In First Out) list

ANSWER: d) None

5. In Breadth First Search of Graph,


which of the following data structure
is used? 9. In linked list implementation of
queue, if only front pointer is
a) Stack maintained, which of the following
b) Queue operation take worst case linear time?
c) Linked list
d) None a) Insertion
b) Deletion
c) To empty a queue
ANSWER: b) Queue d) Both a) and c)

ANSWER: d) Both a) and c)


6. If the elements “A”, “B”, “C” and
“D” are placed in a queue and are
deleted one at a time, in what order
will they be removed? 10. If the MAX_SIZE is the size of the
array used in the implementation of
a) ABCD circular queue. How is rear
b) DCBA manipulated while inserting an
c) DCAB element in the queue?
d) ABCD
a) rear=(rear%1)+MAX_SIZE
b) rear=rear%(MAX_SIZE+1)
ANSWER: a) ABCD c) rear=(rear+1)%MAX_SIZE
d) rear=rear+(1%MAX_SIZE)

7. In linked list implementation of a ANSWER: c) rear=(rear+1)%MAX_SIZE


queue, where does a new element be
inserted?

a) At the head of link list 11. If the MAX_SIZE is the size of the
array used in the implementation of is?
circular queue, array index start with
0, front point to the first element in the a) Queue
queue, and rear point to the last b) Circular queue
element in the queue. Which of the c) Dequeue
following condition specify that d) Priority queue
circular queue is FULL?

a) Front=rear= -1 ANSWER: c) Dequeue


b) Front=(rear+1)%MAX_SIZE
c) Rear=front+1
d) Rear=(front+1)%MAX_SIZE
15. In linked list implementation of a
queue, front and rear pointers are
ANSWER: b) Front=(rear+1)%MAX_SIZE tracked. Which of these pointers will
change during an insertion into a
NONEMPTY queue?

12. A circular queue is implemented a) Only front pointer


using an array of size 10. The array b) Only rear pointer
index starts with 0, front is 6, and rear c) Both front and rear pointer
is 9. The insertion of next element d) None of the front and rear pointer
takes place at the array index.

a) 0 ANSWER: b) Only rear pointer


b) 7
c) 9
d) 10
16. A normal queue, if implemented
using an array of size MAX_SIZE, gets
ANSWER: a) 0 full when

a) Rear=MAX_SIZE-1
b) Front=(rear+1)mod MAX_SIZE
13. If the MAX_SIZE is the size of the c) Front=rear+1
array used in the implementation of d) Rear=front
circular queue, array index start with
0, front point to the first element in the
queue, and rear point to the last ANSWER: a) Rear=MAX_SIZE-1
element in the queue. Which of the
following condition specify that
circular queue is EMPTY?
17. In linked list implementation of a
a) Front=rear=0 queue, front and rear pointers are
b) Front= rear=-1 tracked. Which of these pointers will
c) Front=rear+1 change during an insertion into
d) Front=(rear+1)%MAX_SIZE EMPTY queue?

a) Only front pointer


ANSWER: b) Front= rear=-1 b) Only rear pointer
c) Both front and rear pointer
d) None

14. A data structure in which elements


can be inserted or deleted at/from ANSWER: c) Both front and rear pointer
both the ends but not in the middle
m=m-1
}
}
18. An array of size MAX_SIZE is used
to implement a circular queue. Front, What is the worst case time complexity of
Rear, and count are tracked. Suppose a sequence of n queue operations on an
front is 0 and rear is MAX_SIZE -1. initially empty queue?
How many elements are present in the
queue? a) θ (n)
b) θ (n + k)
a) Zero c) θ (nk)
b) One d) θ (n2)
c) MAX_SIZE-1
d) MAX_SIZE
ANSWER: a) θ (n)
1. Reversing a word using stack can be used to
find if the given word is a palindrome or not.
ANSWER: d) MAX_SIZE a) True
b) False
View Answer

19. Suppose a circular queue of Answer: a


capacity (n-1) elements is 2. Which is the most appropriate data structure
implemented with an array of n for reversing a word?
elements. Assume that the insertion a) queue
and deletion operations are carried b) stack
out using REAR and FRONT as array c) tree
d) graph
index variables, respectively. Initially
View Answer
REAR=FRONT=0. The conditions to
detect queue full and queue is empty Answer: b
are? 3. Operations required for reversing a word or a
string using stack are push() and pop().
a) Full: (REAR+1)mod n == FRONT a) True
Empty: REAR==FRONT b) False
b) Full: (REAR+1)mod n == FRONT View Answer
Empty: (FRONT+1) mod n == REAR Answer: a
c) Full: REAR==FRONT 4. What is the time complexity of reversing a
Empty: (REAR+1) mod n==FRONT word using stack algorithm?
d) Full: (FRONT+1)mod n==REAR a) O (N log N)
Empty: REAR==FRONT b) O (N2)
c) O (N)
d) O (M log N)
ANSWER: a) View Answer
Answer: c.
5. What will be the word obtained if the word
20. Consider the following operations “abbcabb” is reversed using a stack?
along with ENQUEUE and DEQUEUE a) bbabbca
b) abbcabb
operations queues, where k is a global
c) bbacbba
parameter.
d) bbacabb
View Answer
Multiqueue(Q)
{ Answer: c
m=k; 6. How many stacks are required for reversing
while(Q is not empty) and (m > 0) a word algorithm?
{ a) one
DEQUEUE(Q) b) two
c) three {
d) four
printf(“%s”, stack[top++]);
View Answer
}
Answer: a
7. What will be result if the given stack is a) run time error
popped? b) compile time error
c) pop operation is performed, but top moved
in wrong direction
d) pop operation is performed properly
View Answer
a) pat Answer: c
b) tap advertisement
c) atp
d) apt 12. What will be the output of the following
View Answer program?

Answer: b main()
{
8. What will be output if the following char str[]="san foundry";
sequence of operations are executed?
Push(a,s); int len = strlen(str);
Push(b,s); int i;
Pop(b);
Push(c,s);
a) abc for(i=0;i<len;i++)
b) b
c) ac push(str[i]); // pushes an element into
d) acb stack
View Answer
Answer: b
for(i=0;i<len;i++)
9. What are the set of functions that are to be
executed to get the following output? pop(); //pops an element from the stack
cat
a) push(c, s); push(a, s); push(t, s); }
pop(s); pop(s); pop(s); a) sanfoundry
b) push(c,s); pop(s); push(a,s); b) san foundry
pop(s);push(t,s);pop(s); c) yrdnuof nas
c) pop(c ); pop(a); pop(t); d) foundry nas
d) push(c,s); push(a,s); pop(t); View Answer
View Answer
Answer: c
Answer: b
1. What data structure is used when converting
an infix notation to prefix notation?
10. How will your stack look like if the word a) Stack
‘java’ is pushed? b) Queue
c) B-Trees
d) Linked-list
View Answer
Answer: a
2. What would be the Prefix notation for the
a) b) c) d) given equation?
View Answer
A+(B*C)
Answer: a
11. Find the error (if any) in the following code a) +A*CB
snippet for pop operation. b) *B+AC
c) +A*BC
void pop() //removing an element from a stack
d) *A+CB a) |&-+ab/cdef
View Answer b) &|-+ab/cdef
c) |&-ab+/cdef
Answer: c
d) |&-+/abcdef
3. What would be the Prefix notation for the
View Answer
given equation?
Answer: a
(A*B)+(C*D)
advertisement
a) +*AB*CD
9. What would be the Prefix notation for the
b) *+AB*CD
given equation?
c) **AB+CD
d) +*BA*CD (a+(b/c)*(d^e)-f)
View Answer
a) -+a*/^bcdef
Answer: a b) -+a*/bc^def
4. What would be the Prefix notation for the c) -+a*b/c^def
given equation? d) -a+*/bc^def
View Answer
A+B*C^D
Answer: b
a) +A*B^CD
10. What would be the Prefix notation for the
b) +A^B*CD
given equation?
c) *A+B^CD
d) ^A*B+CD A+B+C
View Answer
a) ++ABC and AB+C+
Answer: a b) AB+C+ and ++ABC
5. Out of the following operators (^, *, +, &, $), c) ABC++ and AB+C+
the one having highest priority is _________ d) ABC+ and ABC+
a) + View Answer
b) $
Answer: a
c) ^
11. What would be the Prefix notation for the
d) &
given equation?
View Answer
a|b&c
Answer: c
a) a|&bc
b) |ab&c
6. Out of the following operators (|, *, +, &, $),
c) |abc&
the one having lowest priority is ________
d) ab&|c
a) +
View Answer
b) $
c) | Answer: b
d) &
View Answer 1. When an operand is read, which of the
following is done?
Answer: b a) It is placed on to the output
7. What would be the Prefix notation for the b) It is placed in operator stack
given equation? c) It is ignored
d) Operator stack is emptied
A^B^C^D
View Answer
a) ^^^ABCD
Answer: a
b) ^A^B^CD
Explanation: While converting an infix
c) ABCD^^^
expression to a postfix expression, when an
d) AB^C^D
operand is read, it is placed on to the output.
View Answer
When an operator is read, it is placed in the
Answer: a operator stack.
8. What would be the Prefix notation for the
2. What should be done when a left parenthesis
given equation?
‘(‘ is encountered?
a+b-c/d&e|f a) It is ignored
b) It is placed in the output
c) It is placed in the operator stack Answer: a
d) The contents of the operator stack is emptied 8. What is the postfix expression for the infix
View Answer expression?
Answer: c a-b-c
Explanation: When a left parenthesis is
a) -ab-c
encountered, it is placed on to the operator
b) abc–
stack. When the corresponding right
c) –abc
parenthesis is encountered, the stack is popped
d) -ab-c
until the left parenthesis and remove both the
View Answer
parenthesis.
Answer: d
3. Which of the following is an infix
9. What is the postfix expression for the
expression?
following infix expression?
a) (a+b)*(c+d)
b) ab+c* a/b^c-d
c) +ab
d) abc+* a) abc^/d-
View Answer b) ab/cd^-
c) ab/^cd-
Answer: a d) abcd^/-
Explanation: (a+b)*(c+d) is an infix View Answer
expression. +ab is a prefix expression and
ab+c* is a postfix expression. Answer: a
10. Which of the following statement is
4. What is the time complexity of an infix to incorrect with respect to infix to postfix
postfix conversion algorithm? conversion algorithm?
a) O(N log N) a) operand is always placed in the output
b) O(N) b) operator is placed in the stack when the
c) O(N2) stack operator has lower precedence
d) O(M log N) c) parenthesis are included in the output
View Answer d) higher and equal priority operators follow
the same condition
Answer: b
View Answer
Explanation: The time complexity of an infix to
postfix expression conversion algorithm is Answer: c
mathematically found to be O(N). 11. In infix to postfix conversion algorithm, the
operators are associated from?
5.What is the postfix expression for the
a) right to left
corresponding infix expression?
b) left to right
a+b*c+(d*e) c) centre to left
d) centre to right
a) abc*+de*
Answer: b
b) abc+*de*
12. What is the corresponding postfix
c) a+bc*de+*
expression for the given infix expression?
d) abc*+(de)*
View Answer a*(b+c)/d
Answer: a a) ab*+cd/
6. Parentheses are simply ignored in the b) ab+*cd/
conversion of infix to postfix expression. c) abc*+/d
a) True d) abc+*d/
b) False View Answer
View Answer
Answer: d
Answer: b 13. What is the corresponding postfix
7. It is easier for a computer to process a expression for the given infix expression?
postfix expression than an infix expression.
a+(b*c(d/e^f)*g)*h)
a) True
b) False a) ab*cdef/^*g-h+
View Answer b) abc*def^/g*-h*+
c) abcd*^ed/g*-h*+
d) abc*de^fg/*-*h+
View Answer a) Deleting a node whose location in given
b) Searching of an unsorted list for a given item
Answer: b
c) Inverting a node after the node with given
14. What is the correct postfix expression for
location
the following expression?
d) Traversing a list to process each node
a+b*(c^d-e)^(f+g*h)-i ANSWER: A
a) abc^de-fg+*^*+i- 4. Consider an implementation of unsorted
b) abcde^-fg*+*^h*+i- singly linked list. Suppose it has its
c) abcd^e-fgh*+^*+i- representation with a head and tail pointer.
d) ab^-dc*+ef^gh*+i- Given the representation, which of the
View Answer following operation can be implemented in
O(1) time?
Answer: c
15. From the given Expression tree, identify the i) Insertion at the front of the linked list
correct postfix expression from the list of ii) Insertion at the end of the linked list
options. iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked list

a) I and II
b) I and III
c) I,II and III
d) I,II and IV
ANSWER: C
5. Consider an implementation of unsorted
a) ab*cd*+ singly linked list. Suppose it has its
b) ab*cd-+ representation with a head pointer only.
c) abcd-*+ Given the representation, which of the
d) ab*+cd- following operation can be implemented in
View Answer O(1) time?

Answer: b i) Insertion at the front of the linked list


1. In a circular linked list ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
a) Components are all linked together in some iv) Deletion of the last node of the linked list
sequential manner.
b) There is no beginning and no end. a) I and II
c) Components are arranged hierarchically. b) I and III
d) Forward and backward traversal within the c) I,II and III
list is permitted. d) I,II and IV
ANSWER: B
6. Consider an implementation of unsorted
doubly linked list. Suppose it has its
ANSWER: B representation with a head pointer and tail
2. A linear collection of data elements where pointer. Given the representation, which of
the linear node is given by means of pointer the following operation can be implemented
is called? in O(1) time?

a) Linked list i) Insertion at the front of the linked list


b) Node list ii) Insertion at the end of the linked list
c) Primitive list iii) Deletion of the front node of the linked list
d) None iv) Deletion of the end node of the linked list
ANSWER: A
a) I and II
3. Which of the following operations is b) I and III
performed more efficiently by doubly linked c) I,II and III
list than by singly linked list?
d) I,II,III and IV a) Pointer to character
ANSWER: D b) Pointer to integer
c) Pointer to node
7. Consider an implementation of unsorted d) Node
doubly linked list. Suppose it has its
ANSWER: C
representation with a head pointer only.
Given the representation, which of the 11. What would be the asymptotic time
following operation can be implemented in complexity to add a node at the end of singly
O(1) time? linked list, if the pointer is initially pointing
to the head of the list?
i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list a) O(1)
iii) Deletion of the front node of the linked list b) O(n)
iv) Deletion of the end node of the linked list c) θ (n)
d) θ (1)
a) I and II ANSWER: C
b) I and III
c) I,II and III 12. What would be the asymptotic time
d) I,II,III and IV complexity to add an element in the linked
list?
ANSWER: B
8. Consider an implementation of unsorted a) O(1)
circular linked list. Suppose it has its b) O(n)
representation with a head pointer only. c) O(n2)
Given the representation, which of the d) None
following operation can be implemented in ANSWER: B
O(1) time?
13. What would be the asymptotic time
i) Insertion at the front of the linked list complexity to find an element in the linked
ii) Insertion at the end of the linked list list?
iii) Deletion of the front node of the linked list
a) O(1)
iv) Deletion of the end node of the linked list
b) O(n)
c) O(n2)
a) I and II
d) None
b) I and III
c) I, II, III and IV ANSWER: B
d) None 14. What would be the asymptotic time
ANSWER: D complexity to insert an element at the second
position in the linked list?
9. Consider an implementation of unsorted
circular doubly linked list. Suppose it has its
a) O(1)
representation with a head pointer only.
b) O(n)
Given the representation, which of the
c) O(n2)
following operation can be implemented in
d) None
O(1) time?
ANSWER: A
i) Insertion at the front of the linked list 15. The concatenation of two list can
ii) insertion at the end of the linked list performed in O(1) time. Which of the
iii) Deletion of the front node of the linked list following variation of linked list can be
iv) Deletion of the end node of the linked list used?

a) I and II a) Singly linked list


b) I and III b) Doubly linked list
c) I, II and III c) Circular doubly linked list
d) I,II,III and IV d) Array implementation of list
ANSWER: D ANSWER: C
10. In linked list each node contain 16. Consider the following definition in c
minimum of two fields. One field is data programming language
field to store the data second field is?
struct node
{ 21. A variant of the linked list in which none
int data; of the node contains NULL pointer is?
struct node * next;
} a) Singly linked list
typedef struct node NODE; b) Doubly linked list
NODE *ptr; c) Circular linked list
d) None
Which of the following c code is used to create ANSWER: C
new node?
22. In circular linked list, insertion of node
a) ptr=(NODE*)malloc(sizeof(NODE)); requires modification of?
b) ptr=(NODE*)malloc(NODE);
a) One pointer
c) ptr=(NODE*)malloc(sizeof(NODE*));
b) Two pointer
d) ptr=(NODE)malloc(sizeof(NODE));
c) Three pointer
ANSWER: A
d) None
17. A variant of linked list in which last node ANSWER: B
of the list points to the first node of the list
23. Which of the following statements about
is?
linked list data structure is/are TRUE?
a) Singly linked list
a) Addition and deletion of an item to/ from the
b) Doubly linked list
linked list require modification of the existing
c) Circular linked list
pointers
d) Multiply linked list
b) The linked list pointers do not provide an
ANSWER: C
efficient way to search an item in the linked list
18. In doubly linked lists, traversal can be c) Linked list pointers always maintain the list
performed? in ascending order
a) Only in forward direction d) The linked list data structure provides an
b) Only in reverse direction efficient way to find kth element in the list
c) In both directions ANSWER: B
d) None
24. Linked lists are not suitable to for the
ANSWER: C
implementation of?
19. What kind of linked list is best to answer
question like “What is the item at position a) Insertion sort
n?” b) Radix sort
c) Polynomial manipulation
a) Singly linked list d) Binary search
b) Doubly linked list ANSWER: D
c) Circular linked list
d) Array implementation of linked list 25. In worst case, the number of comparison
need to search a singly linked list of length n
ANSWER: D
for a given element is
20. A variation of linked list is circular
linked list, in which the last node in the list a) log n
points to first node of the list. One problem b) n/2
with this type of list is? c) log2n-1
d) n
a) It waste memory space since the pointer ANSWER: D
head already points to the first node and thus
26. consider the function f defined here:
the list node does not need to point to the first
node.
struct item
b) It is not possible to add a node at the end of
{
the list.
int data;
c) It is difficult to traverse the list as the pointer
struct item * next;
of the last node is now not NULL
};
d) All of above
int f (struct item *p)
ANSWER: C
{
return((p==NULL) ||((p->next==NULL)||(p-
>data<=p->next->data) && (p->next))); int value;
} struct node* next;
};
For a given linked list p, the function f returns void rearrange (struct node* list)
1 if and only if {
struct node *p,q;
a) the list is empty or has exactly one element int temp;
b) the element in the list are sorted in non- if (! List || ! list->next) return;
decreasing order of data value p->list; q=list->next;
c) the element in the list are sorted in non- while(q)
increasing order of data value {
d) not all element in the list have the same data temp=p->value; p->value=q->value;
value q->value=temp;p=q->next;
ANSWER: B q=p?p->next:0;
}
27. The following C function takes a singly }
linked list as input argument. It modifies the
list by moving the last element to the front of a) 1, 2, 3, 4, 5, 6, 7
the list and returns the modified list. Some b) 2, 1, 4, 3, 6, 5, 7
part of the code left blank. c) 1, 3, 2, 5, 4, 7, 6
d) 2, 3, 4, 5, 6, 7, 1
typedef struct node
ANSWER: B
{
int value; 1. The height of a BST is given as h.
struct node* next; Consider the height of the tree as the
}Node; no. of edges in the longest path from
Node* move_to_front(Node* head) root to the leaf. The maximum no. of
{ nodes possible in the tree is?
Node* p, *q;
if((head==NULL) || (head->next==NULL)) a) 2h-1 -1
return head; b) 2h+1 -1
q=NULL; c) 2h +1
p=head; d) 2h-1 +1
while(p->next != NULL)
{
q=p; ANSWER: B
p=p->next;
} 2. The no of external nodes in a full
return head; binary tree with n internal nodes is?
}
a) n
Choose the correct alternative to replace the b) n+1
blank line c) 2n
d) 2n + 1
a) q=NULL; p->next=head; head =p ; ANSWER: B
b) q->next=NULL; head =p; p->next = head; 3. The difference between the external
c) head=p; p->next=q; q->next=NULL; path length and the internal path
d) q->next=NULL; p->next=head; head=p; length of a binary tree with n internal
ANSWER: D nodes is?
28. The following C Function takes a singly-
linked list of integers as a parameter and a) 1
rearranges b) n
the elements of the lists. The function is c) n + 1
called with the list containing the integers d) 2n
1,2,3,4,5,6,7 in the given order. What will be ANSWER: D
the contents of the list after the function 4. Suppose a binary tree is
completes execution? constructed with n nodes, such that
each node has exactly either zero or
struct node{ two children. The maximum height of
the tree will be? a) 2h -1
b) 2h -1 + 1
a) (n+1)/2 c) 2h -1
b) (n-1)/2 d) 2h +1
c) n/2 -1 ANSWER: C
d) (n+1)/2 -1
ANSWER: B 10. A 2-3 is a tree such that
5. Which of the following statement
about binary tree is CORRECT? a) All internal nodes have either 2 or 3
children
a) Every binary tree is either complete or b) All path from root to leaves have the
full same length
b) Every complete binary tree is also a
full binary tree The number of internal nodes of a 2-3
c) Every full binary tree is also a tree having 9 leaves could be
complete binary tree
d) A binary tree cannot be both complete a) 4
and full b) 5
ANSWER: C c) 6
6. Suppose we have numbers between d) 7
1 and 1000 in a binary search tree and ANSWER: A, D
want to search for the number 363.
Which of the following sequence 11. If a node having two children is to
could not be the sequence of the node be deleted from binary search tree, it
examined? is replaced by its

a) 2, 252, 401, 398, 330, 344, 397, 363 a) In-order predecessor


b) 924, 220, 911, 244, 898, 258, 362, b) In-order successor
363 c) Pre-order predecessor
c) 925, 202, 911, 240, 912, 245, 258, 363 d) None
d) 2, 399, 387, 219, 266, 382, 381, 278, ANSWER: B
363
ANSWER: C 12. A binary search tree is formed
7. In full binary search tree every from the sequence 6, 9, 1, 2, 7, 14, 12,
internal node has exactly two 3, 8, 18. The minimum number of
children. If there are 100 leaf nodes in nodes required to be added in to this
the tree, how many internal nodes are tree to form an extended binary tree
there in the tree? is?

a) 25 a) 3
b) 49 b) 6
c) 99 c) 8
d) 101 d) 11
ANSWER: C ANSWER: D
8. Which type of traversal of binary 13. In a full binary tree, every internal
search tree outputs the value in node has exactly two children. A full
sorted order? binary tree with 2n+1 nodes contains

a) Pre-order a) n leaf node


b) In-order b) n internal nodes
c) Post-order c) n-1 leaf nodes
d) None d) n-1 internal nodes
ANSWER: B ANSWER: B
9. Suppose a complete binary tree has 14. the run time for traversing all the
height h>0. The minimum no of leaf nodes of a binary search tree with n
nodes possible in term of h is? nodes and printing them in an order is
a) O(nlg(n))
b) O(n)
c) O(√n) 20. The maximum number of elements
d) O(log(n)) in a heap of height h is
ANSWER: B
15. When a binary tree is converted in a) 2h+1 -1
to an extended binary tree, all the b) 2h
nodes of a binary tree in the external c) 2h -1
node becomes d) 2h -1
ANSWER: A
a) Internal nodes 21. A threaded binary tree is a binary
b) External nodes tree in which every node that does not
c) Root nodes have right child has a thread to its
d) None
ANSWER: A a) Pre-order successor
16. If n numbers are to be sorted in b) In-order successor
ascending order in O(nlogn) time, c) In-order predecessor
which of the following tree can be d) Post-order successor
used ANSWER: B
22. In which of the following tree,
a) Binary tree parent node has a key value greater
b) Binary search tree than or equal to the key value of both
c) Max-heap of its children?
d) Min-heap
ANSWER: D a) Binary search tree
17. If n elements are sorted in a binary b) Threaded binary tree
search tree. What would be the c) Complete binary tree
asymptotic complexity to search a key d) Max-heap
in the tree? ANSWER: D

a) O(1) 23. A binary tree T has n leaf nodes.


b) O(logn) The number of nodes of degree 2 in T
c) O(n) is
d) O(nlogn)
ANSWER: C a) log2n
b) n-1
18. If n elements are sorted in a c) n
balanced binary search tree. What d) 2n
would be the asymptotic complexity ANSWER: B
to search a key in the tree?
24. A binary search tree is generated
a) O(1) by inserting in order the following
b) O(logn) integers:
c) O(n) 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24
d) O(nlogn)
ANSWER: B The number of the node in the left sub-
19. The minimum number of elements tree and right sub-tree of the root,
in a heap of height h is respectively, is

a) 2h+1 a) (4, 7)
b) 2h b) (7, 4)
c) 2h -1 c) (8, 3)
d) 2h-1 d) (3, 8)

ANSWER: B ANSWER: B
1. Which of the following is not a d) O(n2)
stable sorting algorithm? ANSWER: C

a) Insertion sort 8. If the given input array is sorted or


b) Selection sort nearly sorted, which of the following
c) Bubble sort algorithm gives the best
d) Merge sort performance?
ANSWER: B
a) Insertion sort
2. Which of the following is a stable b) Selection sort
sorting algorithm? c) Quick sort
d) Merge sort
a) Merge sort ANSWER: A
b) Typical in-place quick sort 9. Which of the following algorithm
c) Heap sort pays the least attention to the
d) Selection sort ordering of the elements in the input
ANSWER: A list?
3. Which of the following is not an in-
place sorting algorithm? a) Insertion sort
b) Selection sort
a) Selection sort c) Quick sort
b) Heap sort d) None
c) Quick sort ANSWER: B
d) Merge sort 10. Consider the situation in which
ANSWER: D assignment operation is very costly.
4. Running merge sort on an array of Which of the following sorting
size n which is already sorted is algorithm should be performed so that
the number of assignment operations
a) O(n) is minimized in general?
b) O(nlogn)
c) O(n2) a) Insertion sort
d) None b) Selection sort
ANSWER: B c) Heap sort
5. The time complexity of a quick sort d) None
algorithm which makes use of median, ANSWER: B
found by an O(n) algorithm, as pivot 11. Time complexity of bubble sort in
element is best case is

a) O(n2) a) θ (n)
b) O(nlogn) b) θ (nlogn)
c) O(nloglogn) c) θ (n2)
d) O(n) d) θ (n(logn) 2)
ANSWER: B ANSWER: A
6. Which of the following is not a 12. Given a number of elements in the
noncomparison sort? range [0….n3]. which of the following
sorting algorithms can sort them in
a) Counting sort O(n) time?
b) Bucket sort
c) Radix sort a) Counting sort
d) Shell sort b) Bucket sort
ANSWER: D c) Radix sort
7. The time complexity of heap sort in d) Quick sort
worst case is ANSWER: C

a) O(logn)
b) O(n)
c) O(nlogn)
13. Which of the following algorithms
has lowest worst case time
complexity? 19. The radix sort does not work
correctly if each individual digit is
a) Insertion sort sorted using
b) Selection sort
c) Quick sort a) Insertion sort
d) Heap sort b) Counting sort
ANSWER: D c) Selection sort
14. Which of the following sorting d) Bubble sort
algorithms is/are stable ANSWER: C

a) Counting sort 20. Which of the following sorting


b) Bucket sort algorithm has the running time that is
c) Radix sort least dependant on the initial ordering
d) All of the above of the input?
ANSWER: D
15. Counting sort performs …………. a) Insertion sort
Numbers of comparisons between b) Quick sort
input elements. c) Merge sort
d) Selection sort
a) 0 ANSWER: D
b) n 21. Time complexity to sort elements
c) nlogn of binary search tree is
d) n2
ANSWER: A a) O(n)
b) O(nlogn)
16. The running time of radix sort on c) O(n2)
an array of n integers in the range d) O(n2logn)
[0……..n5 -1] when using base 10 ANSWER: A
representation is 22. The lower bound on the number of
comparisons performed by
a) θ (n) comparison-based sorting algorithm
b) θ (nlogn) is
c) θ (n2)
d) none a) Ω (1)
ANSWER: B b) Ω (n)
17. The running time of radix sort on c) Ω (nlogn)
an array of n integers in the range d) Ω (n2)
[0……..n5 -1] when using base n ANSWER: C
representation is 23. Which of the following
algorithm(s) can be used to sort n
a) θ (n) integers in range [1…..n3] in O(n)
b) θ (nlogn) time?
c) θ (n2)
d) None a) Heap sort
ANSWER: A b) Quick sort
18. Which of the following sorting c) Merge sort
algorithm is in-place d) Radix sort
ANSWER: D
a) Counting sort 24. Which of the following algorithm
b) Radix sort design technique is used in the quick
c) Bucket sort sort algorithm?
d) None
ANSWER: B a) Dynamic programming
b) Backtracking
c) Divide-and-conquer
d) Greedy method
ANSWER: C
ANSWER: A
25. Merge sort uses 1. A linear list of elements in which deletion
can be done from one end (front) and insertion
a) Divide-and-conquer can take place only at the other end (rear) is
b) Backtracking known as a ?
c) Heuristic approach a) Queue
d) Greedy approach b) Stack
ANSWER: A c) Tree
26. For merging two sorted lists of d) Linked list
size m and n into sorted list of size View Answer
m+n, we require comparisons of
Answer: a
a) O(m) Explanation: None.
b) O(n) 2. The data structure required for Breadth First
c) O(m+n) Traversal on a graph is?
d) O(logm + logn) a) Stack
ANSWER: C b) Array
27. A sorting technique is called c) Queue
stable if it d) Tree
View Answer
a) Takes O(nlogn) times
Answer: c
b) Maintains the relative order of Explanation: None.
occurrence of non-distinct elements
c) Uses divide-and-conquer paradigm 3. A queue is a ?
d) Takes O(n) space a) FIFO (First In First Out) list
ANSWER: B b) LIFO (Last In First Out) list
28. In a heap with n elements with the c) Ordered array
smallest element at the root, the d) Linear tree
seventh smallest element can be View Answer
found in time Answer: a
Explanation: None.
a) θ (nlogn)
b) θ (n) 4. In Breadth First Search of Graph, which of
c) θ (logn) the following data structure is used?
d) θ (1) a) Stack
ANSWER: A b) Queue
29. What would be the worst case time c) Linked list
complexity of the insertion sort d) None of the mentioned
View Answer
algorithm, if the inputs are restricted
to permutation of 1…..n with at most n Answer: b
inversion? Explanation: None.
5. If the elements “A”, “B”, “C” and “D” are
a) θ (n2)
placed in a queue and are deleted one at a time,
b) θ (nlogn) in what order will they be removed?
c) θ (n1.5) a) ABCD
d) θ (n) b) DCBA
ANSWER: D c) DCAB
30. In a binary max heap containing n d) ABDC
numbers, the smallest element can be View Answer
found in time
Answer: a
a) θ (n) Explanation: Queue follows FIFO approach.
b) θ (logn) 6. A data structure in which elements can be
c) θ (loglogn) inserted or deleted at/from both the ends but
d) θ (1) not in the middle is?
a) Queue
b) Circular queue c) I, II and III
c) Dequeue d) I, II and IV
d) Priority queue View Answer
View Answer
Answer: b
Answer: c Explanation: None.
Explanation: None.
3. In linked list each node contain minimum of
7. A normal queue, if implemented using an two fields. One field is data field to store the
array of size MAX_SIZE, gets full when data second field is?
a) Rear = MAX_SIZE – 1 a) Pointer to character
b) Front = (rear + 1)mod MAX_SIZE b) Pointer to integer
c) Front = rear + 1 c) Pointer to node
d) Rear = front d) Node
View Answer View Answer
Answer: a Answer: c
Explanation: Condition for size of queue. Explanation: None.
advertisement 4. What would be the asymptotic time
complexity to add a node at the end of singly
8. Queues serve major role in
linked list, if the pointer is initially pointing to
a) Simulation of recursion
the head of the list?
b) Simulation of arbitrary linked list
a) O(1)
c) Simulation of limited resource allocation
b) O(n)
d) All of the mentioned
c) θ(n)
View Answer
d) θ(1)
Answer: c View Answer
9. Which of the following is not the type of
Answer: c
queue?
Explanation: None.
a) Ordinary queue
b) Single ended queue 5. What would be the asymptotic time
c) Circular queue complexity to add an element in the linked list?
d) Priority queue a) O(1)
View Answer b) O(n)
c) O(n2)
Answer: b
d) None of the mentioned
1. A linear collection of data elements where View Answer
the linear node is given by means of pointer is
Answer: b
called?
Explanation: None.
a) Linked list
b) Node list 6. What would be the asymptotic time
c) Primitive list complexity to find an element in the linked
d) None of the mentioned list?
View Answer a) O(1)
b) O(n)
Answer: a
c) O(n2)
Explanation: None.
d) None of the mentioned
2. Consider an implementation of unsorted View Answer
singly linked list. Suppose it has its
Answer: b
representation with a head pointer only.
Explanation: None.
Given the representation, which of the
following operation can be implemented in 7. What would be the asymptotic time
O(1) time? complexity to insert an element at the second
i) Insertion at the front of the linked list position in the linked list?
ii) Insertion at the end of the linked list a) O(1)
iii) Deletion of the front node of the linked list b) O(n)
iv) Deletion of the last node of the linked list c) O(n2)
a) I and II d) None of the mentioned
b) I and III View Answer
Answer: a a) Dynamic
Explanation: None. b) Static
c) Compile time
8. The concatenation of two list can performed
d) None of the mentioned
in O(1) time. Which of the following variation
View Answer
of linked list can be used?
a) Singly linked list Answer: a
b) Doubly linked list Explanation: As memory is allocated at the run
c) Circular doubly linked list time.
d) Array implementation of list
4. In Linked List implementation, a node
View Answer
carries information regarding
Answer: c a) Data
Explanation: None. b) Link
c) Data and Link
9. Consider the following definition in c
d) None of the mentioned
programming language
View Answer
struct node
Answer: b
{ Explanation: None.
int data; 5. Linked list data structure offers considerable
saving in
struct node * next; a) Computational Time
} b) Space Utilization
c) Space Utilization and Computational Time
typedef struct node NODE; d) None of the mentioned
NODE *ptr; View Answer

Which of the following c code is used to create Answer: c


new node? Explanation: Linked lists saves both space and
a) ptr = (NODE*)malloc(sizeof(NODE)); time.
b) ptr = (NODE*)malloc(NODE); 6. Which of the following points is/are true
c) ptr = (NODE*)malloc(sizeof(NODE*)); about Linked List data structure when it is
d) ptr = (NODE)malloc(sizeof(NODE)); compared with array
View Answer a) Arrays have better cache locality that can
Answer: a make them better in terms of performance
b) It is easy to insert and delete elements in
1. What kind of linked list is best to answer Linked List
question like “What is the item at position n?” c) Random access is not allowed in a typical
a) Singly linked list implementation of Linked Lists
b) Doubly linked list d) All of the mentioned
c) Circular linked list View Answer
d) Array implementation of linked list
View Answer Answer: d
Explanation: None.
Answer: d
Explanation: None. 7. What does the following function do for a
given Linked List with first node as head?
2. Linked lists are not suitable to for the
implementation of? void fun1(struct node* head)
a) Insertion sort {
b) Radix sort
c) Polynomial manipulation if(head == NULL)
d) Binary search return;
View Answer
fun1(head->next);
Answer: d
Explanation: It cannot be implemented using printf("%d ", head->data);
linked lists.
}
3. Linked list is considered as an example of
___________ type of memory allocation.
a) Prints all nodes of linked lists 4. What are the children for node ‘w’ of a
b) Prints all nodes of linked list in reverse order complete-binary tree in an array
c) Prints alternate nodes of Linked List representation?
d) Prints alternate nodes in reverse order a) 2w and 2w+1
View Answer b) 2+w and 2-w
c) w+1/2 and w/2
Answer: b
d) w-1/2 and w+1/2
Explanation: fun1() prints the given Linked
View Answer
List in reverse manner.
For Linked List 1->2->3->4->5, fun1() prints Answer: a
5->4->3->2->1. Explanation: Since each node has 2 children
and so counting from beginning, a particular
8. Which of the following sorting algorithms
node will have children as option a.
can be used to sort a random linked list with
minimum time complexity? 5. What is the parent for a node ‘w’ of a
a) Insertion Sort complete binary tree in an array representation
b) Quick Sort when w is not 0?
c) Heap Sort a) floor(w-1/2)
d) Merge Sort b) ceil(w-1/2)
View Answer c) w-1/2
d) w/2
Answer: d
View Answer
1. Binary trees can have how many children?
Answer: a
a) 2
Explanation: Floor of w-1/2 because we can’t
b) any number of children
miss a node.
c) 0 or 1 or 2
d) 0 or 1 6. If the tree is not a complete binary tree then
View Answer what changes can be made for easy access of
children of a node in the array ?
Answer: c
a) every node stores data saying which of its
Explanation: Can have atmost 2 nodes.
children exist in the array
2. Disadvantage of using array representation b) no need of any changes continue with 2w
for binary trees is? and 2w+1, if node is at i
a) difficulty in knowing children nodes of a c) keep a seperate table telling children of a
node node
b) difficult in finding the parent of a node d) use another array parallel to the array with
c) have to know the maximum number of tree
nodes possible before creation of trees View Answer
d) difficult to implement
Answer: a
View Answer
Explanation: Array cannot represent arbitrary
Answer: c shaped trees it can only be used in case of
Explanation: The array is fixed size (may be complete trees hence option a must be done
dynamic array or static array) but size is fixed. which is one of several ways to use array in
such situations.
3. What must be the ideal size of array if the
height of tree is ‘l’? 7. What must be the missing logic in place of
a) 2l-1 missing lines for finding sum of nodes of
b) l-1 binary tree in alternate levels?
c) l
//e.g:-consider -complete binary tree:-height-
d) 2l
3, [1,2,3,4,5,6,7]-answer must be 23
View Answer
n=power(2,height)-1; //assume input is height
Answer: a
and a[i] contains tree elements
Explanation: Since maximum elements in a
tree (complete binary tree) of height l will be for(i=1;i<=n;)
2l-1 so a good array size must be that (since a
{
binary tree node may not always have 2
children but for safety a is correct). for(j=1;j<=pow(2,currentlevel-1);j++)
//present level is initialized to 1 and sum is
initialized to 0
{ (2h)-1 where h is height but only h indexes will
be filled and (2h)-1-h nodes will be left unused
sum=sum+a[i];
leading to space wastage which was actually
i=i+1; main theme of question.
} 9. Why is heap implemented using array
representations than tree(linked list)
//missing logic representations though both tree
} representations and heaps have same
complexities?
a)
for binary heap
i=i+pow(2,currentlevel);
-insert: O(log n)
currentlevel=currentlevel+2;
-delete min: O(log n)
j=1;
b)
for a tree
i=i+pow(2,currentlevel);
-insert: O(log n)
currentlevel=currentlevel+2;
-delete: O(log n)
j=0;
Then why go with array representation when
c) both are having same values ?
advertisement a) arrays can store trees which are complete
and heaps are by it’s property are complete
i=i-pow(2,currentlevel); b) lists representation takes more memory
hence memory efficiency is less and go with
currentlevel=currentlevel+2;
arrays
j=1; c) array have better caching
d) all of the mentioned
d)
View Answer
i=i+pow(2,currentlevel);
Answer: d
currentlevel=currentlevel+1; Explanation: In memory the pointer address for
next node may not be adjacent or nearer to each
j=1; other and also array have wonderful caching
View Answer power from os and manipulating pointers is a
overhead.
Answer: a
Explanation: The i value must skip through all 10. Can a tree stored in an array using either
nodes in the next level and current level must one of inorder or post order or pre order
be one+next level. traversals be again reformed?
a) yes just traverse through the array and form
the tree
b) No we need one more traversal to form a
8. Consider a situation of writing a binary tree tree
into a file with memory storage efficiency in c) No in case of sparse trees
mind, is array representation of tree is good? d) None of the mentioned
a) yes because we are overcoming the need of View Answer
pointers and so space efficiency Answer: b
b) yes because array values are indexable
c) No it is not efficient in case of sparse trees 1. What is the maximum number of children
and remaning cases it is fine that a binary tree node can have?
d) No linked list representation of tree is only a) 0
fine b) 1
View Answer c) 2
d) 3
Answer: c View Answer
Explanation: In case of sparse trees(where one
node per level in worst cases), the array size
Answer: c 6. How many types of insertion are performed
Explanation: In a binary tree, a node can have in a binary tree?
atmost 2 nodes (i.e.) 0,1 or 2 left and right a) 1
child. b) 2
c) 3
2. The following given tree is an example for?
d) 4
View Answer
Answer: b
Explanation: Two kinds of insertion operation
is performed in a binary tree- inserting a leaf
node and inserting an internal node.
a) Binary tree 7. What operation does the following diagram
b) Binary search tree depict?
c) Fibonacci tree
d) AVL tree
View Answer
Answer: b
Explanation: The given tree is an example for
binary search since the tree has got two
children and the left and right children do not
satisfy binary search tree’s property.
3. A binary tree is a rooted tree but not an
ordered tree.
a) true
a) inserting a leaf node
b) false
b) inserting an internal node
View Answer
c) deleting a node with 0 or 1 child
Answer: b d) deleting a node with 2 children
Explanation: A binary tree is a rooted tree and View Answer
also an ordered tree (i.e) every node in a binary
Answer: c
tree has at most two children.
Explanation: The above diagram is a depiction
4. How many common operations are of deleting a node with 0 or 1 child since the
performed in a binary tree? node D which has 1 child is deleted.
a) 1
8. General ordered tree can be encoded into
b) 2
binary trees.
c) 3
a) true
d) 4
b) false
View Answer
View Answer
Answer: c
Answer: a
Explanation: Three common operations are
Explanation: General ordered tree can be
performed in a binary tree- they are insertion,
mapped into binary tree by representing them
deletion and traversal.
in a left-child-right-sibling way.
5. What is the traversal strategy used in the
9. How many bits would a succinct binary tree
binary tree?
occupy?
a) depth-first traversal
a) n+O(n)
b) breadth-first traversal
b) 2n+O(n)
c) random traversal
c) n/2
d) preorder traversal
d) n
View Answer
View Answer
Answer: b
Answer: b
Explanation: Breadth first traversal, also
Explanation: A succinct binary tree occupies
known as level order traversal is the traversal
close to minimum possible space established
strategy used in a binary tree. It involves
by lower bounds. A succinct binary tree would
visiting all the nodes at a given level.
occupy 2n+O(n) bits.
10. The average depth of a binary tree is given 2. For the tree below, write the post-order
as? traversal.
a) O(N) a) 2, 7, 2, 6, 5, 11, 5, 9, 4
b) O(√N) b) 2, 7, 5, 2, 6, 9, 5, 11, 4
c) O(N2) c) 2, 5, 11, 6, 7, 4, 9, 5, 2
d) O(log N) d) 2, 7, 5, 6, 11, 2, 5, 4, 9
View Answer View Answer
Answer: d Answer: c
Explanation: The average depth of a binary tree Explanation: Post order traversal follows
is given as O(√N). In case of a binary search LRN(Left-Right-Node).
tree, it is O(log N).
3. Select the code snippet which performs pre-
advertisement order traversal.
a)
11. How many orders of traversal can be
applied to a binary tree? public void preorder(Tree root)
a) 1
{
b) 4
c) 2 System.out.println(root.data);
d) 3
View Answer preorder(root.left);

Answer: d preorder(root.right);
Explanation: The three orders of traversal that }
can be applied to a binary tree are in-order, pre-
order and post order traversal. b)

12. If binary trees are represented in arrays, public void preorder(Tree root)
what formula can be used to locate a left child, {
if the node has an index i?
a) 2i+1 preorder(root.left);
b) 2i+2 System.out.println(root.data);
c) 2i
d) 4i preorder(root.right);
View Answer
}
Answer: a
c)
Explanation: If binary trees are represented in
arrays, left children are located at indices 2i+1 public void preorder(Tree root)
and right children at 2i+2.
{
13. Using what formula can a parent node be
located in an array? System.out.println(root.data);
a) (i+1)/2 preorder(root.right);
b) (i-1)/2
c) i/2 preorder(root.left);
d) 2i/2 }
View Answer
d) None of the mentioned
Answer: b View Answer
1. For the tree below, write the pre-order Answer: a
traversal. Explanation: Pre-order traversal follows
a) 2, 7, 2, 6, 5, 11, 5, 9, 4 NLR(Node-Left-Right).
b) 2, 7, 5, 2, 6, 9, 5, 11, 4
c) 2, 5, 11, 6, 7, 4, 9, 5, 2 4. Select the code snippet which performs post-
d) 2, 7, 5, 6, 11, 2, 5, 4, 9 order traversal.
View Answer a)
Answer: a public void postorder(Tree root)
Explanation: Pre order traversal follows {
NLR(Node-Left-Right).
System.out.println(root.data); 9. To obtain a prefix expression, which of the
tree traversals is used?
postorder(root.left);
a) Level-order traversal
postorder(root.right); b) Pre-order traversal
c) Post-order traversal
} d) In-order traversal
b) View Answer

public void postorder(Tree root) Answer: b

{ 1. In postorder traversal of binary tree right


subtree is traversed before visiting root.
postorder(root.left); a) True
postorder(root.right); b) False
View Answer
System.out.println(root.data);
Answer: a
} Explanation: Post-order method of traversing
involves – i) Traverse left subtree in post-order,
c)
ii) Traverse right subtree in post-order, iii) visit
public void postorder(Tree root) the root.
{ 2. What is the possible number of binary trees
that can be created with 3 nodes, giving the
System.out.println(root.data);
sequence N, M, L when traversed in post-order.
postorder(root.right); a) 15
b) 3
postorder(root.left); c) 5
} d) 8
View Answer
d) None of the mentioned
View Answer Answer: c
Explanation: 5 binary trees are possible and
Answer: a they are,
Explanation: Post order traversal follows
NLR(Left-Right-Node).
7. What is the time complexity of pre-order
traversal in the iterative fashion?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
View Answer 3. The post-order traversal of a binary tree is O
P Q R S T. Then possible pre-order traversal
Answer: b
will be ________
Explanation: Since you have to go through all
a) T Q R S O P
the nodes, the complexity becomes O(n).
b) T O Q R P S
8. What is the space complexity of the post- c) T Q O P S R
order traversal in the recursive fashion? (d is d) T Q O S P R
the tree depth and n is the number of nodes) View Answer
a) O(1)
Answer: c
b) O(nlogd)
Explanation: The last, second last nodes visited
c) O(logd)
in post-order traversal are root and it’s right
d) O(d)
child respectively. Option T Q R S O P can’t be
View Answer
a pre-order traversal, because nodes O, P are
Answer: d visited after the nodes Q, R, S. Option T O Q R
Explanation: In the worst case we have d stack P S, can’t be valid, because the pre-order
frames in the recursive call, hence the sequence given in option T O Q R P S and
complexity is O(d). given post-order traversal creates a tree with
node T as root and node O as left subtree.
Option T Q O P S R is valid. Option T Q O S P be equal is ______
R is not valid as node P is visited after visiting a) 3
node S. b) 1
c) 2
4. A binary search tree contains values 7, 8, 13,
d) any number
26, 35, 40, 70, 75. Which one of the following
View Answer
is a valid post-order sequence of the tree
provided the pre-order sequence as 35, 13, 7, 8, Answer: b
26, 70, 40 and 75? Explanation: The tree with only one node has
a) 7, 8, 26, 13, 75, 40, 70, 35 post-order and pre-order traversals equal.
b) 26, 13, 7, 8, 70, 75, 40, 35
8. The steps for finding post-order traversal are
c) 7, 8, 13, 26, 35, 40, 70, 75
traverse the right subtree, traverse the left
d) 8, 7, 26, 13, 40, 75, 70, 35
subtree or visit the current node.
View Answer
a) True
Answer: d b) False
Explanation: The binary tree contains values 7, View Answer
8, 13, 26, 35, 40, 70, 75. The given pre-order
Answer: b
sequence is 35, 13, 7, 8, 26, 70, 40 and 75. So,
Explanation: Left subtree is traversed first in
the binary search tree formed is
post-order traversal, then the right subtree is
traversed and then the output current node.
9. The pre-order and in-order are traversals of a
binary tree are T M L N P O Q and L M N T O
P Q. Which of following is post-order traversal
of the tree?
a) L N M O Q P T
b) N M O P O L T
c) L M N O P Q T
d) O P L M N Q T
Thus post-order sequence for the tree is 8, 7, View Answer
26, 13, 40, 75, 70 and 35. Answer: a
5. Which of the following pair’s traversals on a Explanation: The tree generated by using given
binary tree can build the tree uniquely? pre-order and in-order traversal is
a) post-order and pre-order
b) post-order and in-order
c) post-order and level order
d) level order and preorder
View Answer
Answer: b
Explanation: A binary tree can uniquely be
Thus, L N M O Q P T will be the post-order
created by post-order and in-order traversals.
traversal.
6. A full binary tree can be generated using
10. For a binary tree the first node visited in in-
______
order and post-order traversal is same.
a) post-order and pre-order traversal
a) True
b) pre-order traversal
b) False
c) post-order traversal
View Answer
d) in-order traversal
View Answer Answer: b
Explanation: Consider a binary tree,
Answer: a
Explanation: Every node in a full binary tree
has either 0 or 2 children. A binary tree can be
generated by two traversals if one of them is in-
order. But, we can generate a full binary tree
using post-order and pre-order traversals.
7. The maximum number of nodes in a tree for
which post-order and pre-order traversals may Its in-order traversal – 13 14 16 19
Its post-order traversal- 14 13 19 16. Here the 6. What is the time complexity of level order
first node visited is not same. traversal?
a) O(1)
advertisement
b) O(n)
11. Find the postorder traversal of the binary c) O(logn)
tree shown below. d) O(nlogn)
View Answer
Answer: b
Explanation: Since you have to go through all
the nodes, the complexity becomes O(n).
7. Which of the following graph traversals
closely imitates level order traversal of a binary
tree?
a) Depth First Search
b) Breadth First Search
c) Depth & Breadth First Search
a) P Q R S T U V W X
d) None of the mentioned
b) W R S Q P V T U X
View Answer
c) S W T Q X U V R P
d) S T W U X V Q R P Answer: b
View Answer Explanation: Both level order tree traversal and
breadth first graph traversal follow the
Answer: c
principle that visit your neighbors first and then
1. For the tree below, write the in-order move on to further nodes.
traversal.
8. In a binary search tree, which of the
a) 2, 7, 2, 6, 5, 11, 5, 9, 4
following traversals would print the numbers in
b) 2, 7, 5, 2, 6, 9, 5, 11, 4
the ascending order?
c) 2, 5, 11, 6, 7, 4, 9, 5, 2
a) Level-order traversal
d) 2, 7, 5, 6, 11, 2, 5, 4, 9
b) Pre-order traversal
View Answer
c) Post-order traversal
Answer: d d) In-order traversal
Explanation: In-order traversal follows View Answer
LNR(Left-Node-Right).
Answer: d
2. For the tree below, write the level-order
1. The number of edges from the root to the
traversal.
node is called __________ of the tree.
a) 2, 7, 2, 6, 5, 11, 5, 9, 4
a) Height
b) 2, 7, 5, 2, 6, 9, 5, 11, 4
b) Depth
c) 2, 5, 11, 6, 7, 4, 9, 5, 2
c) Length
d) 2, 7, 5, 6, 11, 2, 5, 4, 9
d) None of the mentioned
View Answer
View Answer
Answer: b
Answer: b
Explanation: Level order traversal follows a
Explanation: None.
breadth first search approach.
2. The number of edges from the node to the
5. What is the space complexity of the in-order
deepest leaf is called _________ of the tree.
traversal in the recursive fashion? (d is the tree
a) Height
depth and n is the number of nodes)
b) Depth
a) O(1)
c) Length
b) O(nlogd)
d) None of the mentioned
c) O(logd)
View Answer
d) O(d)
View Answer Answer: a
Explanation: None.
Answer: d
Explanation: In the worst case we have d stack 3. What is a full binary tree?
frames in the recursive call, hence the a) Each node has exactly zero or two children
complexity is O(d). b) Each node has exactly two children
c) All the leaves are at the same level c) N = I – 1
d) Each node has exactly one or two children d) N = 2I + 1
View Answer View Answer
Answer: a Answer: d
Explanation: None. Explanation: None.
4. What is a complete binary tree? 9. In a full binary tree if there are L leaves, then
a) Each node has exactly zero or two children total number of nodes N are?
b) A binary tree, which is completely filled, a) N = 2L
with the possible exception of the bottom level, b) N = L + 1
which is filled from right to left c) N = L – 1
c) A binary tree, which is completely filled, d) N = 2L – 1
with the possible exception of the bottom level, View Answer
which is filled from left to right
Answer: d
d) None of the mentioned
Explanation: None.
View Answer
10. Which of the following is correct with
Answer: c
respect to binary trees?
Explanation: None.
a) Let T be a binary tree. For every k ≥ 0, there
5. What is the time complexity for finding the are no more than 2k nodes in level k
height of the binary tree? b) Let T be a binary tree with λ levels. Then T
a) h = O(loglogn) has no more than 2λ – 1 nodes
b) h = O(nlogn) c) Let T be a binary tree with N nodes. Then
c) h = O(n) the number of levels is at least ceil(log (N + 1))
d) h = O(log n) d) All of the mentioned
View Answer View Answer
Answer: d Answer: d
Explanation: The nodes are either a part of left
1. Which of the following statements for a
sub tree or the right sub tree, so we don’t have
simple graph is correct?
to traverse all the nodes, this means the
a) Every path is a trail
complexity is lesser than n, in the average case,
b) Every trail is a path
assuming the nodes are spread evenly, the time
c) Every trail is a path as well as every path is a
complexity becomes O(n).
trail
6. Which of the following is not an advantage d) None of the mentioned
of trees? View Answer
a) Hierarchical structure
Answer: a
b) Faster search
Explanation: In a walk if the vertices are
c) Router algorithms
distinct it is called a path, whereas if the edges
d) Undo/Redo operations in a notepad
are distinct it is called a trail.
View Answer
2. In the given graph identify the cut vertices.
Answer: d
Explanation: This is an application of stack.
7. In a full binary tree if number of internal
nodes is I, then number of leaves L are?
a) L = 2I
b) L = I + 1
c) L = I – 1
d) L = 2I – 1
View Answer
Answer: b
Explanation: None.
8. In a full binary tree if number of internal
nodes is I, then number of nodes N are?
a) N = 2I
b) N = I + 1
a) B and E Answer: a
b) C and D Explanation: In a regular graph, degrees of all
c) A and E the vertices are equal. In the given graph the
d) C and B degree of every vertex is 3.
View Answer
6. In a simple graph, the number of edges is
Answer: d equal to twice the sum of the degrees of the
Explanation: After removing either B or C, the vertices.
graph becomes disconnected. a) True
b) False
3. For the given graph(G), which of the
View Answer
following statements is true?
Answer: b
Explanation: The sum of the degrees of the
vertices is equal to twice the number of edges.
7. A connected planar graph having 6 vertices,
7 edges contains _____________ regions.
a) 15
b) 3
c) 1
d) 11
View Answer
Answer: b
Explanation: By euler’s formula the relation
a) G is a complete graph
between vertices(n), edges(q) and regions(r) is
b) G is not a connected graph
given by n-q+r=2.
c) The vertex connectivity of the graph is 2
d) The edge connectivity of the graph is 1 8. If a simple graph G, contains n vertices and
View Answer m edges, the number of edges in the Graph
G'(Complement of G) is ___________
Answer: c
a) (n*n-n-2*m)/2
Explanation : After removing vertices B and C,
b) (n*n+n+2*m)/2
the graph becomes disconnected.
c) (n*n-n-2*m)/2
4. What is the number of edges present in a d) (n*n-n+2*m)/2
complete graph having n vertices? View Answer
a) (n*(n+1))/2
Answer: a
b) (n*(n-1))/2
Explanation: The union of G and G’ would be a
c) n
complete graph so, the number of edges in G’=
d) Information given is insufficient
number of edges in the complete form of
View Answer
G(nC2)-edges in G(m).
Answer: b
9. Which of the following properties does a
Explanation: Number of ways in which every
simple graph not hold?
vertex can be connected to each other is nC2.
a) Must be connected
5. The given Graph is regular. b) Must be unweighted
c) Must have no loops or multiple edges
d) All of the mentioned
View Answer
Answer: a
Explanation: A simple graph maybe connected
or disconnected.
10. What is the maximum number of edges in a
bipartite graph having 10 vertices?
a) 24
a) True b) 21
b) False c) 25
View Answer d) 16
View Answer
Answer: c Incidence Matrix
Explanation: Let one set have n vertices d) None of the mentioned
another set would contain 10-n vertices. View Answer
Total number of edges would be n*(10-n),
Answer: c
differentiating with respect to n, would yield
the answer. 1. The number of elements in the adjacency
matrix of a graph having 7 vertices is
11. Which of the following is true?
__________
a) A graph may contain no edges and many
a) 7
vertices
b) 14
b) A graph may contain many edges and no
c) 36
vertices
d) 49
c) A graph may contain no edges and no
View Answer
vertices
d) None of the mentioned Answer: d
View Answer Explanation: There are n*n elements in the
adjacency matrix of a graph with n vertices.
Answer: b
Explanation: A graph must contain at least one 2. What would be the number of zeros in the
vertex. adjacency matrix of the given graph?
a) 10
12. For a given graph G having v vertices and e
b) 6
edges which is connected and has no cycles,
c) 16
which of the following statements is true?
d) 0
a) v=e
View Answer
b) v = e+1
c) v + 1 = e Answer: b
d) None of the mentioned Explanation: Total number of values in the
View Answer matrix is 4*4=16, out of which 6 entries are
non zero.
Answer: b
3. Adjacency matrix of all graphs are
13. For which of the following combinations of
symmetric.
the degrees of vertices would the connected
a) False
graph be eulerian?
b) True
a) 1,2,3
View Answer
b) 2,3,4
c) 2,4,5 Answer: a
d) 1,3,5 Explanation: Only undirected graphs produce
View Answer symmetric adjacency matrices.
Answer: a 4. The time complexity to calculate the number
Explanation: A graph is eulerian if either all of of edges in a graph whose information in stored
its vertices are even or if only two of its in form of an adjacency matrix is
vertices are odd. ____________
a) O(V)
14. A graph with all vertices having equal
b) O(E2)
degree is known as a __________
c) O(E)
a) Multi Graph
d) O(V2)
b) Regular Graph
View Answer
c) Simple Graph
d) Complete Graph Answer: d
View Answer Explanation: As V entries are 0, a total of V2-V
entries are to be examined.
Answer: b
Explanation: The given statement is the 5. For the adjacency matrix of a directed graph
definition of regular graphs. the row sum is the _________ degree and the
column sum is the ________ degree.
15. Which of the following ways can be used to
a) in, out
represent a graph?
b) out, in
a) Adjacency List and Adjacency Matrix
c) in, total
b) Incidence Matrix
c) Adjacency List, Adjacency Matrix as well as
d) total, out Answer: d
View Answer Explanation: A simple graph must have no-self
loops, should be undirected.
Answer: b
Explanation: Row number of the matrix 10. Given an adjacency matrix A = [ [0, 1, 1],
represents the tail, while Column number [1, 0, 1], [1, 1, 0] ], how many ways are there
represents the head of the edge. in which a vertex can walk to itself using 2
edges.
6. What is the maximum number of possible
a) 2
non zero values in an adjacency matrix of a
b) 4
simple graph with n vertices?
c) 6
a) (n*(n-1))/2
d) 8
b) (n*(n+1))/2
View Answer
c) n*(n-1)
d) n*(n+1) Answer: c
View Answer Explanation: A2 = [ [2, 1, 1], [1, 2, 1], [1, 1, 2]
], all the 3 vertices can reach to themselves in 2
Answer: c
ways, hence a total of 3*2, 6 ways.
Explanation: Out of n*n possible values for a
simple graph the diagonal values will always 11. If A[x+3][y+5] represents an adjacency
be zero. matrix, which of these could be the value of x
and y.
7. On which of the following statements does
a) x=5, y=3
the time complexity of checking if an edge
b) x=3, y=5
exists between two particular vertices is not,
c) x=3, y=3
depends?
d) x=5, y=5
a) Depends on the number of edges
View Answer
b) Depends on the number of vertices
c) Is independent of both the number of edges Answer: a
and vertices Explanation: All adjacency matrices are square
d) It depends on both the number of edges and matrices.
vertices
12. Two directed graphs(G and H) are
View Answer
isomorphic if and only if A=PBP-1, where P
Answer: c and A are adjacency matrices of G and H
Explanation: To check if there is an edge respectively.
between to vertices i and j, it is enough to see if a) True
the value of A[i][j] is 1 or 0, here A is the b) False
adjacency matrix. View Answer
8. In the given connected graph G, what is the Answer: a
value of rad(G) and diam(G)?
1. The number of possible undirected graphs
a) 2, 3
which may have self loops but no multiple
b) 3, 2
edges and have n vertices is ________
c) 2, 2
a) 2((n*(n-1))/2)
d) 3, 3
b) 2((n*(n+1))/2)
View Answer
c) 2((n-1)*(n-1))/2)
Answer: a d) 2((n*n)/2)
Explanation: Value of eccentricity for vertices View Answer
A, C is 2 whereas for F, B, D, E it is 3.
Answer: d
9. Which of these adjacency matrices Explanation: There can be at most, n*n edges
represents a simple graph? in an undirected graph.
a) [ [1, 0, 0], [0, 1, 0], [0, 1, 1] ]
2. Given a plane graph, G having 2 connected
component, having 6 vertices, 7 edges and 4
b) [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ]
regions. What will be the number of connected
c) [ [0, 0, 1], [0, 0, 0], [0, 0, 1] ]
components?
a) 1
d) [ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]
b) 2
c) 3
View Answer
d) 4 b) False
View Answer View Answer
Answer: b Answer: a
Explanation: Euler’s Identity says V – E + R = Explanation: A trees is acyclic in nature.
1+ number of connected components.
8. Which of the following graphs are
3. Number of vertices with odd degrees in a isomorphic to each other?
graph having a eulerian walk is ________
a) 0
b) Can’t be predicted
c) 2
d) either 0 or 2
View Answer
Answer: d
Explanation: If the start and end vertices for the
path are same the answer would be 0 otherwise
2.
4. How many of the following statements are
correct?
a) fig 1 and fig 2
i) All cyclic graphs are complete graphs.
b) fig 2 and fig 3
ii) All complete graphs are cyclic graphs.
c) fig 1 and fig 3
iii) All paths are bipartite.
d) fig 1, fig 2 and fig 3
iv) All cyclic graphs are bipartite.
View Answer
v) There are cyclic graphs which are complete.
a) 1 Answer: d
b) 2 Explanation: All three graphs are Complete
c) 3 graphs with 4 vertices.
d) 4
View Answer 9. In the given graph which edge should be
removed to make it a Bipartite Graph?
Answer: b
Explanation: Statements iii) and v) are correct.
5. All paths and cyclic graphs are bipartite
graphs.
a) True
b) False
View Answer
Answer: b
Explanation: Only paths and even cycles are
bipartite graphs.
6. What is the number of vertices of degree 2 in
a) A-C
a path graph having n vertices,here n>2.
b) B-E
a) n-2
c) C-D
b) n
d) D-E
c) 2
View Answer
d) 0
View Answer Answer: a
Explanation: The resultant graph would be a
Answer: a
Bipartite Graph having {A,C,E} and {D, B} as
Explanation: Only the first and the last vertex
its subgroups.
would have degree 1, others would be of
degree 2. 10. What would the time complexity to check if
an undirected graph with V vertices and E
7. All trees with n vertices consists of n-1
edges is Bipartite or not given its adjacency
edges.
matrix?
a) True
a) O(E*E)
b) O(V*V)
c) O(E) b) False
d) O(V) View Answer
View Answer
Answer: b
Answer: b Explanation: Same Graph may be drawn in
different ways on paper.
This set of Data Structure Multiple Choice
Questions & Answers (MCQs) focuses on 6. Assuming value of every weight to be
“Directed Graph”. greater than 10, in which of the following cases
the shortest path of a directed weighted graph
1. Dijkstra’s Algorithm will work for both
from 2 vertices u and v will never change?
negative and positive weights?
a) add all values by 10
a) True
b) subtract 10 from all the values
b) False
c) multiply all values by 10
View Answer
d) in both the cases of multiplying and adding
Answer: b by 10
Explanation: Dijkstra’s Algorithm assumes all View Answer
weights to be non-negative.
Answer: c
2. A graph having an edge from each vertex to Explanation: In case of addition or subtraction
every other vertex is called a ___________ the shortest path may change because the
a) Tightly Connected number of edges between different paths may
b) Strongly Connected be different, while in case of multiplication
c) Weakly Connected path wont change.
d) Loosely Connected
7. What is the maximum possible number of
View Answer
edges in a directed graph with no self loops
Answer: a having 8 vertices?
Explanation: This is a part of the nomenclature a) 28
followed in Graph Theory. b) 64
c) 256
3. What is the number of unlabeled simple d) 56
directed graph that can be made with 1 or 2 View Answer
vertices?
a) 2 Answer: d
b) 4 Explanation: If a graph has V vertices than
c) 5 every vertex can be connected to a possible of
d) 9 V-1 vertices.
View Answer
8. What would be the DFS traversal of the
Answer: b given Graph?
Explanation:

4. Floyd Warshall Algorithm used to solve the


shortest path problem has a time complexity of
__________
a) O(V*V)
b) O(V*V*V)
c) O(E*V)
d) O(E*E)
View Answer
Answer: b a) ABCED
Explanation: The Algorithm uses Dynamic b) AEDCB
Programming and checks for every possible c) EDCBA
path. d) ADECB
View Answer
5. All Graphs have unique representation on
paper. Answer: a
a) True
1.Finding an element, whether that is present in 7.DFS is a ____ type of search
a list or not. It is called__
A. Just tree search
A. Sorting
B. multi-way tree search
B. Searching
C. graph search
C. Storing
D. None
D. none
Answer: C
Answer: B
8. BFS is a ____ type of search
2.In the following type of searching key-
A. Just tree search
comparisons are needed
B. multi-way tree search
A. Linear search
C. graph search
B. Non linear search
D. None
C. Address calculation search
Answer: C
D. A and B
9.Binary search tree is a ___ type of search
Answer: D
A. Just tree search
3.In the following type of searching key-
comparisons are not needed B. multi-way tree search
A. Linear search C. graph search
B. Non linear search D. None
C. Address calculation search Answer: A
D. A and B 10.Digital search is a __ type of search
Answer: C A. Just tree search
4.Binary search is ____ type of search. B. multi-way tree search
A. Linear search C. graph search
B. Non linear search D. None
C. Address calculation search Answer: A
D. A and B 11.Searching techniques are classified in to__
types
Answer: A
A. 2
5. Splay tree search is ___ type of search
B. 3
A. Linear search
C. 4
B. Non linear search
D. none
C. Address calculation search
Answer: A
D. None
12. The element that is going to be searched in
Answer: B
a list is called ___
6.B-tree search is a ___ type of search
A. Key
A. Just tree search
B. item
B. multi-way tree search
C. table
C. graph search
D. file
D. None
Answer: A
Answer: B
13.If a key is found in a list that is called ___ D. None
type of search
Answer: B
A. Unsuccessful
19. Asymptotic complexity of linear search
B. successful with array in average case is
C. partial success A. O(1)
D. partial unsuccessful B. O(n)
Answer: B C. O(n/2)
14.The following type of search is easy to D. logn
implement.
Answer: B
A. Linear search
20.Asymptotic complexity of linear search with
B. Non linear search array in worst case is
C. Interpolation A. O(1)
D. none B. O(n)
Answer : A C. O(n/2
15.In linear search with array, how many D. logn
comparisons are needed in best case?
Answer: B
A. 0
21. Binary search algorithm cannot be applied
B. 1 to__
C. n A. Sorted Linked list
D. n/2 B. sorted binary trees
Answer: B C. sorted linear array
16.In linear search with array, how many D. pointer array
comparisons are needed in average case?
Answer: D
A. 0
22.Which of the following is not a limitation of
B. 1 binary search algorithm?
C. n A. must use a sorted array.
D. n+1/2 B. requirement of sorted array is expensive
when a lot of insertion and deletions are
Answer: D
needed.
17.In linear search with array, how many
C. there must be a mechanism to access
comparisons are needed in worst case?
middle element directly.
A. 0
D. binary search algorithm is not efficient
B. 1 when the data elements more than 1500.
C. n Answer: D
D. n/2 23. The complexity of Binary search algorithm
is
Answer: C
A. O (n)
18.In ___type of search the list is divided in to
two parts. B. O (log n)
A. Linear search C. O (n2)
B. Binary search D. O (logn2)
C. random search Answer: B
24.The time factor when determining the D. n-1
efficiency of algorithm is measured by__. Answer: A
31. In linear search Time complexity in best case
A. Counting the number of key operations for a successful search is___.
B. Counting the microseconds A. 1
B. n
C. Counting the number of statements C. n+1/2
D. Counting the kilobytes of algorithm D. n -1
Answer: A
Answer: A 32. In linear search Time complexity
25.Binary search can be applied on the sorted in average case for a successful search is___.
__________. A. 1
B. n
A. array or list. C. n+1/2
B. Arguments D. n -1
Answer: C
C. Queues 33.In linear search Time complexity
in average case for a Unsuccessful search is__.
D. pointers.
A. 1
A26.Binary search is useful when there are large B. n
number of_______in array. C. n+1/2
D. n -1
A. Arguments Answer: B
B. values 34.In linear search with list Time complexity
C. Elements in average case for a Unsuccessful search is
D. all the above A. A.1
Answer: C B. n
27.In binary search, we compare the value with C. n+1/2
the elements in the __________ position of the D. n -1
array. Answer: C
35.In linear search with list Time complexity
A. right in worst case for a Unsuccessful search is
B. Left A. 1
C. Random B. n
D. middle C. n+1/2
Answer: D D. n -1
28.Which of the following is not the required Answer: B
condition for binary search algorithm? 36.In Binary search time complexity in best case
A. A.The list must be sorted for a successful search is __
B. There should be the direct access to the A. 1
middle element in any sub list B. Log2N
C. There must be mechanism to delete and/or C. log n+1
insert elements in list. D. N log N
D. Number values should only be present Answer: A
Answer: C 37.In Binary search time complexity
29.Finding the location of the element with a in worst case for a successful search is __
given value is ___. A. 1
B. Log2N
A. Traversal
C. log n+1
B. Search
D. N log N
C. Sort
Answer: B
D. None of above 38.In Binary search time complexity
Answer: B in average case for a successful search is __
30. How many comparisons are needed for linear
1. 1
Search array when elements are in order
2. Log2N
in best case?
A. 1 3. log n+1
B. n 4. N log N
Answer: B
C. n+1
39.In Binary search time complexity A. Somewhere in the middle of the array
in average case for a Unsuccessful search is __ B. Not in the array at all.
A. 1 C. The last element in the array
B. Log2N D. The last element in the array or is not there at
C. log n+1 all.
D. N log N Answer: D
Answer: B 1. Where is linear searching used?
40.In Binary search time complexity in a) When the list has only a few elements
a best case for a Unsuccessful search is __ b) When performing a single search in an
A. 1 unordered list
B. Log2N c) Used all the time
C. log n+1 d) When the list has only a few elements and
D. N log N When performing a single search in an
Answer: B unordered list
41.In Binary search time complexity View Answer
in worst case for a Unsuccessful search is __
A. 1 Answer: d
B. Log2N Explanation: It is practical to implement linear
C. log n+1 search in the situations mentioned in When the
list has only a few elements and When
D. N log N
Answer: B performing a single search in an unordered list,
42.Non linear searching techniques are classified but for larger elements the complexity becomes
in to __ categories larger and it makes sense to sort the list and
employ binary search or hashing.
A. 1 3. What is the best case for linear search?
B. 3 a) O(nlogn)
C. 2 b) O(logn)
D. 4 c) O(n)
Answer: C d) O(1)
43.The number of comparisons for the Binary View Answer
Tree Search in best case is __
A. 1 Answer: d
B. n+1 Explanation: The element is at the head of the
C. n-1 array, hence O(1).
D. n+1/2 4. What is the worst case for linear search?
Answer: A a) O(nlogn)
44.The number of comparisons for the Binary b) O(logn)
Tree Search in average case is __ c) O(n)
A. 1 d) O(1)
B. n+1 View Answer
C. n
D. n+1/2 Answer: c
Answer: C Explanation: Worst case is when the desired
45.The number of comparisons for the Binary element is at the tail of the array or not present
Tree Search in worst case is __ at all, in this case you have to traverse till the
A. 1 end of the array, hence the complexity is O(n).
B. n+1 6. What is the best case and worst case
C. n complexity of ordered linear search?
D. n+1/2 a) O(nlogn), O(logn)
Answer: D b) O(logn), O(nlogn)
46.____ case does not exist in complexity theory c) O(n), O(1)
d) O(1), O(n)
A. Null
View Answer
B. Best
C. Average Answer: d
D. worst Explanation: Although ordered linear search is
Answer: A better than unordered when the element is not
47.The worst case occur in linear search present in the array, the best and worst cases
algorithm when item is __
still remain the same, with the key element
being found at first position or at last position.
8. What does the following piece of code do?
for (int i = 0; i < arr.length-1; i++)
{
for (int j = i+1; j < arr.length; j++)
{
if( (arr[i].equals(arr[j])) && (i != j) )
{
System.out.println(arr[i]);
}
}
}
a) Print the duplicate elements in the array
b) Print the element with maximum frequency
c) Print the unique elements in the array
d) None of the mentioned
View Answer
Answer: a
Explanation: The print statement is executed
only when the items are equal and their indices
are not.
10. Which of the following is a disadvantage of
linear search?
a) Requires more space
b) Greater time complexities compared to other
searching algorithms
c) Not easy to understand
d) All of the mentioned
View Answer
Answer: b

Das könnte Ihnen auch gefallen