DS Foundations: 17 flashcards
All 17 flashcards from this kit, free and with no sign-up.
1. What is a data structure?
Show the answer
A data structure is a method of organizing and storing data in a computer so that it can be used efficiently for processing, retrieval, updating, and deletion.
2. List the four key components of a data structure.
Show the answer
1. Data – actual values stored 2. Storage representation – how and where data is stored 3. Operations – insert, delete, search, traverse, sort 4. Access methods – direct (index), sequential (loop), recursive
3. What are primitive data structures? Give examples.
Show the answer
Primitive data structures are basic building blocks provided directly by programming languages, representing atomic single-value data types. Examples: int, char, float, bool, pointer.
4. What are non-primitive data structures? Give examples.
Show the answer
Non-primitive data structures are user-defined or derived structures that organize multiple values efficiently. Examples: Array, Stack, Queue, Linked List, Tree, Graph.
5. Differentiate between linear and non-linear data structures.
Show the answer
Linear data structures arrange elements sequentially (one after another), e.g., array, stack, queue, linked list. Non-linear data structures arrange elements hierarchically or graph-like, e.g., tree, graph, trie.
6. What is the difference between static and dynamic data structures?
Show the answer
Static data structures have fixed size allocated at compile time (e.g., array). Dynamic data structures have flexible size allocated at runtime using pointers (e.g., linked list, tree).
7. Give a real-life analogy for a stack and explain why it fits.
Show the answer
Undo button in MS Word – last action is undone first (LIFO).
8. Give a real-life analogy for a queue and explain why it fits.
Show the answer
Line at a railway counter – first person in line is served first (FIFO).
9. Which data structure is used for Google Maps navigation and why?
Show the answer
Graph – locations are nodes, roads are edges.
10. What is the address formula for accessing an array element?
Show the answer
Address of arr[i] = base address + (i × size of each element)
11. How is a linked list stored in memory compared to an array?
Show the answer
A linked list uses non-contiguous memory where each node stores data and a pointer to the next node, while an array uses contiguous memory.
12. What is an Abstract Data Type (ADT)?
Show the answer
An ADT is a logical description of how data behaves and what operations are allowed, without specifying implementation details. It focuses on what operations can be performed, not how.
13. List the allowed operations for a Stack ADT.
Show the answer
push(x), pop(), peek(), isEmpty()
14. List the allowed operations for a Queue ADT.
Show the answer
enqueue(x), dequeue(), front(), isEmpty()
15. What is the difference between a field and a record?
Show the answer
A field is a single attribute of a record (e.g., Name in a student record). A record is a complete collection of fields (e.g., Student Record = {Name, Roll, Grade}).
16. Why are arrays considered non-primitive even though they store primitive values?
Show the answer
Arrays are non-primitive because they organize multiple items, making them a structured collection rather than a single atomic value.
17. What are the advantages and disadvantages of dynamic data structures?
Show the answer
Advantages: flexible size, efficient memory usage, adapts to variable input sizes. Disadvantages: more complex to manage, requires careful memory management (risk of memory leaks if not freed properly).
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