Corrections
Computer Science Practice Questions
Explore key computer science concepts through detailed explanations of multiple-choice questions and solutions.
Question 11
A spinner is divided into three sections. The sector labeled "Red" is four times as large as each of the sectors labeled "Yellow" and "Blue," which are of equal size. The procedure below is intended to simulate the behavior of the spinner. Which of the following can be used to replace the procedure to correctly simulate the spinner?
Correct
spin ← RANDOM(1, 6) IF spin = 1 RETURN "Yellow" IF spin = 2 RETURN "Blue" RETURN "Red"
Not Correct
spin ← RANDOM(1, 6) IF spin = 1 RETURN "Red" IF spin = 2 RETURN "Yellow" RETURN "Blue"
Explanation
The correct procedure assigns probabilities that match the spinner’s sizes: "Red" (4/6), "Yellow" (1/6), and "Blue" (1/6). The incorrect solution assigns 4/6 probability to "Blue" instead of "Red," which is incorrect.
Question 17
Which of the following actions could be used to help reduce the digital divide?
- I. Providing free education and training on how to use computing devices.
- II. Providing free or low-cost computing devices to low-income individuals.
- III. Providing networks and infrastructure to people in remote areas.
Correct
I, II, and III
Not Correct
I and II only
Explanation
Closing the digital divide requires teaching people how to use technology (I), providing affordable devices (II), and building networks in remote areas (III). All are essential to ensuring equal access to technology.
Question 25
For which of the following strings is it NOT possible to use byte pair encoding to shorten the string’s length?
Correct
"Level_Up"
Not Correct
"Banana"
Explanation
"Level_Up" cannot be shortened because it has no repeating pairs of characters. In contrast, "Banana" has pairs like "na," which can be replaced to shorten the string.
Question 29
The diagram below shows a circuit composed of three logic gates. Each gate takes two inputs and produces a single output. For which of the following input values will the circuit have an output of false?
Correct
A = true, B = false, C = false, D = false
Not Correct
A = false, B = false, C = false, D = true
Explanation
The first set of inputs makes both the AND and OR gates output false, so the final OR gate outputs false. The second set of inputs makes the final OR gate output true, which is incorrect.
Question 31
A robot in a grid is initially in the bottom-right square and must reach the top-left gray square. The following programs are each intended to move the robot to the gray square. Program II uses a flexible procedure that checks if the goal is reached.
Correct
Program II correctly moves the robot to the gray square, but program I does not.
Not Correct
Both program I and program II correctly move the robot to the gray square.
Explanation
Program I works only for this specific grid layout. Program II is more adaptable, adjusting the robot’s movements based on its position, making it flexible for different grid layouts.
Question 41
A teacher provides a way for students to improve their course grades if they score higher on their final exam. If the final score is greater than the midterm score, it replaces the midterm score in the total calculation.
Correct
adjustedTotal ← Max(midtermExam, finalExam) + finalExam
Not Correct
adjustedTotal ← Max(midtermExam, finalExam) + midtermExam
Explanation
The correct formula ensures the higher score is always used. The incorrect formula adds the midterm score, even when it is replaced, violating the grading policy.
Question 58
Which of the following are true statements about how the Internet enables crowdsourcing?
- I. Provides access to tools and knowledge.
- II. Lowers geographic barriers.
- III. Solves all computational problems efficiently.
Correct
I and II only
Not Correct
I and III only
Explanation
While the Internet provides tools and breaks down geographic barriers (I, II), not all problems can be solved efficiently through crowdsourcing (III), as some problems are too complex.
Question 64
Which of the following statements describe how cloud computing has affected Internet communication?
Correct
- Cloud computing has helped enhance collaboration.
- Cloud computing has introduced new data-security concerns.
Not Correct
- Cloud computing has eliminated the need to provide redundancy in Internet routing.
- Cloud computing has reduced concerns about intellectual property rights.
Explanation
Cloud tools allow teamwork from anywhere but create risks of data breaches. Redundancy and intellectual property concerns are still important issues that cloud computing does not solve.