Questions with Answers
Data Structures - Correct Answers: an arrangement of data in the computer's memory (or on a disk)
Examples of Data Structures (9) - Correct Answers: arrays, linked lists, stacks, queues, binary trees, hash
tables, red black trees, 2-3-4 trees, heaps, etc.
T/F? Primitive variables are data structures - Correct Answers: FALSE
Examples of primitive data types (9) - Correct Answers: char, byte, short, int, long, float, double,
boolean, void
Algorithms - Correct Answers: Sequences of steps used to manipulate the data in data structures in
various ways. They are implemented by using program instructions. (so these are basically the things
that happen during a program).
Examples of algorithms (3) - Correct Answers: Build/create the data structure, add/remove data,
search/manipulate the data
T/F? One algorithm can build/create the data structure, add/remove data, and search/manipulate data -
Correct Answers: FALSE; different algorithms are needed to carry out these tasks in data structures
Fill in the blank:
Many items in nature have a ______ ________ with their predecessor/successor (one before/one next)
element. - Correct Answers: Natural Arrangement
T/F? Data can be arranged/organized based on many different attributes. - Correct Answers: True
What are attributes that data can be arranged by? (7) - Correct Answers: Age, size, non-ordinal (array),
numeric/alphabetical order (sorted arrray), time order (stacks/queues), tree (like family tree), graphs
,What data structure can best represent a sequence of numbers? - Correct Answers: An array
What if you need to search an array? - Correct Answers: 1. If the array is ordered/sorted and is large
enough, use a binary search.
2. If the array is unordered/unsorted then sequential search is the only option.
What data structure can best represent a family? - Correct Answers: A tree
Advantages of an array (2) - Correct Answers: 1. Quick insertion
2. Very fast access if index of element is known
Disadvantages of an array (3) - Correct Answers: 1. Slow search
2. Slow deletion
3. Fixed size
Advantages of an ordered array (1) - Correct Answers: 1. Same as a normal array but it is a quicker
search than an unsorted array
Disadvantages of an ordered array (3) - Correct Answers: Same as array only difference is not a slow
search but slow insertion.
1. Slow insertion
2. Slow deletion
3. Fixed size
Advantages of a stack (1) - Correct Answers: Provides a last-in, first-out access
Disadvantages of a stack (1) - Correct Answers: Slow access to other items (bc you have to take
everything off in order to get to that one- like a pile of papers)
, Advantages of a queue (1) - Correct Answers: Provides a first-in, first-out access
Disadvantages of a queue (1) - Correct Answers: Slow access to other items (you gotta go in line, turn by
turn)
Advantages of a linked list (2) - Correct Answers: 1. Quick insertion
2. Quick deletion
Disadvantages of a linked list (1) - Correct Answers: Slow search
Advantages of a binary tree (3) - Correct Answers: 1. Quick search
2. Quick insertion
3. Quick deletion (if tree remains balanced)
Disadvantages of a binary tree (1) - Correct Answers: Deletion algorithm is complex/hard
Advantages of red-black tree (4) - Correct Answers: 1. Quick search
2. Quick insertion
3. Quick deletion
4. Tree always balanced
Disadvantages of red-black tree (1) - Correct Answers: COMPLEX.
Advantages of 2-3-4 tree (5) - Correct Answers: 1. Quick search
2. Quick insertion
3. Quick deletion
4. Tree always balanced
5. Similar trees good for disk storage