Data Structures and Algorithms •
MCQ • Introduction & Asymptotic Notations
Most Important 30 Objective Question - Introduction & Asymptotic Notations
Q1. Data structure is defined as:
A) Collection of algorithms
B) Way of organizing and storing data
C) Type of programming language
D) Operating system function
Answer: B
Explanation: Data structure is a systematic way of organizing and storing data so that it can be accessed and modified efficiently.
Q2. Which operation is used to add an element in a data structure?
A) Deletion
B) Traversal
C) Insertion
D) Searching
Answer: C
Explanation: Insertion means adding a new element into the data structure.
Q3. Which operation is used to remove an element?
A) Traversal
B) Deletion
C) Sorting
D) Merging
Answer: B
Explanation: Deletion is the process of removing an existing element from the data structure.
Q4. Visiting each element of a data structure is called:
A) Searching
B) Traversal
C) Insertion
D) Deletion
Answer: B
Explanation: Traversal means accessing each element exactly once.
Q5. Which notation represents worst-case complexity?
A) Big O
B) Omega
C) Theta
D) Sigma
Answer: A
Explanation: Big O notation is used to represent the upper bound or worst-case complexity.
Q6. Which notation represents best-case complexity?
A) Big O
B) Omega
C) Theta
D) Alpha
Answer: B
Explanation: Omega notation represents the lower bound or best-case complexity.
Q7. Which notation represents average-case complexity?
A) Big O
B) Omega
C) Theta
D) Delta
Answer: C
Explanation: Theta notation gives the tight bound and is often used for average-case complexity.
Q8. Time complexity of linear search is:
A) O(1)
B) O(log n)
C) O(n)
D) O(n²)
Answer: C
Explanation: In the worst case, linear search checks all elements one by one.
Q9. Binary search can be applied on:
A) Unsorted array
B) Sorted array
C) Linked list only
D) Graph only
Answer: B
Explanation: Binary search requires data to be arranged in sorted order.
Q10. Which is not a linear data structure?
A) Array
B) Linked List
C) Stack
D) Tree
Answer: D
Explanation: Tree is a non-linear data structure because data is arranged hierarchically.
Q11. Which is an example of non-linear data structure?
A) Queue
B) Stack
C) Tree
D) Array
Answer: C
Explanation: Tree stores data in hierarchical form, so it is non-linear.
Q12. The efficiency of an algorithm is measured by:
A) Size of program
B) Time and Space complexity
C) Number of variables
D) CPU brand
Answer: B
Explanation: Algorithm efficiency depends mainly on execution time and memory usage.
Q13. Space complexity means:
A) Time taken by algorithm
B) Memory used by algorithm
C) Number of instructions
D) Number of outputs
Answer: B
Explanation: Space complexity measures the total memory required by an algorithm.
Q14. Which of the following is not a data structure operation?
A) Traversal
B) Insertion
C) Compilation
D) Deletion
Answer: C
Explanation: Compilation is related to programming language translation, not data structure operations.
Q15. Time-space tradeoff means:
A) Reducing both time and space
B) Increasing both time and space
C) Saving time using more memory or saving memory using more time
D) None
Answer: C
Explanation: Sometimes faster execution needs more memory, while less memory usage may require more time.
Q16. Which notation gives the tight bound?
A) Big O
B) Omega
C) Theta
D) Lambda
Answer: C
Explanation: Theta notation represents both upper and lower bounds, called tight bound.
Q17. O(1) complexity means:
A) Constant time
B) Linear time
C) Logarithmic time
D) Quadratic time
Answer: A
Explanation: O(1) means execution time does not depend on input size.
Q18. O(n²) complexity means:
A) Constant
B) Quadratic
C) Linear
D) Logarithmic
Answer: B
Explanation: O(n²) means time increases with the square of input size.
Q19. Which is faster?
A) O(n²)
B) O(log n)
C) O(n³)
D) O(n)
Answer: B
Explanation: O(log n) is faster than linear and quadratic complexities.
Q20. Which is slower?
A) O(1)
B) O(log n)
C) O(n³)
D) O(n)
Answer: C
Explanation: O(n³) takes much more time for large input sizes.
Q21. Stack follows:
A) FIFO
B) LIFO
C) Random
D) Circular
Answer: B
Explanation: Stack works on Last In First Out principle.
Q22. Queue follows:
A) FIFO
B) LIFO
C) Reverse
D) Circular only
Answer: A
Explanation: Queue works on First In First Out principle.
Q23. Which data structure uses contiguous memory?
A) Linked List
B) Tree
C) Array
D) Graph
Answer: C
Explanation: Array stores elements in continuous memory locations.
Q24. Which data structure uses pointers?
A) Array
B) Linked List
C) Matrix
D) String
Answer: B
Explanation: Linked list uses pointers to connect nodes.
Q25. Recursive function calls use:
A) Queue
B) Stack
C) Graph
D) Tree
Answer: B
Explanation: Recursion uses stack memory for function calls.
Q26. Binary search reduces search space by:
A) 1 part
B) 2 equal halves
C) 3 parts
D) 4 parts
Answer: B
Explanation: Binary search divides the sorted array into two halves repeatedly.
Q27. Primitive data structure example is:
A) Stack
B) Queue
C) Integer
D) Tree
Answer: C
Explanation: Integer is a primitive data structure because it stores single values directly.
Q28. Non-primitive data structure example is:
A) Float
B) Character
C) Linked List
D) Integer
Answer: C
Explanation: Linked list is a non-primitive data structure made using primitive data types.
Q29. Which search is better for sorted data?
A) Linear Search
B) Binary Search
C) Hash Search
D) Tree Search
Answer: B
Explanation: Binary search is faster and more efficient for sorted data.
Q30. Algorithm means:
A) Random steps
B) Finite sequence of instructions
C) Programming language
D) Hardware design
Answer: B
Explanation: An algorithm is a step-by-step finite procedure to solve a problem.
Google AdSense Ad Placement Here 📢