FREE! Click here to Join FunTrivia. Thousands of games, quizzes, and lots more!
Quiz about Data Structures
Quiz about Data Structures

Data Structures Trivia Quiz


Do you know how your programs store your data?

A multiple-choice quiz by Hegh. Estimated time: 5 mins.
  1. Home
  2. »
  3. Quizzes
  4. »
  5. Science Trivia
  6. »
  7. Computers
  8. »
  9. Software and Programming

Author
Hegh
Time
5 mins
Type
Multiple Choice
Quiz #
270,909
Updated
Dec 03 21
# Qns
10
Difficulty
Tough
Avg Score
6 / 10
Plays
1858
Last 3 plays: jmel2 (0/10), Kabdanis (8/10), Dizart (4/10).
- -
Question 1 of 10
1. Which of the following data structures falls under the category of a 'dictionary'? Hint


Question 2 of 10
2. When using a heap, which function will give you the parent of the entry with index i? Hint


Question 3 of 10
3. A vector (an indexed, growable list) would most likely be implemented on top of which of these structures? Hint


Question 4 of 10
4. If you have an empty stack that can contain letters, and you push (in order) these letters onto it, what order will they be in when you pop them off? 't' 'a' 'p' Hint


Question 5 of 10
5. If you have a empty queue that can contain letters, and you enqueue (in order) these letters into it, what order will they be in when you dequeue them? 'm' 'a' 'r' Hint


Question 6 of 10
6. Which of the following could best be described by the graph structure? Hint


Question 7 of 10
7. If you have a sorted, balanced binary tree with 15 elements in it, how many steps, maximum, will it take you to decide whether an element is present in the tree? Hint


Question 8 of 10
8. If you wanted to make sure that the close-parenthesis (the ')' character) matches the open-parenthesis (the '(' character) in a mathematical expression, which data structure could help you? Hint


Question 9 of 10
9. Which of these is true about a set? Hint


Question 10 of 10
10. Modern filesystems, like ReiserFS and XFS, use which structure to organize their data for efficient access? Hint



(Optional) Create a Free FunTrivia ID to save the points you are about to earn:

arrow Select a User ID:
arrow Choose a Password:
arrow Your Email:




Most Recent Scores
Jul 16 2024 : jmel2: 0/10
Jul 08 2024 : Kabdanis: 8/10
Jul 08 2024 : Dizart: 4/10
Jul 08 2024 : Joepetz: 10/10
Jul 08 2024 : Upstart3: 4/10
Jul 08 2024 : 1995Tarpon: 9/10
Jul 08 2024 : pollucci19: 4/10
Jun 27 2024 : Guest 86: 8/10

Score Distribution

quiz
Quiz Answer Key and Fun Facts
1. Which of the following data structures falls under the category of a 'dictionary'?

Answer: Hash table

A hash table allows you to look up data based on a key, much like you look up a definition in a dictionary based on the word it applies to.

A tree lets you build a hierarchical structure, with parents and children. A hash is an array with a special interpretation, and a linked list is just a list.
2. When using a heap, which function will give you the parent of the entry with index i?

Answer: Integer division, i / 2

A heap is an array that is being interpreted as a binary tree (every node in the tree has two children). The root of the tree is in index 1, and its two children have indices 2 and 3.

From there, 2 will have children 4 and 5, and 3 will have children 6 and 7. Notice how the first child of a node has an index equal to 2 * its parent, and the second has an index of the first plus one? That makes traversal very easy. To find the parent, we need to do *integer* division because otherwise an odd child index will result in a fractional index, which is not what we want.
3. A vector (an indexed, growable list) would most likely be implemented on top of which of these structures?

Answer: Linked list

A common vector implementation uses a linked list of arrays, which gives reasonable lookup time, depending of course on the size of the arrays and the size of the vector itself.
4. If you have an empty stack that can contain letters, and you push (in order) these letters onto it, what order will they be in when you pop them off? 't' 'a' 'p'

Answer: 'p' 'a' 't'

A stack is just what it sounds like. You put things on top of it (you 'push' them onto the stack), and you take things back off the top (you 'pop' them off the stack). So when you push 't' 'a' 'p' onto a stack in that order, the 't' is at the bottom and the 'p' is at the top. So when you pop them back off, you will first get the 'p', then the 'a', and finally the 't'.
5. If you have a empty queue that can contain letters, and you enqueue (in order) these letters into it, what order will they be in when you dequeue them? 'm' 'a' 'r'

Answer: 'm' 'a' 'r'

A queue is basically a line; the first thing into it is the first thing out. So everything stays in order.
6. Which of the following could best be described by the graph structure?

Answer: Roads connecting cities

A graph is made up of a set of vertices (points) connected by edges (lines). The edges may have a direction associated with them (think of one-way streets), or a cost (think of toll roads). They are useful for trying to find the cheapest route between two points (a trucker trying to save money or time), or the shortest route that will allow you to visit every point (the Traveling Salesman Problem).
7. If you have a sorted, balanced binary tree with 15 elements in it, how many steps, maximum, will it take you to decide whether an element is present in the tree?

Answer: Four

A balanced binary tree with 15 elements in it will have four levels. Starting at the top, you can tell whether the element is searching for in equal to, less than, or greater than the root. Based on that, you will either be done (1 step), or you will have to visit the left or right child. If the element you are searching for is less than the root, you will travel left, and otherwise you will travel right. That was one step, and you just eliminated half of the tree (the other child and its descendants). So there are only seven nodes left.

The second step will reduce the search to three nodes, the third down to one. Checking that last node makes four steps.

This type of problem is used to determine how long it will take to execute a sequence of instructions. In this case, since the number of steps taken is approximately the logarithm (base 2) of the size of the tree, it would be called a O(log n) problem. That means no matter how large the tree is, the upper-bound on the amount of time it will take to search it is proportional to the log of the tree size.
8. If you wanted to make sure that the close-parenthesis (the ')' character) matches the open-parenthesis (the '(' character) in a mathematical expression, which data structure could help you?

Answer: Stack

The stack would help if you push each '(' onto it as you see it, and you pop one off each time you see a ')'. If you never try to pop an empty stack, and the stack is empty when you're done, then the expression has balanced parenthesis.
9. Which of these is true about a set?

Answer: There are no duplicates

A set enforces uniqueness, since if an item is in a set, there is no sense in it being in the set a second time. Imagine if someone asked you to tell him what kinds of cereal you have. You are going to give him a set of names, since even if you have two boxes of something, you probably won't read it off more than once.

The elements of a set have no order guarantees, and as you just saw, a set can have anything in it, even other sets!
10. Modern filesystems, like ReiserFS and XFS, use which structure to organize their data for efficient access?

Answer: B+Trees

The B+Tree is similar to the B-Tree in that they are both balanced trees, but it has some significant differences that make it ideal for filesystems. Most importantly, data is only stored at the leaves of a B+Tree. For more information, explore Wikipedia or simply search the web.
Source: Author Hegh

This quiz was reviewed by FunTrivia editor crisw before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.
7/19/2024, Copyright 2024 FunTrivia, Inc. - Report an Error / Contact Us