DS Foundations: 18 MCQs with answers
All 18 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 10 questions
Q1. What is a data structure?
BeginnerShow answer & explanation
A method of organizing and storing data for efficient use
A data structure is a method of organizing and storing data so that it can be used efficiently for processing, retrieval, updating, and deletion.
Q2. Which of the following is a primitive data structure?
BeginnerShow answer & explanation
Integer
Primitive data structures are basic types provided by programming languages, such as int, char, float, and bool. Arrays, stacks, and trees are non-primitive.
Q3. Which data structure is used for the 'Undo' operation in MS Word?
BeginnerShow answer & explanation
Stack
The Undo operation follows Last-In-First-Out (LIFO) order, which is exactly how a stack works.
Q4. In a linear data structure, elements are arranged:
BeginnerShow answer & explanation
In a sequential manner
Linear data structures arrange elements one after another, with each element having a unique predecessor and successor (except first and last).
Q5. Which of the following is a non-linear data structure?
BeginnerShow answer & explanation
Tree
Trees are non-linear because elements are arranged hierarchically, not sequentially. Arrays, queues, and linked lists are linear.
Q6. Which data structure is best suited for representing a family tree?
BeginnerShow answer & explanation
Tree
A family tree has hierarchical relationships, which is exactly what a tree data structure represents.
Q7. Which data structure uses LIFO (Last-In-First-Out) principle?
BeginnerShow answer & explanation
Stack
Stacks follow LIFO, where the last element added is the first one removed.
Q8. Which data structure is used for browser history?
BeginnerShow answer & explanation
Stack
Browser history uses a stack because the last visited page is on top and is accessed first (LIFO).
Q9. Arrays are considered primitive data structures.
BeginnerShow answer & explanation
False
Arrays are non-primitive because they organize multiple values, even though they store primitive values.
Q10. Dynamic data structures allocate memory at compile time.
BeginnerShow answer & explanation
False
Dynamic data structures allocate memory at runtime, allowing flexible size changes.
Building up · 7 questions
Q11. What is the main difference between static and dynamic data structures?
IntermediateShow answer & explanation
Static structures have fixed size, dynamic can change at runtime
Static data structures have a fixed size allocated at compile time, while dynamic data structures can grow or shrink at runtime.
Q12. In an array, the address of the i-th element is calculated as:
IntermediateShow answer & explanation
base address + (i × size of element)
Array elements are stored contiguously, so the address of arr[i] is base address plus i times the size of each element.
Q13. What is an Abstract Data Type (ADT)?
IntermediateShow answer & explanation
A logical description of data and operations without implementation details
An ADT defines what operations can be performed on data but hides the implementation details, like a remote control hides internal circuits.
Q14. Which data structure is used for CPU task scheduling based on priority?
IntermediateShow answer & explanation
Priority Queue
Priority queues allow tasks with higher priority to be executed first, which is essential for CPU scheduling.
Q15. Which of the following is an example of a dynamic data structure?
IntermediateShow answer & explanation
Linked List
Linked lists allocate memory at runtime, allowing them to grow or shrink as needed, making them dynamic.
Q16. In a graph, what do nodes and edges represent?
IntermediateShow answer & explanation
Nodes are entities, edges are relationships
In a graph, nodes represent entities (like locations or users), and edges represent relationships (like roads or friendships).
Q17. What is the main advantage of a linked list over an array?
IntermediateShow answer & explanation
Easier insertion and deletion
Linked lists allow easy insertion and deletion because they use pointers, whereas arrays require shifting elements.
Topper level · 1 questions
Q18. What is the space complexity of an adjacency matrix for a graph with V vertices?
AdvancedShow answer & explanation
O(V^2)
An adjacency matrix stores a 2D array of size V x V, so space complexity is O(V^2).
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages