Data Structures Fundamentals: 69 flashcards
All 69 flashcards from this kit, free and with no sign-up.
1. What is a data structure?
Show the answer
A specialized format for organizing, storing, and managing data in a computer so that it can be used efficiently.
2. What are the four key components of a data structure?
Show the answer
Data, storage representation, operations, and access methods.
3. Name the five common operations that can be performed on a data structure.
Show the answer
Insert, delete, search, traverse, and sort.
4. What are the three access methods for data structures?
Show the answer
Direct (index), sequential (loop), and recursive.
5. How does an array store data in memory?
Show the answer
In contiguous memory locations, allowing direct access by index but slow insert/delete operations.
6. How does a linked list store data in memory?
Show the answer
In scattered memory locations with pointers linking each element, allowing fast insert/delete but slow direct access.
7. What is the difference between a data structure and an algorithm?
Show the answer
A data structure is the organization of data; an algorithm is the step-by-step procedure to manipulate that data.
8. Why are data structures important for program efficiency?
Show the answer
They organize data so that operations like searching, sorting, inserting, and deleting become faster and more efficient, avoiding error-prone and time-consuming manual methods.
9. What is the trade-off between arrays and linked lists?
Show the answer
Arrays offer fast access by index but slow insert/delete; linked lists offer fast insert/delete but slow access by index.
10. Give two real-world applications of data structures.
Show the answer
Contact lists (arrays/hash tables) and undo features in text editors (stacks).
11. What does 'storage representation' refer to in a data structure?
Show the answer
How and where the data is stored in memory—contiguous or scattered.
12. What are the formal characteristics of a data structure?
Show the answer
It defines how data is grouped and connected, what operations can be performed, how data is stored in memory, and its impact on program efficiency.
13. What is the main benefit of using a data structure over separate variables?
Show the answer
It brings efficiency, clarity, and organization to programs, making tasks like searching and sorting logical and maintainable.
14. What is the role of access methods in a data structure?
Show the answer
They define how data can be retrieved—directly by index, sequentially by loop, or recursively.
15. What is the difference between data and a data item?
Show the answer
Data is a raw value or fact that may or may not have meaning (e.g., 5, "apple"). A data item is a single unit of value (e.g., 42, 'A', 3.14). Data is the general term; a data item is a specific single value.
16. Define a group item and give an example.
Show the answer
A group item is a collection of related data items. Example: a point in 2D space (x, y) or a student record {Name, Roll No, Marks}.
17. What is a field in the context of records?
Show the answer
A field is a single attribute of a record. For example, in a student record, 'Name' is a field.
18. What is a record?
Show the answer
A record is a complete collection of fields that describes one entity. For example, a student record = {Name, Roll, Grade}.
19. What is a file in data structures terminology?
Show the answer
A file is a collection of related records. For example, a file of student records stored in memory.
20. What is a data structure?
Show the answer
A data structure is a logical model for organizing data for efficient access and modification. Examples: Array, Stack, Linked List.
21. What is a storage structure?
Show the answer
A storage structure is the actual memory layout of a data structure, which can be static (e.g., array with contiguous memory) or dynamic (e.g., linked list with scattered memory and pointers).
22. List the common operations that can be performed on a data structure.
Show the answer
Insert, Delete, Search, Traverse.
23. In the C struct `struct Student { int roll; char name[20]; float marks; };`, what are the fields, record, and file?
Show the answer
Fields: `roll`, `name`, `marks`. Record: the `struct Student` itself. File: an array of `struct Student` records.
24. Can the same logical data structure have multiple storage structures? Give an example.
Show the answer
Yes. For example, a stack can be implemented using an array (contiguous memory) or a linked list (scattered nodes with pointers).
25. What is the hierarchy of data organization from smallest to largest?
Show the answer
Data item -> Group item -> Record -> File.
26. Why is the choice of storage structure important?
Show the answer
It affects performance. For example, insertion in a linked list is faster than in an array because it only requires updating pointers, while arrays require shifting elements.
27. What is a primitive data structure?
Show the answer
A basic data type provided directly by a programming language that stores a single atomic value, such as `int`, `char`, `float`, `bool`, or `pointer`.
28. What is a non-primitive data structure?
Show the answer
A user-defined or derived structure that organizes multiple values into a collection, such as arrays, stacks, queues, linked lists, trees, and graphs.
29. Give three examples of primitive data types.
Show the answer
`int`, `char`, `float` (also `bool` and `pointer`).
30. Give three examples of non-primitive data structures.
Show the answer
Array, Stack, Queue (also Linked List, Tree, Graph, Heap, Trie).
31. Are arrays primitive or non-primitive? Why?
Show the answer
Arrays are non-primitive because they organize multiple elements into a single structure, even though they store primitive values.
32. What are the two main categories of non-primitive data structures?
Show the answer
Linear (e.g., array, stack, queue, linked list) and non-linear (e.g., tree, graph, heap, trie).
33. What is the real-life analogy for primitive vs non-primitive?
Show the answer
Primitives are like bricks (basic blocks) and non-primitives are like walls (organized structures). Also, a book vs a library, or a chair vs a classroom.
34. How does memory usage differ between primitive and non-primitive data structures?
Show the answer
Primitive data structures use fixed memory, while non-primitive data structures can use dynamic memory (they can grow or shrink).
35. Which type of data structure offers higher flexibility?
Show the answer
Non-primitive data structures offer higher flexibility because they can grow, shrink, and reorganize, whereas primitives have low flexibility.
36. What is the primary use case for primitive data structures?
Show the answer
When you need to store a single value or variable, such as `int age = 21;`.
37. What is the primary use case for non-primitive data structures?
Show the answer
When you need to store, organize, and manipulate collections of data efficiently, such as for searching, sorting, and managing multiple values.
38. Why are non-primitive data structures considered 'user-defined'?
Show the answer
Because they are created by the programmer using primitives as building blocks, rather than being provided directly by the language.
39. What does 'atomic' mean in the context of primitive data types?
Show the answer
It means the value is indivisible and cannot be broken down into smaller components; it is a single, self-contained value.
40. Which of the following is NOT a primitive data type: `int`, `char`, `array`, `bool`?
Show the answer
`array` is not a primitive data type; it is non-primitive because it organizes multiple values.
41. What is the relationship between primitive and non-primitive data structures?
Show the answer
Non-primitive structures are built on top of primitive types, using them as raw material to create organized, complex structures.
42. What is the key difference between linear and non-linear data structures?
Show the answer
Linear structures arrange elements sequentially (one after another), while non-linear structures arrange elements hierarchically or as a graph with multiple connections.
43. Name three examples of linear data structures.
Show the answer
Array, Stack, Queue, Linked List (any three).
44. Name three examples of non-linear data structures.
Show the answer
Tree, Graph, Trie.
45. What does LIFO stand for and which structure uses it?
Show the answer
Last In, First Out; Stack uses LIFO.
46. What does FIFO stand for and which structure uses it?
Show the answer
First In, First Out; Queue uses FIFO.
47. In a linear data structure, what is the relationship between elements?
Show the answer
One-to-one (each element has one predecessor and one successor, except the first and last).
48. In a non-linear data structure, what type of relationships can exist between elements?
Show the answer
One-to-many or many-to-many relationships.
49. How does traversal differ between linear and non-linear structures?
Show the answer
Linear structures have a single path from start to end; non-linear structures have multiple possible paths and may require recursion or backtracking.
50. Give a real-world analogy for a tree data structure.
Show the answer
A family tree or a folder system on a PC.
51. Give a real-world analogy for a graph data structure.
Show the answer
A road map (cities as nodes, roads as edges) or a social media network (people as nodes, relationships as edges).
52. What type of memory allocation is typically used in non-linear data structures?
Show the answer
Mostly dynamic and pointer-based memory.
53. What is a trie used for?
Show the answer
Efficient word searching, commonly used in autocomplete features.
54. When should you choose a linear data structure over a non-linear one?
Show the answer
When data is simple, ordered, and needs to be processed sequentially (e.g., queues, lists).
55. When should you choose a non-linear data structure?
Show the answer
When relationships are complex and involve hierarchy or connectivity (e.g., trees, graphs).
56. What is a common misconception about non-linear structures?
Show the answer
That they are always slower than linear ones; in reality, balanced trees can be faster for search operations.
57. What is the key difference between static and dynamic data structures?
Show the answer
Static data structures allocate memory at compile time with a fixed size, while dynamic data structures allocate memory at runtime and can grow or shrink as needed.
58. Which type of memory allocation does a static array use?
Show the answer
Compile-time allocation. The size is fixed and cannot change during execution.
59. What are two examples of static data structures?
Show the answer
Arrays and static stacks (implemented using arrays).
60. What are two examples of dynamic data structures?
Show the answer
Linked lists and trees.
61. Why is access faster in static data structures?
Show the answer
Because they use contiguous memory, allowing direct indexing with simple arithmetic.
62. What is a major drawback of dynamic data structures?
Show the answer
They require careful memory management; forgetting to free allocated memory can cause memory leaks.
63. What does 'static' refer to in a static data structure?
Show the answer
It refers to the fixed size, not the immutability of values. You can modify elements, but you cannot change the number of elements.
64. In C, which functions are used to allocate dynamic memory?
Show the answer
malloc() and calloc().
65. What is the real-life analogy for a static data structure?
Show the answer
Booking a fixed number of seats in a hall whether you need them all or not.
66. When should you prefer a static data structure?
Show the answer
When the data size is known and fixed, and speed is important.
67. What is a common risk when using dynamic structures?
Show the answer
Memory leaks, if allocated memory is not freed properly.
68. How does a linked list store its elements?
Show the answer
In non-contiguous memory, with each node containing data and a pointer to the next node.
69. What is the trade-off between static and dynamic structures?
Show the answer
Static structures are faster and simpler but inflexible; dynamic structures are flexible and memory-efficient but slower and more complex.
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