ap csp midterm
Which of the following actions is most likely to raise legal or ethical concerns?
A musician creates a song using samples of a copyrighted work and then uses a Creative Commons license to publish the song.
If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
Better late than never.
Directions: For the question or incomplete statement below, two of the suggested answers are correct. For this question, you must select both correct choices to earn credit. No partial credit will be earned if only one correct choice is selected. Select the two that are best in each case. Researchers have developed a simulation of packets traveling between server computers and client computers in a network. Of the following, which two outcomes are most likely to be results of the simulation? Select two answers.
Better understanding of the effect of temporarily unavailable network connections and Better understanding of the impact of increased connection speeds for frequently visited servers
In a certain game, the integer variable bonus is assigned a value based on the value of the integer variable score. If score is greater than 100, bonus is assigned a value that is 10 times score. If score is between 50 and 100 inclusive, bonus is assigned the value of score. If score is less than 50, bonus is assigned a value of 0. Which of the following code segments assigns bonus correctly for all possible integer values of score ? Select two answers.
IF(score > 100) { bonus ←← score * 10 } ELSE { IF(score ≥ 50) { bonus ←← score } ELSE { bonus ←← 0 } } and IF(score < 50) { bonus ←← 0 } ELSE { IF(score > 100) { bonus ←← score * 10 } ELSE { bonus ←← score } }
Consider the following code segment, where exam and presentation are integer variables and grade is a string variable. IF((exam > 90) AND (presentation > 80)) { grade ← "A" } IF((exam > 80) OR (presentation > 75)) { grade ← "B" } ELSE { IF((exam > 70) OR (presentation > 60)) { grade ← "C" } ELSE { IF(exam > 60) { grade ← "D" } ELSE { grade ← "F" } } } Under which of the following conditions will the value "C" be assigned to the variable grade ?
When the value of exam is 80 and the value of presentation is 60
Which of the following is a primary reason for the use of open protocols on the Internet?
Open protocols provide a way to standardize data transmission between different devices.
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?
REPEAT 2 TIMES
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?
Step 1: Assign each student a unique integer from 1 to 30. Step 2: Generate a random integer n from 1 to 30. Step 3: Select the student who is currently assigned integer n and display the student's name. Step 4: The student who was selected in the previous step is assigned 0. All other students are reassigned a unique integer from 1 to 29. Step 5: Generate a new random integer n from 1 to 29. Step 6: Select the student who is currently assigned integer n and display the student's name.
Consider the following procedures for string manipulation. Procedure CallExplanationconcat(str1, str2)Returns a single string consisting of str1 followed by str2. For example, concat("key", "board") returns "keyboard".reverse(str)Returns the reverse of the string str. For example, reverse("abcd") returns "dcba". Which of the following code segments can be used to store "noon" in the string variable word ?
word ← "on" word ← concat(reverse(word), word)
To qualify for a particular scholarship, a student must have an overall grade point average of 3.0 or above and must have a science grade point average of over 3.2. Let overallGPA represent a student's overall grade point average and let scienceGPA represent the student's science grade point average. Which of the following expressions evaluates to true if the student is eligible for the scholarship and evaluates to false otherwise?
(overallGPA ≥ 3.0) AND (scienceGPA > 3.2)
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?
2^32 times as many values can be represented.
A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory?
Four bits are enough to store the eight directions.
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?
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.
Which of the following is a primary benefit of making a computing system fault-tolerant?
If one component of the system fails, users of the system can often still access it.
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?
If score A>score B If score A>score C
Consider the following code segment with integer variables x and y. https://assets.learnosity.com/organisations/537/VR167931.g01.png 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?
THREE
Which of the following is a characteristic of the fault-tolerant nature of routing on the Internet?
The ability to provide data transmission even when some connections have failed
The diagram below shows a circuit composed of two logic gates labeled OR and AND. Each gate takes two inputs and produces a single output. https://assets.learnosity.com/organisations/537/media.academicmerit.com/72e3f218e69069f68780e971f204bd51/original.png If the inputs A and C are both true, which of the following best describes the output of the AND gate?
The output will be true no matter what the value of input B is.
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com?
about.example.com