T4Tutorials .PK

Fundamentals of Algorithms and Data Structures

1. : What is the main purpose of an algorithm?

(A) To store data


(B) To provide step-by-step instructions to solve a problem


(C) To execute code faster


(D) To define programming syntax




2. : Which data structure works on the principle of First In, First Out (FIFO)?

(A) Stack


(B) Queue


(C) Tree


(D) Graph




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

(A) O(n)


(B) O(log n)


(C) O(n²)


(D) O(1)




4. : Which of the following data structures is best suited for implementing recursion?

(A) Queue


(B) Stack


(C) Linked List


(D) Hash Table




5. : In Big-O notation, what does O(1) represent?

(A) Linear time


(B) Constant time


(C) Logarithmic time


(D) Quadratic time




6. : Which traversal of a binary tree visits nodes in Left–Root–Right order?

(A) Preorder


(B) Inorder


(C) Postorder


(D) Level-order




7. : Which data structure is used in Dijkstra’s shortest path algorithm?

(A) Stack


(B) Queue


(C) Priority Queue (Min-Heap)


(D) Linked List




8. : Which sorting algorithm has the best average-case time complexity?

(A) Bubble Sort


(B) Selection Sort


(C) Quick Sort


(D) Insertion Sort




9. : A hash table is mainly used to achieve which time complexity for search operations (on average)?

(A) O(n)


(B) O(1)


(C) O(log n)


(D) O(n log n)




10. : Which of the following is a linear data structure?

(A) Graph


(B) Tree


(C) Queue


(D) Hash Table




Exit mobile version