Corrections

Q1: Many Web browsers allow users to open anonymous windows. During a browsing session in an anonymous window, the browser does not record a browsing history or a list of downloaded files. When the anonymous window is exited, cookies created during the session are deleted. Which of the following statements about browsing sessions in an anonymous window is true?

A: B) This option is correct. Because the cookies created during the anonymous browsing session were deleted, no information exists in the browser to inform future visits to the same website. Thus, any shopping cart items will not be available for future purchase.

Q2: Which of the following has the greatest potential for compromising a user’s personal privacy?

A: A) This option is correct. The aggregation of information in browser cookies can be used by websites that the user visits to track the user and collect information about the user.

Q3: A chain of retail stores uses software to manage telephone calls from customers. The system was recently upgraded. Customers interacted with the original system using their phone keypad. Customers interact with the upgraded system using their voice.

The upgraded system (but not the original system) stores all information from the calling session in a database for future reference. This includes the customer’s telephone number and any information provided by the customer (name, address, order number, credit card number, etc.).

The original system and the upgraded system are described in the following flowcharts. Each flowchart uses the following blocks.

A: A) Correct. All information from the calling session (including personally identifiable information) is saved in a database. This information could be compromised if an unauthorized individual gains access to the database.

Q5 : Of the following potential benefits, which is LEAST likely to be provided by the upgraded system?

A: B) Correct. The company is not able to provide a human representative for calls made after business hours.

Q6: The upgraded system uses a directory containing additional information not supplied by the customer. The directory is used to help direct calls effectively. Which of the following is LEAST likely to be included in the directory?

A: C)Correct. A list of the company’s computers and their IP addresses is not needed to help direct calls.

Q21: A programmer wrote the program below. The program uses a list of numbers called numList. The program is intended to display the sum of the numbers in the list. In order to test the program, the programmer initializes numList to [0, 1, 4, 5]. The program displays 10, and the programmer concludes that the program works as intended.

Which of the following is true?

A: C) This option is correct. Because the variable sum is initialized to store the value of the first element of numList, and because the iteration block is a FOR EACH loop, the value of the first element is added to sum twice. Since the first element of the list is 0, adding this number to the sum does not affect the sum. A non-zero first element would give an incorrect result. In general, a single test case is not sufficient to confirm that a program works as intended.

Q24: The procedure below is intended to display the index in a list of unique names (nameList) where a particular name (targetName) is found. If targetName is not found in nameList, the code should display 0.Which of the following procedure calls can be used to demonstrate that the procedure does NOT work as intended?

A: C)This option is correct. The procedure will not display the correct value of foundIndex if the targetName is "Ben". In the FOR EACH loop, when the value of name is "Andrea", the ELSE statement sets foundIndex to 0. When the value of name is "Ben", the ELSE statement sets foundIndex to 1. But as the loop continues, and the value of name is "Chris", the ELSE statement sets foundIndex to 0. The procedure displays 0, even though the correct answer is 1.

Q26: A teacher has a goal of displaying the names of 2 students selected at random from a group of 30 students in a classroom. Any possible pair of students should be equally likely to be selected. Which of the following algorithms can be used to accomplish the teacher’s goal?

A: D) Correct. This algorithm selects 1 student from the group of 30 students, then selects another student from the remaining 29 students. Any possible pair of students is equally likely to be selected.

Q28: Assume that the string oldString contains at least 4 characters. A programmer is writing a code segment that is intended to remove the first two characters and the last two characters from oldString and assign the result to newString.

For example, if oldString contains "student", then newString should contain "ude".

Which of the following code segments can be used to assign the intended string to newString ?

Select two answers.

A: D) Correct. The first statement removes the first 2 characters of oldString and assigns the result to tempString. The second statement removes the last 2 characters of tempString and assigns the result to newString.

Q29: What is displayed as a result of executing the code segment?

A: B) Correct. The first three statements assign values to the variables. The fourth statement assigns the value of (NOT (a OR b)) AND c to a. Since a OR b is true, NOT (a OR b) is false, so (NOT (a OR b)) AND c is false. The fifth statement assigns the value of c AND a to c. Since a is now false, c AND a is false. The last three statements display the values of the variables.

Q31: A programmer is creating an algorithm that will be used to turn on the motor to open the gate in a parking garage. The specifications for the algorithm are as follows.

The gate should not open when the time is outside of business hours. The motor should not turn on unless the gate sensor is activated. The motor should not turn on if the gate is already open.

Which of the following algorithms can be used to open the gate under the appropriate conditions?

A: D) Correct. The algorithm continues past the first check if the time is during business hours, the algorithm continues past the second check if the gate sensor is activated, and the algorithm continues past the third check if the gate is not open. Performing the checks in this order will ensure that the gate is opened only under the appropriate conditions.

Q34: Which of the following code segments can be used to move the robot to the gray square?

A: D) Correct. The robot moves forward three spaces, turns to the left, moves forward two spaces, turns to the right, and moves forward three spaces.

Q35: Three teams (Team A, Team B, and Team C) are participating in a trivia contest. Let scoreA represent the number of correct questions for Team A, scoreB represent the number of correct questions for Team B, and scoreC represent the number of correct questions for Team C. Assuming no two teams get the same number of correct questions, which of the following code segments correctly displays the team with the highest number of correct questions?

A: A) Correct. If scoreA is greater than both scoreB and scoreC (the first two IF clauses), then Team A wins. If scoreA is greater than scoreB but not greater than scoreC, then scoreC is greater than both scoreA and scoreB and Team C wins. If scoreB is greater than scoreA (the outer ELSE clause) and scoreC (the IF clause in the outer ELSE), then Team B wins. If scoreB is greater than scoreA but not greater than scoreC, then scoreC is greater than both scoreA and scoreB and Team C wins.

Q36: A numeric test score is to be converted to a letter grade of A, B, or C according to the following rules: A score greater than 90 is considered an A; a score between 80 and 90, inclusive, is considered a B; and any other score is considered a C.

Which of the following code segments will assign the correct letter grade to grade based on the value of the variable score ?

A: D) Correct. Code segment I does not work correctly because it is not possible for "C" to be the value of grade at the end of the code segment. Code segment II correctly assigns "A" when the numeric score is greater than 90, or "B" if the numeric score is not greater than 90 but is greater than or equal to 80, or "C" otherwise. Code segment III assigns "C" when the numeric score is less than 80, or "B" if the numeric score is not less than 80 but is less than or equal to 90, or "A" otherwise.

Q37: If x has a value of 7 and y has a value of 20, what is displayed as a result of executing the code segment?

A: C) Correct. The value "THREE" is displayed whenever x is less than or equal to 10 and y is greater than 3.

Q38: Which of the following code segments is equivalent to the code segment above?

A: B) Correct. The given code segment displays "positive" when num is positive, displays "negative" when num is negative, and displays "zero" when num is 0. This code segment produces the same result. When num is negative, "negative" is displayed. Otherwise, when num is 0, "zero" is displayed. Otherwise, "positive" is displayed.

Q39:Consider the goal of modifying the code segment to count the number of squares the robot visits before execution terminates. Which of the following modifications can be made to the code segment to correctly count the number of squares the robot moves to?

A: A) Correct. Inserting this statement between lines 6 and 7 increases the value of count once each time the robot moves forward, which keeps an accurate count of the number of squares the robot visits.

Q40: When the robot reaches the gray square, it turns around and faces the bottom of the grid. Which of the following changes, if any, should be made to the code segment to move the robot back to its original position in the bottom-left square of the grid and facing toward the bottom of the grid?

A: D)Correct. In order for the robot to move from the gray square back to its original position, it must move forward two squares, turn right, move forward four squares, turn left, and move forward two squares. The same set of moves can be used in both directions, so no change is needed to the algorithm.

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?

A: B) Correct. Simulations are limited by the model that is used. There may be many reasons for using a simplified model, including ease of implementation.