100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Khan Academy Algorithms List Exam Questions and Answers Fully Solved Latest Version

Rating
-
Sold
-
Pages
28
Grade
A+
Uploaded on
03-08-2025
Written in
2025/2026

Khan Academy Algorithms List Exam Questions and Answers Fully Solved Latest Version A statistician developed this procedure to calculate the "variance" of a list of numbers. The variance is a statistical quantity that corresponds to the average of the sum of the squared differences of each number from the mean. As input, the procedure takes a list of numbers and its mean: PROCEDURE calculateVariance(numbers, mean) { count ← 0 sumSquaredDiffs ← 0 FOR EACH num IN numbers { diff ← (num - mean) squaredDiff ← diff * diff sumSquaredDiffs ← sumSquaredDiffs + squaredDiff count ← count + 1 variance ← sumSquaredDiffs / count } RETURN variance } The statistician verifies the procedure outputs the variance correctly, but they still want to improve the efficiency of the procedure by reducing the number of operations required. Which change will reduce the most number of operations while still outputting a correct answer? - AnswersMoving the calculation of variance to be after the loop (but before the return) The following algorithm computes the maximum score for a list of final exam scores. Initialize a variable max to the first score in the list. For each score in the list, compare the score to max. If score is greater than max, store score in max Return max. Which building blocks are involved in this algorithm? ️Note that there may be multiple answers to this question. - AnswersSelection Iteration Sequencing ScootALot is a scooter rental service. At the end of each day, they hire contractors to pick up scooters and distribute them optimally around the city. The distribution algorithm considers all the possible locations for the scooters, compares that to the density of customers, and comes up with the optimal location for each scooter. As the company becomes more popular, they realize their algorithm is taking an unreasonable amount of time to come up with optimal scooter locations. What is the best way to improve the run time of the algorithm? - AnswersUse a heuristic-based algorithm that suggests good locations for the scooters. An algorithm will be used to calculate the difference between the smallest and largest values in a list. For the list of [10, 3, 5, 6], it should calculate a difference of 7. There are two proposals for the algorithm: Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal. Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal. Which of these statements are true about these algorithms? I. Algorithm 1 does not work on lists where the smallest valu - AnswersII only The flow chart below visualizes an algorithm to generate the Fibonacci numbers, a famous mathematical sequence. If the variable max is set to 5, what would be displayed as a result of executing this algorithm? - Answers1 2 3 5 8 Yuto implements an algorithm for finding the "greatest common divisor" of two numbers. For the numbers 54 and 24, it finds a greatest common divisor of 6. He counts the number of steps required by the algorithm for numbers of increasing digit length and comes up with this table: Number of digits Steps 2 4 3 6 4 8 5 10

Show more Read less
Institution
Khan Academy Algorithms
Course
Khan Academy Algorithms










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Khan Academy Algorithms
Course
Khan Academy Algorithms

Document information

Uploaded on
August 3, 2025
Number of pages
28
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Khan Academy Algorithms List Exam Questions and Answers Fully Solved Latest Version 2025-2026

A statistician developed this procedure to calculate the "variance" of a list of numbers. The variance is a
statistical quantity that corresponds to the average of the sum of the squared differences of each
number from the mean.

As input, the procedure takes a list of numbers and its mean:

PROCEDURE calculateVariance(numbers, mean) {

count ← 0

sumSquaredDiffs ← 0

FOR EACH num IN numbers {

diff ← (num - mean)

squaredDiff ← diff * diff

sumSquaredDiffs ← sumSquaredDiffs + squaredDiff

count ← count + 1

variance ← sumSquaredDiffs / count

}

RETURN variance

}

The statistician verifies the procedure outputs the variance correctly, but they still want to improve the
efficiency of the procedure by reducing the number of operations required.

Which change will reduce the most number of operations while still outputting a correct answer? -
AnswersMoving the calculation of variance to be after the loop (but before the return)

The following algorithm computes the maximum score for a list of final exam scores.

Initialize a variable max to the first score in the list.

For each score in the list, compare the score to max.

If score is greater than max, store score in max

Return max.

Which building blocks are involved in this algorithm?

, Note that there may be multiple answers to this question. - AnswersSelection

Iteration

Sequencing

ScootALot is a scooter rental service. At the end of each day, they hire contractors to pick up scooters
and distribute them optimally around the city.

The distribution algorithm considers all the possible locations for the scooters, compares that to the
density of customers, and comes up with the optimal location for each scooter.

As the company becomes more popular, they realize their algorithm is taking an unreasonable amount
of time to come up with optimal scooter locations.

What is the best way to improve the run time of the algorithm? - AnswersUse a heuristic-based
algorithm that suggests good locations for the scooters.

An algorithm will be used to calculate the difference between the smallest and largest values in a list.
For the list of [10, 3, 5, 6], it should calculate a difference of 7.

There are two proposals for the algorithm:

Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate
through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number
is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and
minVal.

Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number
is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop,
set maxDiff to the difference between maxVal and minVal.

Which of these statements are true about these algorithms?

I. Algorithm 1 does not work on lists where the smallest valu - AnswersII only

The flow chart below visualizes an algorithm to generate the Fibonacci numbers, a famous mathematical
sequence.

If the variable max is set to 5, what would be displayed as a result of executing this algorithm? -
Answers1 2 3 5 8

Yuto implements an algorithm for finding the "greatest common divisor" of two numbers. For the
numbers 54 and 24, it finds a greatest common divisor of 6.

He counts the number of steps required by the algorithm for numbers of increasing digit length and
comes up with this table:

, Number of digits Steps

24

36

48

5 10

6 12

Based on the table, which of the following statements describe the run time for this algorithm?

Note that there are 2 answers to this question. - AnswersThe algorithm runs in polynomial time.



The algorithm runs in reasonable time.

An online app for playing Chess utilizes a variety of algorithms. Their software engineers would like the
algorithms to run in under a second so that users have a great experience.

Which algorithm's runtime is most likely to be improved by the use of a heuristic? - AnswersChoosing a
good move when the computer is playing against the human

A restaurant delivery app uses the following algorithm to choose the restaurants it features to each user.

Which pseudocode is equivalent to the algorithm in the flowchart? - AnswersIF (openNow = true AND
milesAway < 5 AND reviews > 3.5) {

showFeatured ← true

} ELSE {

showFeatured ← false

}

The algorithm below determines whether a given year is a leap year.

If year is not divisible by 4, set leap_year to false

Else if year is not divisible by 100, set leap_year to true

Else if year is not divisible by 400, set leap_year to false

Else, set leap_year to true.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TutorJosh Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
332
Member since
1 year
Number of followers
16
Documents
28211
Last sold
1 day ago
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.6

53 reviews

5
18
4
14
3
12
2
0
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions