0% found this document useful (0 votes)
137 views9 pages

SBI (SO) IT DSA Sample

Uploaded by

Sourav Lenka
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)
137 views9 pages

SBI (SO) IT DSA Sample

Uploaded by

Sourav Lenka
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/ 9

SBI(SO)IT

Syllabus
1. Software Development: –
Data-Structures and Algorithms: 200 mcqs

 Questions based on Arrays, Linked List, Stacks, Queues, Binary


Tree, Binary Search Tree, Heaps, Hashing and Recursion

(100 mcqs)

1. Which of the following is an advantage of using arrays over linked lists?

 a) Dynamic size
 b) Ease of insertion and deletion
 c) Random access
 d) Memory utilization

Answer: c) Random access


Explanation: Arrays allow random access of elements in O(1) time due to
contiguous memory allocation.

2. Which data structure uses LIFO (Last In First Out)?

 a) Stack
 b) Queue
 c) Linked List
 d) Heap

1|P ag e
Answer: a) Stack
Explanation: In a stack, the last element added is the first one to be removed.

3. In a queue, the element is inserted at the ___ and deleted from the ___.

 a) Front, rear
 b) Rear, front
 c) Top, bottom
 d) Left, right

Answer: b) Rear, front


Explanation: Queue follows FIFO (First In First Out), where insertion happens at
the rear and deletion at the front.

4. Which of the following traversal algorithms is used in Depth First Search (DFS)?

 a) Pre-order
 b) In-order
 c) Post-order
 d) All of the above

Answer: a) Pre-order
Explanation: DFS can use pre-order traversal to explore nodes, especially in tree-
based structures.

5. What is the time complexity of binary search in a sorted array?

 a) O(n)
 b) O(log n)
 c) O(n log n)
 d) O(n²)

Answer: b) O(log n)
Explanation: Binary search divides the array in half, reducing the search space
logarithmically.

2|P ag e
57. Which of the following operations is performed in constant time O(1) in a circular
queue?

 a) Insertion at the rear


 b) Deletion at the front
 c) Both a and b
 d) None of the above

Answer: c) Both a and b


Explanation: In a circular queue, both insertion at the rear and deletion at the
front are performed in constant time O(1).

58. Which data structure is used in implementing the Depth-First Search (DFS)
algorithm?

 a) Queue
 b) Stack
 c) Heap
 d) Tree

Answer: b) Stack
Explanation: DFS uses a stack (either explicitly or implicitly through recursion) to
explore nodes in depth-first order.

59. Which of the following binary tree traversal algorithms visits the root node first?

 a) Inorder
 b) Postorder
 c) Preorder
 d) Level order

Answer: c) Preorder
Explanation: Preorder traversal visits the root node first, followed by the left and
right subtrees.

18 | P a g e
Answer: a) Left rotation
Explanation: A left rotation is performed when a node is inserted into the right
subtree of the right child, balancing the AVL tree.

99. Which of the following data structures is used to model relationships between
objects?

 a) Tree
 b) Graph
 c) Queue
 d) Stack

Answer: b) Graph
Explanation: A graph models relationships between objects, where vertices
represent objects and edges represent relationships.

100. Which of the following is true about tail recursion?

 a) The recursive call is the last operation in the function


 b) It can be optimized to avoid adding new stack frames
 c) It improves the space complexity of recursive algorithms
 d) All of the above

Answer: d) All of the above


Explanation: Tail recursion is a form of recursion where the recursive call is the
last operation, allowing for optimization to reduce space complexity.

31 | P a g e
 Searching and Sorting Algorithms along with their Space-Time
Complexities(100 mcqs)

1. What is the time complexity of linear search in an unsorted array of 'n' elements?

 a) O(log n)
 b) O(n)
 c) O(n log n)
 d) O(1)

Answer: b) O(n)
Explanation: Linear search checks each element sequentially, so in the worst
case, it takes O(n) time to find the target element.

2. Which of the following algorithms has the best average-case time complexity for
sorting?

 a) Bubble Sort
 b) Insertion Sort
 c) Quick Sort
 d) Selection Sort

Answer: c) Quick Sort


Explanation: Quick Sort has an average-case time complexity of O(n log n) and
generally performs better than other O(n^2) algorithms like Bubble Sort or
Insertion Sort.

3. What is the space complexity of Merge Sort?

 a) O(1)
 b) O(log n)
 c) O(n)
 d) O(n log n)

Answer: c) O(n)
Explanation: Merge Sort requires O(n) extra space for storing the temporary
arrays used during the merging process.

32 | P a g e
13. Which sorting algorithm is particularly efficient for sorting linked lists?

 a) Merge Sort
 b) Quick Sort
 c) Bubble Sort
 d) Selection Sort

Answer: a) Merge Sort


Explanation: Merge Sort is efficient for linked lists since it does not require
random access to elements and has O(n log n) time complexity.

14. Which of the following sorting algorithms is NOT comparison-based?

 a) Heap Sort
 b) Radix Sort
 c) Merge Sort
 d) Quick Sort

Answer: b) Radix Sort


Explanation: Radix Sort is not comparison-based; it sorts numbers by processing
individual digits.

15. What is the time complexity of Selection Sort?

 a) O(n)
 b) O(n log n)
 c) O(n^2)
 d) O(log n)

Answer: c) O(n^2)
Explanation: Selection Sort repeatedly selects the smallest element, and its time
complexity is O(n^2).

36 | P a g e
46. Which of the following is a characteristic of Bubble Sort?

 a) It is not adaptive.
 b) It is a divide-and-conquer algorithm.
 c) It repeatedly steps through the list.
 d) It has a space complexity of O(n).

Answer: c) It repeatedly steps through the list.


Explanation: Bubble Sort repeatedly goes through the list, comparing adjacent
elements and swapping them if they are in the wrong order.

47. What is the primary advantage of using Hashing in search operations?

 a) It is more space-efficient than arrays.


 b) It provides constant time complexity for search operations.
 c) It maintains the order of elements.
 d) It is easier to implement than other search algorithms.

Answer: b) It provides constant time complexity for search operations.


Explanation: Hashing can achieve average-case O(1) time complexity for search
operations by using hash tables.

48. What is the best-case time complexity for Quick Sort?

 a) O(n^2)
 b) O(n log n)
 c) O(n)
 d) O(log n)

Answer: b) O(n log n)


Explanation: The best case for Quick Sort occurs when the pivot splits the array
evenly, resulting in balanced partitions.

47 | P a g e
97. Which of the following algorithms is best suited for sorting linked lists?

 a) Quick Sort
 b) Merge Sort
 c) Heap Sort
 d) Bubble Sort

Answer: b) Merge Sort


Explanation: Merge Sort is well-suited for linked lists because it does not require
random access to elements, making it more efficient than other algorithms.

98. Which sorting algorithm divides the input into two halves, sorts them, and then
merges the sorted halves?

 a) Quick Sort
 b) Merge Sort
 c) Heap Sort
 d) Insertion Sort

Answer: b) Merge Sort


Explanation: Merge Sort follows the divide-and-conquer paradigm, dividing the
input into halves, sorting them, and merging the results.

99. What is the primary disadvantage of using a Hash Table?

 a) It provides average O(1) time complexity for searches.


 b) It can have performance issues with many collisions.
 c) It requires a lot of memory.
 d) It is slow for searching.

Answer: b) It can have performance issues with many collisions.


Explanation: While Hash Tables can provide average O(1) time complexity, they
can degrade to O(n) in the worst case when collisions occur.

64 | P a g e
100. What is the primary disadvantage of using Merge Sort?

 a) It is not a stable sorting algorithm.


 b) It requires additional space for merging.
 c) It has a worst-case time complexity of O(n^2).
 d) It cannot handle large datasets.

Answer: b) It requires additional space for merging.


Explanation: Merge Sort requires O(n) additional space for the temporary arrays
used during the merge process, which can be a drawback compared to in-place
sorting algorithms.

65 | P a g e

You might also like