Professional Documents
Culture Documents
Day 7 Quiz
1. In the following procedure, the parameter age represents a person’s age. The procedure is intended to return the
name of the age group associated with age. People who are under 18 are considered minors, people who are 65
and older are considered senior citizens, and all other people are considered adults. The procedure does not work as
intended.
Removing which two lines of code will cause the procedure to work as intended?
A Line 3
B Line 8
C Line 10
D Line 15
2. To be eligible for a particular ride at an amusement park, a person must be at least 12 years old and must be
between 50 and 80 inches tall, inclusive.
Let age represent a person’s age, in years, and let height represent the person’s height, in inches. Which of
the following expressions evaluates to true if and only if the person is eligible for the ride?
Day 7 Quiz
3. A company delivers packages by truck and would like to minimize the length of the route that each driver must
travel in order to reach delivery locations. The company is considering two different algorithms for determining
delivery routes.
Algorithm I all possible routes, compute their lengths, and then select the shortest possible route. This
Generate
algorithm does not run in reasonable time.
Algorithm II from an arbitrary delivery location, find the nearest unvisited delivery location. Continue
Starting
creating the route by selecting the nearest unvisited location until all locations have been visited.
This algorithm does not guarantee the shortest possible route and runs in time proportional to .
4. A graphic artist uses a program to draw geometric shapes in a given pattern. The program uses an algorithm that
draws the shapes based on input from the artist. The table shows the approximate number of steps the algorithm
takes to draw different numbers of shapes.
Number of Number of
4 17
5 24
6 35
7 50
Based on the values in the table, which of the following best characterizes the algorithm for drawing shapes,
where is a very large number?
Day 7 Quiz
The algorithm runs in a reasonable amount of time because it will use approximately steps to draw
(A)
shapes.
The algorithm runs in a reasonable amount of time because it will use approximately steps to draw
(B)
shapes.
The algorithm runs in an unreasonable amount of time because it will use approximately steps to draw
(C)
shapes.
The algorithm runs in an unreasonable amount of time because it will use approximately steps to
(D)
draw shapes.
5. A local router is configured to limit the bandwidth of guest users connecting to the Internet. Which of the following
best explains the result of this configuration as compared to a configuration in which the router does not limit the
bandwidth?
(A) The amount of time it takes guest users to send and receive large files is likely to decrease.
(B) The number of packets required for guest users to send and receive data is likely to decrease.
(C) Guest users will be prevented from having fault-tolerant routing on the Internet.
(D) Guest users will be restricted in the maximum amount of data that they can send and receive per second.
6. Let n be an integer value. Which of the following expressions evaluates to true if and only if n is a two-digit
integer (i.e., in the range from 10 to 99, inclusive)?
(A) n = (n MOD 100)
(B) (n ≥ 10) AND (n < 100)
(C) (n < 10) AND (n ≥ 100)
(D) (n > 10) AND (n < 99)
7. To attend a particular camp, a student must be either at least 13 years old or in grade 9 or higher, but must not yet be
18 years old. Let age represent a student’s age and let grade represent the student’s grade level. Which of the
following expressions evaluates to true if the student is eligible to attend the camp and evaluates to false
otherwise?
(A) ((age ≥ 13) OR (grade ≥ 9)) AND (age ≤ 18)
(B) ((age ≥ 13) OR (grade ≥ 9)) AND (age < 18)
(C) ((age ≥ 13) OR (grade ≥ 9)) OR (age ≤ 18)
(D) ((age ≥ 13) OR (grade ≥ 9)) OR (age < 18)
8. Which of the following best explains why it is not possible to use computers to solve every problem?
(A) Current computer processing capabilities cannot improve significantly.
Large-scale problems require a crowdsourcing model, which is limited by the number of people
(B)
available to work on the problem.
The ability of a computer to solve a problem is limited by the bandwidth of the computer’s Internet
(C)
connection.
(D) There exist some problems that cannot be solved using any algorithm.
Day 7 Quiz
9. Directions: The question or incomplete statement below is followed by four suggested answers or
completions. Select the one that is best in each case.
10. A Web site uses several strategies to prevent unauthorized individuals from accessing user accounts. Which of the
following is NOT an example of multifactor authentication?
Each employee for a company is issued a USB device that contains a unique token code. To log into a
(A) company computer, an employee must insert the USB device into the computer and provide a correct
password.
After logging into an account from a new device, a user must enter a code that is sent via e-mail to the e-
(B)
mail address on file with the account.
In order to log into an account, a user must provide both a password and a fingerprint that is captured
(C)
using the user’s device.
When a user enters an incorrect password more than two times in a row, the user is locked out of the
(D)
account for 24 hours.
Day 7 Quiz
11. The following procedure is intended to return the value of x times y, where x and y are integers.
Multiplication is implemented using repeated additions.
For which of the following procedure calls does the procedure NOT return the intended value?
Day 7 Quiz
12. A student wrote the following program to remove all occurrences of the strings "the" and "a" from the list
wordList.
While debugging the program, the student realizes that the loop never terminates. Which of the following changes
can be made so that the program works as intended?
(A) Inserting index index + 1 between lines 6 and 7
(B) Inserting index index + 1 between lines 7 and 8
(C) Inserting index index - 1 between lines 6 and 7
13. The following code segment is intended to remove all duplicate elements in the list myList. The procedure does
not work as intended.
j LENGTH(myList)
REPEAT UNTIL(j = 1)
{
IF(myList[j] = myList[j - 1])
{
REMOVE(myList, j)
}
j ← j - 1
}
For which of the following contents of myList will the procedure NOT produce the intended results?
Day 7 Quiz
14. The procedure Draw (length, direction) is used to draw a line segment length units long in a given direction (left,
right, up, or down), starting at the current cursor position. The cursor is then repositioned at the end of the line
segment that was drawn. Consider the following program, where the cursor starts in the upper left corner of a grid
of dots. The dots are spaced one unit apart.
Which of the following represents the figure that is drawn by the program?
(A)
(B)
(C)
(D)
Day 7 Quiz
The DrawLine procedure is to be used to draw the following figure on a coordinate grid.
startX 2
startY 6
endX 8
endY 8
REPEAT 4 TIMES
{
<MISSING CODE>
}
Which of the following can be used to replace <MISSING CODE> so that the figure is drawn correctly?
Day 7 Quiz
endX endX - 2
(D) endY endY - 2
DrawLine (startX, startY, endX, endY)