Files
freeCodeCamp/curriculum/challenges/english/blocks/quiz-graphs-and-trees/67f4138c34cd9c4ac783ceef.md
T
2026-03-17 17:32:06 +01:00

456 lines
6.2 KiB
Markdown

---
id: 67f4138c34cd9c4ac783ceef
title: Graphs and Trees Quiz
challengeType: 8
dashedName: quiz-graphs-and-trees
---
# --description--
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
# --quizzes--
## --quiz--
### --question--
#### --text--
What is a graph?
#### --distractors--
A linear data structure that follows the Last-In, First-Out principle.
---
A data structure that stores multiple values of the same type that are contiguous in memory.
---
A linear data structure that follows the First-In, First-Out principle.
#### --answer--
A data structure used to represent the connections or relationships between objects or entities.
### --question--
#### --text--
Which of the following is NOT a typical scenario that can be represented using a graph?
#### --distractors--
social networks
---
transportation networks
---
communications networks
#### --answer--
temperature measurement over time
### --question--
#### --text--
Which of the following terms describes an object or entity that is part of the network depicted by a graph?
#### --distractors--
Cookie
---
Endpoint
---
CPU
#### --answer--
Node
### --question--
#### --text--
Which of the following terms describes the connections between nodes in a graph?
#### --distractors--
Gates
---
Connectors
---
Vertices
#### --answer--
Edges
### --question--
#### --text--
What is an undirected graph?
#### --distractors--
A graph where the nodes are undirected but the edges are directed.
---
A graph where the edges have a specific direction.
---
A graph where the nodes and edges connect at the midpoint.
#### --answer--
A graph where the edges don't have a specific direction.
### --question--
#### --text--
Which of the following refers to a graph in which each node is associated with a label or identifier in addition to its data?
#### --distractors--
Version labeled graph
---
Virtual labeled graph
---
Vertical labeled graph
#### --answer--
Vertex labeled graph
### --question--
#### --text--
Which of the following refers to a directed graph with at least one cycle?
#### --distractors--
Cycling graph
---
Circulating graph
---
Circular graph
#### --answer--
Cyclic graph
### --question--
#### --text--
What is a weighted graph?
#### --distractors--
A specific type of edge labeled graph that shows only the direction of connections between nodes.
---
A specific type of edge labeled graph that assigns categories instead of numerical values to edges.
---
A specific type of edge labeled graph that treats all edge weights as equal regardless of label.
#### --answer--
A specific type of edge labeled graph in which the labels on the edges represent values that can be compared and used to perform arithmetic operations.
### --question--
#### --text--
What is a directed acyclic graph?
#### --distractors--
A directed graph with one cycle.
---
A directed graph with three cycles.
---
A directed graph with two cycles.
#### --answer--
A directed graph with no cycles.
### --question--
#### --text--
Which of the following refers to a graph with two or more groups of nodes that are not connected by any edges?
#### --distractors--
Disconnect graph
---
Disconnecting graph
---
Disconnection graph
#### --answer--
Disconnected graph
### --question--
#### --text--
What is the Breadth-first search algorithm?
#### --distractors--
An algorithm that visits two nodes in one direction before moving another direction in the graph.
---
An algorithm that visits all nodes in one direction before moving another direction in the graph.
---
An algorithm that visits four nodes at a time before moving to the next level in the graph.
#### --answer--
An algorithm that visits all neighboring nodes before moving to the next level in the graph.
### --question--
#### --text--
Which of the following algorithms will follow each branch as deep as possible before it backtracks?
#### --distractors--
Data-First Search
---
Dock-First Search
---
Daemon-First Search
#### --answer--
Depth-First Search
### --question--
#### --text--
Which of the following terms represents a two-dimensional list in which the rows and columns represent the graph's vertices?
#### --distractors--
Array matrix
---
Depth matrix
---
Vertex matrix
#### --answer--
Adjacency matrix
### --question--
#### --text--
Which of the following terms represents an array or dictionary that stores all the neighbors of each node?
#### --distractors--
Cyclic list
---
Tuple list
---
Breadth list
#### --answer--
Adjacency list
### --question--
#### --text--
What must be true for a graph to be classified as a tree?
#### --distractors--
It must have at least one loop or cycle.
---
It must have at least two loops or cycles.
---
It must have three loops or cycles.
#### --answer--
It cannot have loops or cycles.
### --question--
#### --text--
Which of the following is a type of tree in which each node can have at most two child nodes?
#### --distractors--
Depth tree
---
Spatial tree
---
Linear tree
#### --answer--
Binary tree
### --question--
#### --text--
What is a Trie?
#### --distractors--
A tree data structure used to store a set of numbers.
---
A tree data structure used to store a set of dictionaries.
---
A tree data structure used to store a set of lists.
#### --answer--
A tree data structure used to store a set of strings.
### --question--
#### --text--
How does the priority queue data structure differ from a regular queue data structure?
#### --distractors--
A priority queue automatically removes duplicates before insertion.
---
A priority queue always processes elements in the order they were added.
---
A priority queue only stores elements of the same data type.
#### --answer--
A priority queue processes elements based on their priority.
### --question--
#### --text--
What are the two types of heaps?
#### --distractors--
Wide-heap and Tall-heap
---
Horizontal-heap and Vertical-heap
---
Breadth-heap and Depth-heap
#### --answer--
Max-heap and Min-heap
### --question--
#### --text--
What are the average and worst case time complexities for inserting and extracting the minimum or maximum value from a heap?
#### --distractors--
`O(n log n)`
---
`O(1)`
---
`O(n)`
#### --answer--
`O(log n)`