Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
26 views8 pages

DS Quiz

The document contains a series of questions and answers related to basic and complex data structures and algorithms. It covers topics such as searching, traversal, data structures like stacks and arrays, and recursion. The answers provided indicate the correct options for each question.

Uploaded by

pamidi.prameela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views8 pages

DS Quiz

The document contains a series of questions and answers related to basic and complex data structures and algorithms. It covers topics such as searching, traversal, data structures like stacks and arrays, and recursion. The answers provided indicate the correct options for each question.

Uploaded by

pamidi.prameela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

BASIC

1. Finding the location of the element with a given value is:


a. Traversal
b. Search
c. Sort
d. None of above Answer: b

2. . The operation of processing each element in the list is known as


a. Sorting
b. Merging
c. Inserting
d. Traversal Answer: d

3. Which of the following is a linear data structure?


a. Array
b. AVL Trees
c. Binary Trees
d. Graphs Answer: a

4.The data structure required to check whether an expression contains a balanced parenthesis is?
a) Queue
b) Stack
c) Tree
d) Array Answer: b

5. Which data structure is based on the Last In First Out (LIFO) principle?
a) Tree
b) Linked List
c) Stack
d) Queue Answer: c

6. Which one of the following is the process of inserting an element in the stack?
a)Insert
b)Add
c)Push
d)None of the above Answer: c

7. If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known
as___
a)Underflow
b)Garbage collection
c)Overflow
d)None of the above Answer: c
8. Which of the following is the infix expression?
a)A+B*C
b)+A*BC
c)ABC+*
d)AB+*C Answer: a

9. If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?
a)1234

b)2134
c)4321
d)Removal not possible Answer: c

10. What is the maximum number of children that a node can have in a binary tree?
a)3
b)1
c)4
d)2 Answer: d

COMPLEX

1. What is the value of the postfix expression 6 3 2 4 + – *?


a) 74
b) -18
c) 22
d) 40 Answer: b
2. For the tree below, write the in-order traversal.

a) 6, 2, 5, 7, 11, 2, 5, 9, 4
b) 6, 5, 2, 11, 7, 4, 9, 5, 2
c) 2, 7, 2, 6, 5, 11, 5, 9, 4
d) 2, 7, 6, 5, 11, 2, 9, 5, 4 Answer: a

3. What would be the number of zeros in the adjacency matrix of the given graph?

a) 10
b) 6
c) 16
d) 0 Answer: a

4. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort are
a)5
b)4
c)6
d)2 Answer: b

5. What is the best case for linear search?


a) O(nlogn)
b) O(logn)
c) O(n)
d) O(1) Answer: d

6. Choose the recursive formula for the Fibonacci series.(n>=1)


a) F(n) = F(n+1) + F(n+2)
b) F(n) = F(n) + F(n+1)
c) F(n) = F(n-1) + F(n-2)
d) F(n) = F(n-1) – F(n-2) Answer: c

7. Which of the following recursive formula can be used to find the factorial of a number?
a) fact(n) = n * fact(n)
b) fact(n) = n * fact(n+1)
c) fact(n) = n * fact(n-1)
d) fact(n) = n * fact(1) Answer: c

8. Recursion is similar to which of the following?


a) Switch Case
b) Loop
c) If-else
d) if elif else Answer: b

9. Given an array arr = {45,77,89,90,94,99,100} and key = 99; what are the mid
values(corresponding array elements) in the first and second levels of recursion?
a) 90 and 99
b) 90 and 94
c) 89 and 99
d) 89 and 94 Answer: a

10. A person wants to visit some places. He starts from a vertex and then wants to visit every vertex
till it finishes from one vertex, backtracks and then explore other vertex from same vertex. What
algorithm he should use?
a) Depth First Search
b) Breadth First Search
c) Trim’s algorithm
d) Kruskal’s Algorithm Answer: a
BASIC

1. Finding the location of the element with a given value is:


a. Traversal
b. Search
c. Sort
d. None of above Answer: b

2. . The operation of processing each element in the list is known as


a. Sorting
b. Merging
c. Inserting
d. Traversal Answer: d

3. Which of the following is a linear data structure?


a. Array
b. AVL Trees
c. Binary Trees
d. Graphs Answer: a

4.The data structure required to check whether an expression contains a balanced parenthesis is?
a) Queue
b) Stack
c) Tree
d) Array Answer: b

5. Which data structure is based on the Last In First Out (LIFO) principle?
a) Tree
b) Linked List
c) Stack
d) Queue Answer: c

6. Which one of the following is the process of inserting an element in the stack?
a)Insert
b)Add
c)Push
d)None of the above Answer: c

7. If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known
as___
a)Underflow
b)Garbage collection
c)Overflow
d)None of the above Answer: c
8. Which of the following is the infix expression?
a)A+B*C
b)+A*BC
c)ABC+*
d)AB+*C Answer: a

9. If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?
a)1234

b)2134
c)4321
d)Removal not possible Answer: c

10. What is the maximum number of children that a node can have in a binary tree?
a)3
b)1
c)4
d)2 Answer: d

COMPLEX

1. What is the value of the postfix expression 6 3 2 4 + – *?


a) 74
b) -18
c) 22
d) 40 Answer: b
2. For the tree below, write the in-order traversal.

a) 6, 2, 5, 7, 11, 2, 5, 9, 4
b) 6, 5, 2, 11, 7, 4, 9, 5, 2
c) 2, 7, 2, 6, 5, 11, 5, 9, 4
d) 2, 7, 6, 5, 11, 2, 9, 5, 4 Answer: a

3. What would be the number of zeros in the adjacency matrix of the given graph?

a) 10
b) 6
c) 16
d) 0 Answer: a

4. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort are
a)5
b)4
c)6
d)2 Answer: b

5. What is the best case for linear search?


a) O(nlogn)
b) O(logn)
c) O(n)
d) O(1) Answer: d

6. Choose the recursive formula for the Fibonacci series.(n>=1)


a) F(n) = F(n+1) + F(n+2)
b) F(n) = F(n) + F(n+1)
c) F(n) = F(n-1) + F(n-2)
d) F(n) = F(n-1) – F(n-2) Answer: c

7. Which of the following recursive formula can be used to find the factorial of a number?
a) fact(n) = n * fact(n)
b) fact(n) = n * fact(n+1)
c) fact(n) = n * fact(n-1)
d) fact(n) = n * fact(1) Answer: c

8. Recursion is similar to which of the following?


a) Switch Case
b) Loop
c) If-else
d) if elif else Answer: b

9. Given an array arr = {45,77,89,90,94,99,100} and key = 99; what are the mid
values(corresponding array elements) in the first and second levels of recursion?
a) 90 and 99
b) 90 and 94
c) 89 and 99
d) 89 and 94 Answer: a

10. A person wants to visit some places. He starts from a vertex and then wants to visit every vertex
till it finishes from one vertex, backtracks and then explore other vertex from same vertex. What
algorithm he should use?
a) Depth First Search
b) Breadth First Search
c) Trim’s algorithm
d) Kruskal’s Algorithm Answer: a

You might also like