Hello friends, form now onwards we will look on a very necessary concept "Data Structure and Algorithms". And we will look problems and their solution.
So let's start...
What is Data Structure and Algorithms?
Well Data Structure and Algorithms are two terms, one is Data Structure means how you will utilize your main memory(primary memory) and database for better proficiency and efficiency.
And Algorithms is the way that we uses to manage the main memory and performs several tasks.
Or we can say that algorithms is sequence of steps that we performs to understand and conquer the problems.
Let's start with the problems...
Q1: What should be the worst time-case complexity of linear search algorithm?
A - O(1)
B - O(n)
C - O(log n)
D - O(n^2)
Answer: D
Q2: What is the worst-case of run-time complexity of binary search algorithm?
A - O(n^2)
B - O(log^n)
C - O(n^3)
D - O(n)
Answer: D
Q3: Which is the following uses FIFO method?
A - Queue
B - Stack
C - Hash Table
D - Binary Search Tree
Answer: A
Q4: A complete graph can have?
A - n^2 spanning trees
B - n^n-2 spanning trees
C - n^n+1 spanning trees
D - n^n spanning trees
Answer: B
Q5: Which one of the below is not divide and conquer approach?
A - Insertion Sort
B - Merge Sort
C - Shell Short
D - Heap Short
Answer: B
Q6: Prefix notation is also known as
A - Reverse Polish Notation
B - Reverse Notation
C - Polish Reverse Notation
D - Polish Notation
Answer: D
Q7: In order traversal of binary search tree will produce?
A - Unsorted List
B - Reverse of input
C - Sorted List
D - None of the Above
Answer: C
Q8: In a min-heap?
A - Parent nodes have values greater than or equal to their childs
B - Parent nodes have values less than or equal to their childs
C - Both statement are true
D - Both statements are wrong
Answer: A
Q9: A procedure that calls itself?
A - Illegal Call
B - Reverse Polish
C - Recursive
D - None of the above
Answer: C
Q10: For a binary search algorithm to work, it is necessary that the array(list) must be
A - Sorted
B - Unsorted
C - In a heap
D - Popped out of stack
Answer: A
Q11: Push() and Pop() functions are found in
A - Queues
B - Lists
C - Stacks
D - Trees
Answer: C
Q12: Queue Data Structure works on
A - LIFO
B - FIFO
C - FILO
D - None of the above
Answer: B
Q13: What can be the maximum number of codes in a binary tree with height k, where root is height 0?
A - 2^k - 1
B - 2^k+1 - 1
C - 2^k-1 + 1
D - 2^k + 1
Answer: B
Q14: Which one of the following is linear data structure?
A - Queue
B - Stack
C - Arrays
D - All of the above
Answer: D
Q15: Which data structure is used for depth first traversal of a graph?
A - Queue
B - Stack
C - List
D - None of the above
Answer: B
Q16: Which data structure is used for breadth first traversal of a graph?
A - Queue
B - Stack
C - List
D - None of the above
Answer: A
Q17: Which data structure can be used to check if a syntax has balanced parenthesis?
A - Queue
B - Tree
C - List
D - Stack
Answer: D
Q18: Postfix expression is just a reverse of prefix expression?
A - True
B - False
Answer: B
Q19: Stack is used for:
A - CPU Resource Allocation
B - Breadth First Traversal
C - Recursion
D - None of the above
Answer: C
Q20: A circular linked list can be used for
A - Stack
B - Queue
C - Both Stack and Queue
D - Neither Stack and Queue
Answer: C
0 Comments