ap csp final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

#34. The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom right square of the grid and facing toward the top of the grid. Which of the statements is true?

Both program I and program II correctly move the robot to the gray square.

#36. Participants in a survey were asked how many hours per day they spend reading, how many hours per day they spend using a smartphone, and whether or not they would be interested in a smartphone application that lets users share book reviews. The data from the survey are represented in the graph below. Each × represents a survey participant who said he or she was interested in the application, and each O represents a participant who said he or she was not interested. Which of the following hypotheses is most consistent with the data in the graph?

Participants who read more were generally more likely to say they are interested in the application.

#59. A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. Procedure square (n) returns the value n2 Procedure cube (n) returns the value n3 Which of the following procedures is a generalization of the procedures described above?

Procedure Power (n, m), which returns the value nm

#53. In a certain science experiment, 75 percent of trials are expected to be successful and 25 percent of trials are expected to be unsuccessful. The program below is intended to simulate the results of repeated trials of the experiment. Which of the following can be used to replace <MISSING CODE> so that the simulation works as intended?

RANDOM (1, 100) ≤ 75

#41. A computer program performs the operation 2 ÷ 3 and represents the result as the value 0.6666667. Which of the following best explains this result?

The precision of the result is limited due to the constraints of using a floating-point representation.

#60. A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game. The procedure does not work as intended. Which of the following best describes the result of running the procedure? answer choices The procedure returns true when the user inputs the value "y" and returns false otherwise.

The procedure returns false no matter what the input value is.

#40. A musician is creating a song using audio samples. Which of the following actions will minimize the risk of a copyright violation when creating sample-based music?

Using samples published with a no-rights-reserved Creative Commons license

#54. The code segment below is intended to display all multiples of 5 between the values start and end, inclusive. For example, if start has the value 35 and end has the value 50, the code segment should display the values 35, 40, 45, and 50. Assume that start and end are multiples of 5 and that start is less than end. Which of the following could replace <MISSING EXPRESSION> in line 2 so that the code segment works as intended?

((end - start) / 5) + 1

#33. A video-streaming service maintains a database of information about its customers and the videos they have watched. The program below analyzes the data in the database and compares the number of viewers of science fiction videos to the number of viewers of videos of other genres. It uses the procedure Analysis (category), which returns the number of unique users who viewed videos of a given category in the past year. The Analysis procedure takes approximately 1 hour to return a result, regardless of the number of videos of the given genre. All other operations happen nearly instantaneously. Which of the following best approximates the amount of time it takes the program to execute?

5 hours

#32. 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?

A = true, B = false, C = false, D = false

#35. A color is often represented by a 6-digit hexadecimal number that describes how the colors red, green, and blue are mixed to create the desired color. From left to right, the first two digits represent the amount of red, the second two digits represent the amount of green, and the last two digits represent the amount of blue. Which of the following hexadecimal numbers represents the color with the greatest amount of blue in it?

A100B0

#42. The two code segments below are each intended to display the average of the numbers in the list numList. Assume that numList contains more than one value. Which of the following best describes the two code segments?

Both code segments display the correct average, but code segment I requires more arithmetic operations than code segment II.

#49. A computer program uses 4 bits to represent nonnegative integers. Which of the following statements describe a possible result when the program uses this number representation? I. The operation 4 + 8 will result in an overflow error. II. The operation 7 + 10 will result in an overflow error. III. The operation 12 + 3 will result in an overflow error.

II only

#55. The procedure below searches for the value target in list. It returns true if target is found and returns false otherwise. Which of the following are true statements about the procedure? I. It implements a binary search. II. It implements a linear search. III. It only works as intended when list is sorted.

II only

#51. A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an infinite loop for that input. The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?

It is not possible to create an algorithm that will solve the problem for all programs and inputs.

#50. A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions correctly models a NAND gate with inputs P and Q ?

NOT (P AND Q)

#44. Which of the following explains a benefit of using open standards and protocols for Internet communication?

Open standards and protocols allow different manufacturers and developers to build hardware and software that can communicate with hardware and software on the rest of the network.

#38. A researcher wrote a program to simulate the number of mice in an environment that contains predators. The program uses the following procedures. Based on the code, which of the following assumptions is made in the simulation?

The number of predators does not change from day to day.

#52. In public key cryptography, the sender uses the recipient's public key to encrypt a message. Which of the following is needed to decrypt the message?

The recipient's private key

#58. Which of the following best describes the purpose of machine learning programs?

To analyze large data sets, recognize patterns, and make predictions based on data

#46. A programmer is writing a procedure to calculate a student's final grade in the course using the score replacement policy described. The student's exam scores are stored in the variables midtermExam and finalExam. The procedure Max (a, b) returns the larger of a and b. Which of the following could be used in the procedure to calculate a student's total points earned in the course and store the result in the variable adjustedTotal?

adjustedTotal ← Max (midtermExam, finalExam)

#30. A student wrote the following code for a guessing game. While debugging the code, the student realizes that the loop never terminates. The student plans to insert the instruction win←true somewhere in the code. Where could win←true be inserted so that the code segment works as intended?

between line 9 and 10

#43. A snack bar has a frequent customer program in which every 10th purchase is free. Customers are enrolled in the program when they make their first purchase. A programmer is writing a program to implement the frequent customer program. In one code segment, cost is set to 0 for every 10th purchase by a given customer. The programmer will use the procedure GetCount (customerID), which returns the total number of purchases a customer has made since enrolling in the frequent customer program, including his or her first purchase. Which of the following code segments will set cost to 0 for every 10th purchase a customer makes after enrolling in the frequent customer program?

count ← GetCount (customerID) IF (count Mod 10 = 0) { cost ← 0 }

#37. A flowchart is a way to visually represent an algorithm. The flowchart below is used by an apartment rentalWeb site to set the variable include to true for apartments that meet certain criteria. Which of the following statements is equivalent to the algorithm in the flowchart?

include ← (floor > 10) OR (bedrooms = 3)

#39. The latency of a network connection is most appropriately measured with which of the following units?

milliseconds

#47. Internet protocol version 4 (IPv4) represents each IP address as a 32-bit binary number. Internet protocol version 6 (IPv6) represents each IP address as a 128-bit binary number. Which of the following best describes the result of using 128-bit addresses instead of 32-bit addresses?

2^96 times as many addresses are available.

#31. A text-editing application uses binary sequences to represent each of 200 different characters. What is the minimum number of bits needed to assign a unique bit sequence to each of the possible characters?

8

#56. Which of the following is an example of symmetric encryption?

Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret key. Finn uses the key to write a message to Gwen where each letter is replaced with the corresponding symbol. Gwen uses the key to map each symbol back to the original letter.

#45. Q. The teacher has data representing the scores of thousands of students. For each student, the data contain the student name, the midterm exam score, the final exam score, and the result of the total points calculation. Which of the following could be determined from the data? I. The average total points earned per student II. The average increase in total points per student as a result of the score replacement policy III. The proportion of students who improved their total points as a result of the score replacement policy

I, II, and II

#57. A programmer is developing a word game. The programmer wants to create an algorithm that will take a list of words and return a list containing the first letter of all words that are palindromes (words that read the same backward or forward). The returned list should be in alphabetical order. For example, if the list contains the words ["banana", "kayak", "mom", "apple", "level"], the returned list would contain ["k", "l", "m"] (because "kayak", "level", and "mom" are palindromes). The programmer knows that the following steps are necessary for the algorithm but is not sure in which order they should be executed. Executing which of the following sequences of steps will enable the algorithm to work as intended? I. First shorten, then keep palindromes, then sort II. First keep palindromes, then shorten, then sort III. First sort, then keep palindromes, then shorten

II and III

#48. An online retailer uses an algorithm to sort a list of n items by price. The table below shows the approximate number of steps the algorithm takes to sort lists of different sizes. Based on the values in the table, which of the following best characterizes the algorithm for very large values of n ?

The algorithm runs in reasonable time.


संबंधित स्टडी सेट्स

Graded Potentials & Action Potentials

View Set

Chapters 33, 44, and 45 (for Quiz)

View Set

Grade 11 Biology - Diversity of Living Things

View Set

Anatomy 2 Lab Practical 2: Ch 42 Reproductive System Anatomy

View Set

GOVT 2305 - Ch. 11 - The Presidency

View Set

Ch 9 - Summarizing, Paraphrasing, Quoting, and Synthesizing Sources

View Set