ANSWERS UPDATED VIEW AHEAD EXAM
◉ The following grid contains a robot represented as a triangle, which is
initially facing right.
The following code segment is intended to move the robot to the gray
square.
<MISSING STATEMENT>
{
REPEAT 4 TIMES
{
MOVE_FORWARD()
ROTATE_RIGHT()
}
ROTATE_LEFT()
MOVE_FORWARD()
ROTATE_RIGHT()
}
Which of the following can be used as a replacement for <MISSING
STATEMENT> so that the code segment works as intended? Answer:
REPEAT 2 TIMES
, ◉ A video-streaming Web site uses 32-bit integers to count the number
of times each video has been played. In anticipation of some videos
being played more times than can be represented with 32 bits, the Web
site is planning to change to 64-bit integers for the counter. Which of the
following best describes the result of using 64-bit integers instead of 32-
bit integers? Answer: 2^32 times as many values can be represented.
◉ Which of the following is a primary reason for the use of open
protocols on the Internet? Answer: Open protocols provide a way to
standardize data transmission between different devices.
◉ Which of the following actions is most likely to raise legal or ethical
concerns? Answer: A musician creates a song using samples of a
copyrighted work and then uses a Creative Commons license to publish
the song.
◉ A certain game keeps track of the maximum and minimum scores
obtained so far. If num represents the most recent score obtained, which
of the following algorithms correctly updates the values of the maximum
and the minimum? Answer: If num is less than the minimum, set the
minimum equal to num. Otherwise, if num is greater than the maximum,
set the maximum equal to num.
◉ In a certain game, the integer variable bonus is assigned a value based
on the value of the integer variable score.