ALGORITHMS UNIT TEST ACTUAL QUESTIONS AND ANSWERS WITH COMPLETE SOLUTION
ALGORITHMS UNIT TEST ACTUAL QUESTIONS AND ANSWERS WITH COMPLETE SOLUTION Which of these best describes which algorithms are more efficient with parallel computing Ans- An algorithm that benefits from parallel computing is one that can be broken down into smaller independent operations A software engineer at a mapping company is asked to write a geocoding program that can convert 6000,000 addresses into latitude/longitude pairs. The geocoding needs to be completed by the next day, in time for a company deadline When the engineer tries running the program on their computer, they realize that their computer cannot complete the fast quickly enough. They decide to use distributed computing to improve the performance Ans- A distribution computing solution can geocode multiple addresses at once by using multiple computers The two algorithms below are both intended to calculate the sum of cubes from 1 to n, where n is any positive integer. For example, if n is 3, the algorithms should calculate a sum of 36, from 1^3 + 2^3 + 3^3. Ans- Both algorithms calculate the correct sum. TensorFlow is an open-source machine learning platform with support for distributed computing. This chart shows the speedup gained from using TensorFlow to train a neural network with an increasing number of computers: Ans- Distributed computing can reduce the time it takes to solve large problems. An app for electric car owners includes a feature that shows them the charging station that's the nearest to them. To calculate that, the app first finds the 10 closest stations according to their beeline distance from the user address. It then uses the procedure below to calculate the driving distance to each station and returns the station with the shortest distance. The call to calcDrivingDistance() takes 3 seconds to return a result, as the driving directions algorithm requires searching through many possible routes to calculate the optimal route. The other operations, like incrementing the index and comparing the distances, take only a few nanoseconds. Ans- 30 seconds The following algorithm displays a sequence of 10 odd squares: Start by setting n to 1. Repeat 10 times: Multiply n by itself and display the result Add 2 to n Ans- n ← 1 REPEAT 10 TIMES { result ← n * n DISPLAY(result) n ← n + 2 } Which of these applications is NOT an example of distributed computing? Ans- Premiere Pro is a video editing program from Adobe that allows users to compose multiple videos and add special effects. Exporting the final video requires a lot of computational power, so Premiere assigns different parts of the exporting task to each of the computer's processors (as long as the computer has multiple processors). An online news website relies on in-page advertisements to make money. Their article pages have multiple slots for advertisements, and each slot can be used for a full-size ad or multiple smaller ads. Advertisers specify their size and desired display count per day. Ans- Use a heuristic-based algorithm that suggests an advertisement schedule that is close to optimal. Han develops an algorithm to compute the average amount of time that users watch a particular video on Khan Academy. He then realizes that the average is very low, due to a large number of times with duration "0" or "1", and decides that the algorithm should ignore those durations. Ans- Selection One way to measure the efficiency of an algorithm is to count how many steps it requires for different input sizes and then use a function to describe how the number of steps increases in proportion to the input size. The table below lists various efficiencies, where n represents the input size. Ans- n^2 + 6n = polynomial 6^n = superpolynomial 6n^6 = polynomial 6^2n^2 = superpolynomial n/6 = polynomial A biomedical engineer develops a procedure to help them measure the accuracy of an algorithm that predicts a disease diagnosis. They're specifically interested in the "false positive rate", the number of times the algorithm incorrectly predicted a positive diagnosis. Which change will reduce the most number of operations while still outputting a correct answer? Ans- Moving the calculation of falsePosRate to be after the loop (but before the return) Which of these applications is NOT an example of distributed computing? Ans- Excel is a spreadsheets application developed by Microsoft. An Excel spreadsheet can contain many formulas that require computation, so loading a spreadsheet or changing its data can take a lot of time. To speed up the process, Excel is configured to utilize all of a computer's processors at once for concurrent computation. Ophelia is working on a program that uses machine learning to analyze hospital CT scans for signs of cancer. With her first version of the program, the computer took an average of 24 minutes to analyze 1000 images. To improve the performance, she parallelized the image analysis operation. When running the parallelized program on a hospital computer, the computer took an average of 6 minutes to analyze 1000 images. What is the speedup of the parallel solution? Ans- 4 A software engineer at a mapping company is tasked with coming up with an algorithm to solve a new problem. The engineer is nervous about whether they'll be able to solve it. Which of these outcomes is the least likely? Ans- The engineer may discover that the algorithm is only solvable in a programming language that their company does not use. A high school provides email addresses to freshman students. The email system typically assigns an email address in the format "". However, if a student has the same name as a previous student, the system assigns them a different format. In order to figure out whether an email address is already assigned, the system does a binary search through its list of existing email addresses. Ans- The list of email addresses must be sorted for binary search to work. The following algorithm computes the average height for a list of basketball player heights. 1. Initialize a variable sum to 0. .........................................
Written for
- Institution
- Khan
- Course
- Khan
Document information
- Uploaded on
- April 21, 2024
- Number of pages
- 13
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
algorithms unit test actual questions an
-
which of these best describes which algorithms are
-
when the engineer tries running the program on the
-
for example if n is 3 the algorithms should calc
Also available in package deal