Data Structures & Algorithms Quiz
Practice quiz on Data Structures & Algorithms (Computer Science). 10 exam-style questions with explanations.
About This Quiz
Data Structures & Algorithms Quiz — Questions with Solutions
All 10 questions from this quiz with the correct answer and explanation. Attempt them yourself first, then open each solution to check your reasoning.
Q1.Which data structure works on the LIFO principle?
- A.Tree
- B.Queue
- C.Array
- D.Stack
Show answer
Answer: D. Stack
A stack is Last In First Out.
Q2.Which data structure works on the FIFO principle?
- A.Stack
- B.Queue
- C.Tree
- D.Graph
Show answer
Answer: B. Queue
A queue is First In First Out.
Q3.The time complexity of binary search on a sorted array of n elements is
- A.O(log n)
- B.O(n log n)
- C.O(1)
- D.O(n)
Show answer
Answer: A. O(log n)
Binary search halves the search space each step.
Q4.Which sorting algorithm has the worst-case time complexity of O(n^2)?
- A.None
- B.Heap sort
- C.Bubble sort
- D.Merge sort
Show answer
Answer: C. Bubble sort
Bubble sort takes O(n^2) in the worst case.
Q5.In a linked list, each node contains
- A.Data and a pointer to the next node
- B.Only data
- C.Only a pointer
- D.An array
Show answer
Answer: A. Data and a pointer to the next node
A node stores data and a link to the next node.
Q6.Which traversal of a binary search tree gives sorted order?
- A.Level order
- B.Inorder
- C.Preorder
- D.Postorder
Show answer
Answer: B. Inorder
Inorder traversal of a BST gives ascending order.
Q7.The maximum number of children of a node in a binary tree is
- A.3
- B.4
- C.2
- D.1
Show answer
Answer: C. 2
A binary tree node has at most two children.
Q8.Which data structure is used for the breadth-first search of a graph?
- A.Stack
- B.Array only
- C.Heap
- D.Queue
Show answer
Answer: D. Queue
BFS uses a queue.
Q9.An algorithm is
- A.A type of hardware
- B.A compiler
- C.A step-by-step procedure to solve a problem
- D.A programming language
Show answer
Answer: C. A step-by-step procedure to solve a problem
An algorithm is a finite sequence of steps.
Q10.Which operation removes the top element of a stack?
- A.Push
- B.Insert
- C.Peek
- D.Pop
Show answer
Answer: D. Pop
Pop removes the top element.
Frequently Asked Questions
Is Data Structures & Algorithms Quiz free to attempt on AajExam?
Yes. Data Structures & Algorithms Quiz is completely free. You only need a free AajExam account to track your score, view detailed solutions and unlock cross-attempt analytics.
How long does it take to complete Data Structures & Algorithms Quiz?
Data Structures & Algorithms Quiz runs on a 10-minute timer in real exam-style conditions. The clock starts the moment you click Start, mirroring the time pressure of the actual exam.
Are detailed solutions provided?
Yes. Every question on Data Structures & Algorithms Quiz ships with a complete step-by-step solution, the underlying concept, and (where applicable) shortcut tricks. You can also discuss any question with the AajExam community.
Can I attempt Data Structures & Algorithms Quiz multiple times?
Yes. You can attempt this quiz as many times as you like. Each attempt is recorded separately so you can track improvement in score, accuracy and time-management.
Which government exams does this quiz prepare me for?
Data Structures & Algorithms questions appear regularly in SSC CGL, CHSL, MTS, GD; IBPS PO, Clerk; SBI PO, Clerk; RRB NTPC, Group D; UPSC prelims and most State PSC exams. The specific weightage varies by exam — check the exam pattern on the corresponding AajExam exam page for details.