MC3 Review
Score: 46/50
Q30
In the following expression, the variable truckWeight has the value 70000 and the variable weightLimit has the value 80000. What value does the expression truckWeight < weightLimit
evaluate to?
Correct Answer: true
This was a silly mistake. The correct answer is true because 70000 < 80000.
Q41
A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in order for a researcher to obtain the correct result when using a binary search algorithm to determine if a given genetic code is in the list?
Correct Answer: The list must be sorted based on the genetic code values.
This is the correct answer because binary search requires the input list to be sorted. Otherwise, the constructed binary tree will be inaccurate and comparisons at midpoints within sublists will not yield the correct result.
Q49
A city planner is using simulation software to study crowd flow out of a large arena after an event has ended. The arena is located in an urban city. Which of the following best describes a limitation of using a simulation for this purpose?
Correct Answer: The model used by the simulation software often omits details so that it is easier to implement.
This is the correct answer because:
- By process of elimination, the following must be incorrect:
- “The model used by the simulation software cannot be modified once the simulation has been used”: this is incorrect because software can always be modified after being run
- “Running a simulation requires more time to generate data from trials than observing the crowd exiting the arena at various events”: this is incorrect because simulations typically require much less time and resources, especially when done at a large scale, such as the situation in the prompt
- “Running a simulation requires a large number of observations to be collected before it can be used to explore a problem”: this is incorrect because observations are not necessarily required prior to running simulations. Conclusions can be drawn by running many simulations
- Simulations are often used for ease of observation, causing engineers to omit small details in the process of creating them
Q50
A computer scientist is analyzing four different algorithms used to sort a list. The table below shows the number of steps each algorithm took to sort lists of different sizes.
List Size | Number of Steps for Algorithm A | Number of Steps for Algorithm B | Number of Steps for Algorithm C | Number of Steps for Algorithm D |
---|---|---|---|---|
1 | 10 | 2 | 1 | 1 |
2 | 20 | 4 | 2 | 4 |
3 | 30 | 8 | 6 | 9 |
4 | 40 | 16 | 24 | 16 |
5 | 50 | 32 | 120 | 25 |
Based on the values in the table, which of the algorithms appear to run in reasonable time?
Correct Answer: A, B, D
This is the correct answer because Algorithm C runs in factorial time, which is considered inefficient. Algorithms A, B, and D run in linear, exponential, and square time respectively, which are considered “efficient”.