mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(curriculum): add searching and sorting quiz JSV9 (#66007)
Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com>
This commit is contained in:
@@ -5679,6 +5679,12 @@
|
||||
"Before you are quizzed on Algorithms, you should review what you've learned about searching and sorting algorithms."
|
||||
]
|
||||
},
|
||||
"quiz-searching-and-sorting-algorithms-js": {
|
||||
"title": "Searching and Sorting Algorithms Quiz",
|
||||
"intro": [
|
||||
"Test your knowledge of searching and sorting algorithms with this quiz."
|
||||
]
|
||||
},
|
||||
"lecture-understanding-graphs-and-trees-js": {
|
||||
"title": "Understanding Graphs and Trees",
|
||||
"intro": [
|
||||
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
---
|
||||
id: 699c047c797138ec61f44d54
|
||||
title: Searching and Sorting Algorithms Quiz
|
||||
challengeType: 8
|
||||
dashedName: quiz-searching-and-sorting-algorithms-js
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
To pass the quiz, you must correctly answer at least 9 of the 10 questions below.
|
||||
|
||||
# --quizzes--
|
||||
|
||||
## --quiz--
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Which search algorithm iterates through a list of items, checking each item from the beginning until the target item is found?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Merge search
|
||||
|
||||
---
|
||||
|
||||
Bubble search
|
||||
|
||||
---
|
||||
|
||||
Binary search
|
||||
|
||||
#### --answer--
|
||||
|
||||
Linear search
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Which technique is used to break down a problem into smaller sub-problems?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Break-down-and-solve
|
||||
|
||||
---
|
||||
|
||||
Divide-and-solve
|
||||
|
||||
---
|
||||
|
||||
Break-down-and-conquer
|
||||
|
||||
#### --answer--
|
||||
|
||||
Divide-and-conquer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
What is the space complexity of the linear search algorithm?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
`O(n)`
|
||||
|
||||
---
|
||||
|
||||
`O(log n)`
|
||||
|
||||
---
|
||||
|
||||
`O(n²)`
|
||||
|
||||
#### --answer--
|
||||
|
||||
`O(1)`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Which is more suitable for a larger list of items between binary search and linear search?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Both
|
||||
|
||||
---
|
||||
|
||||
Linear search
|
||||
|
||||
---
|
||||
|
||||
None
|
||||
|
||||
#### --answer--
|
||||
|
||||
Binary search
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
What is the space complexity of binary search?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
`O(log n)`
|
||||
|
||||
---
|
||||
|
||||
`O(n)`
|
||||
|
||||
---
|
||||
|
||||
`O(n log n)`
|
||||
|
||||
#### --answer--
|
||||
|
||||
`O(1)`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
What does the binary search algorithm return when it finds the target item?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
The value of the target item.
|
||||
|
||||
---
|
||||
|
||||
The size of the list searched.
|
||||
|
||||
---
|
||||
|
||||
A boolean value of the target.
|
||||
|
||||
#### --answer--
|
||||
|
||||
The index of the target item.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
What does the linear search algorithm return if it doesn't find the target item?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
`0`
|
||||
|
||||
---
|
||||
|
||||
`null`
|
||||
|
||||
---
|
||||
|
||||
`undefined`
|
||||
|
||||
#### --answer--
|
||||
|
||||
`-1`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
How does the merge sort algorithm work?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
It searches for an element by checking each item one by one.
|
||||
|
||||
---
|
||||
|
||||
It builds a sorted list by repeatedly finding the smallest element.
|
||||
|
||||
---
|
||||
|
||||
It swaps adjacent elements until the list is sorted.
|
||||
|
||||
#### --answer--
|
||||
|
||||
It recursively splits the list into smaller items, then merges them in sorted order.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
What is the condition for a binary search to work?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
The list must contain only unique values.
|
||||
|
||||
---
|
||||
|
||||
The list must have an even number of elements.
|
||||
|
||||
---
|
||||
|
||||
The list must contain no negative numbers.
|
||||
|
||||
#### --answer--
|
||||
|
||||
The list must be sorted.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Which computer science approach is used to implement the merge sort algorithm?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Dynamic programming
|
||||
|
||||
---
|
||||
|
||||
Greedy algorithm
|
||||
|
||||
---
|
||||
|
||||
Tracing
|
||||
|
||||
#### --answer--
|
||||
|
||||
Divide-and-conquer
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "Searching and Sorting Algorithms Quiz",
|
||||
"isUpcomingChange": true,
|
||||
"dashedName": "quiz-searching-and-sorting-algorithms-js",
|
||||
"helpCategory": "JavaScript",
|
||||
"blockLayout": "challenge-list",
|
||||
"challengeOrder": [
|
||||
{
|
||||
"id": "699c047c797138ec61f44d54",
|
||||
"title": "Searching and Sorting Algorithms Quiz"
|
||||
}
|
||||
],
|
||||
"blockLabel": "review"
|
||||
}
|
||||
@@ -316,7 +316,8 @@
|
||||
"lab-selection-sort-js",
|
||||
"lab-insertion-sort",
|
||||
"lab-quicksort-js",
|
||||
"review-searching-and-sorting-algorithms-js"
|
||||
"review-searching-and-sorting-algorithms-js",
|
||||
"quiz-searching-and-sorting-algorithms-js"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user