CSP Exam Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

A person wants to transmit an audio file from a device to a second device. Which of the following scenarios best demonstrates the use of lossless compression of the original file? A A device compresses the audio file before transmitting it to a second device. The second device restores the compressed file to its original version before playing it. B A device compresses the audio file by removing details that are not easily perceived by the human ear. The compressed file is transmitted to a second device, which plays it. C A device transmits the original audio file to a second device. The second device removes metadata from the file before playing it. D A device transmits the original audio file to a second device. The second device plays the transmitted file as is.

A A device compresses the audio file before transmitting it to a second device. The second device restores the compressed file to its original version before playing it.

A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application's existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users. (note: 1 MB = 1,000 KB) Which of the following best describes the average amount of data stored per user for the first eight years of the application's existence? A Across all eight years, the average amount of data stored per user was about 10 GB. B Across all eight years, the average amount of data stored per user was about 100 GB. C The average amount of data stored per user appears to increase by about 10 GB each year. D The average amount of data stored per user appears to increase by about 100 GB each year.

A Across all eight years, the average amount of data stored per user was about 10 GB.

Which of the following best explains how IP addresses are assigned? A As a new device is connected to the Internet, it is assigned an IP address to enable communication on the network. B IP addresses are assigned only to servers that host Web sites; user devices do not require an IP address. C New devices are connected to the Internet without an IP address, but are eventually assigned an IP address once they can be verified by a certificate authority. D New devices are connected to the Internet without an IP address; IP addresses are assigned only for encrypted communications.

A As a new device is connected to the Internet, it is assigned an IP address to enable communication on the network.

A bookstore has a database containing information about each book for sale in the store. A sample portion of the database is shown below. AuthorTitleSelling PriceGenreQuantity AvailableJ. M. BarriePeter and Wendy$6.99Fantasy3L. Frank BaumThe Wonderful Wizard of Oz$7.99Fantasy2Arthur Conan DoyleThe Hound of the Baskervilles$7.49Mystery4Mary ShelleyFrankenstein$7.99Horror4Jules VerneTwenty Thousand Leagues Under the Sea$6.99Science Fiction3H. G. WellsThe War of the Worlds$4.99Science Fiction3 A store employee wants to calculate the total amount of money the store will receive if they sell all of the available science fiction books. Which columns in the database can be ignored and still allow the employee to perform this calculation? Select two answers. A Author B Title C Genre D Quantity Available

A Author B Title

Which of the following best describes the impact of Creative Commons? A Creative Commons gives creators of digital content the ability to indicate how their works can be legally used and distributed, enabling broad access to digital information. B Creative Commons gives Internet users the right to legally use and distribute any previously copyrighted work, enabling broad access to digital information. C Create Commons provides lossless transmission of messages, enabling reliable distribution of digital information. D Creative Commons provides private transmission of messages, enabling secure distribution of digital information.

A Creative Commons gives creators of digital content the ability to indicate how their works can be legally used and distributed, enabling broad access to digital information.

Consider the following procedure. Procedure CallExplanationDrawLine (x1, y1, x2, y2)Draws a line segment on a coordinate grid with endpoints at coordinates (x1, y1) and (x2, y2) The DrawLine procedure is to be used to draw the following figure on a coordinate grid. The following code segment is intended to draw the figure. 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? A DrawLine (startX, startY, endX, endY) endY ←← endY - 2 B DrawLine (startX, startY, endX, endY) endX ←← endX - 2 endY ←← endY - 2 C endY ←← endY - 2 DrawLine (startX, startY, endX, endY) D endX ←← endX - 2 endY ←← endY - 2 DrawLine (startX, startY, endX, endY)

A DrawLine (startX, startY, endX, endY) endY ←← endY - 2

A student's overall course grade in a certain class is based on the student's scores on individual assignments. The course grade is calculated by dropping the student's lowest individual assignment score and averaging the remaining scores. For example, if a particular student has individual assignment scores of 85, 75, 90, and 95, the lowest score (75) is dropped. The calculated course grade is (85+90+95)/3=90(85+90+95)/3=90. An administrator at the school has data about hundreds of students in a particular course. While the administrator does not know the values of each student's individual assignment scores, the administrator does have the following information for each student. The student name A unique student ID number The number of assignments for the course The average assignment score before the lowest score was dropped The course grade after the lowest score was dropped Which of the following CANNOT be determined from this data alone? A For a given student, the value of the highest assignment score B For a given student, the value of the lowest assignment score C For a given student, the change in course grade as a result of dropping the lowest score D The proportion of students who improved their course grade as a result of dropping the lowest score

A For a given student, the value of the highest assignment score

A biologist wrote a program to simulate the population of a sample of bacteria. The program uses the following procedures. Procedure CallExplanationInitialPopulation ()Returns the number of bacteria at the start of the simulationNextPopulation (currPop)Based on the current value of currPop, returns the number of bacteria after one hour Code for the simulation is shown below. hours ←← 0 startPop ←← InitialPopulation () currentPop ←← startPop REPEAT UNTIL ((hours ≥ 24) OR (currentPop ≤ 0)) { currentPop ←← NextPopulation (currentPop) hours ←← hours + 1 } DISPLAY (currentPop - startPop) Which of the following are true statements about the simulation? The simulation continues until either 24 hours pass or the population reaches 0. The simulation displays the average change in population per hour over the course of the simulation. The simulation displays the total population at the end of the simulation. A I only B II only C III only D I and II

A I only

Assume that the Boolean variable x is assigned the value true and the Boolean variable y is assigned the value false. Which of the following will display the value true ? Select two answers. A B C D

A IF x Display x or y B IF y or x Display x

A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table. Each value is represented in decimal (base 10). Color NameRGB Tripletindigo (75, 0, 130)ivory(255, 255, 240)light pink(255, 182, 193)​light yellow(255, 255, 224)magenta(255, 0, 255)neutral gray(127, 127, 112)pale yellow(255, 255, 160)vivid yellow(255, 255, 14) According to information in the table, what color is represented by the binary RGB triplet (11111111, 11111111, 11110000) ? A Ivory B Light yellow C Neutral gray D Vivid yellow

A Ivory

In mathematics, a perfect number is a type of integer. The procedure IsPerfect (num) returns true if num is a perfect number and returns false otherwise. The following program is intended to count and display the number of perfect numbers between the integers start and end, inclusive. Assume that start is less than end. The program does not work as intended. Line 1: currentNum ←← start Line 2: count ←← 0 Line 3: REPEAT UNTIL (currentNum > end) Line 4: { Line 5: count ←← count + 1 Line 6: IF (IsPerfect (currentNum)) Line 7: { Line 8: count ←← count + 1 Line 9: currentNum ←← currentNum + 1 Line 10: } Line 11: currentNum ←← currentNum + 1 Line 12: } Line 13: DISPLAY (count) Which two lines of code should be removed so that the program will work as intended? Select two answers. A Line 5 B Line 8 C Line 9 D Line 11

A Line 5 C Line 9

Consider the two programs below. Which of the following best compares the values displayed by programs A and B? A Program A and program B display identical values in the same order. B Program A and program B display the same values in different orders. C Program A and program B display the same number of values, but the values differ. D Program B displays one more value than program A.

A Program A and program B display identical values in the same order.

The following algorithm is intended to determine the average height, in centimeters, of a group of people in a room. Each person has a card, a pencil, and an eraser. Step 2 of the algorithm is missing. Step 1: All people stand up. Step 2: (missing step) Step 3: Each standing person finds another standing person and they form a pair. If a person cannot find an unpaired standing person, that person remains standing and waits until the next opportunity to form pairs. Step 4: In each pair, one person hands their card to the other person and sits down. Step 5: At this point, the standing person in each pair is holding two cards. The standing person in each pair replaces the top number on their card with the sum of the top numbers on the two cards and replaces the bottom number on their card with the sum of the bottom numbers on the two cards. The sitting partner's card is discarded. Step 6: Repeat steps 3-5 until there is only one person standing. Step 7: The last person standing divides the top number by the bottom number to determine the average height. Which of the following can be used as step 2 so that the algorithm works as intended? A Step 2: Each person writes their height, in centimeters, at the top of the card and writes the number 1 at the bottom of the card. B Step 2: Each person writes their height, in centimeters, at the top of the card and writes the number 2 at the bottom of the card. C Step 2: Each person writes the number 1 at the top of the card and writes their height, in centimeters, at the bottom of the card. D Step 2: Each person writes the number 2 at the top of the card and writes their height, in centimeters, at the bottom of the card.

A Step 2: Each person writes their height, in centimeters, at the top of the card and writes the number 1 at the bottom of the card.

A group of planners are using a simulation to examine whether or not a park that they are designing is going to affect foot traffic in the area. The simulation uses a model that includes input variables for the park such as the number of entrances, sidewalks, and bike trails and the square footage of open space (grassy areas). The simulation can then be run multiple times using different values for the input variables to represent different park designs. However, the simulation takes a very long time to run. The planners update the model by removing some variables they consider less important than others. Of the following, which is the most likely effect the updated model will have on the simulation? A The updated model is likely to decrease the runtime of the simulation because the time required for simulations generally depends on the complexity of the model used. B The updated model is likely to decrease the runtime of the simulation because simulations that use older models tend to require more time to run than simulations that use newer models. C The updated model is unlikely to decrease the runtime of the simulation because the simulation is computationally complex, regardless of the model used. D The updated model is unlikely to provide any benefit because removing details from a model will compromise the accuracy of the simulation.

A The updated model is likely to decrease the runtime of the simulation because the time required for simulations generally depends on the complexity of the model used.

The procedure NumOccurrences is intended to count and return the number of times targetWord appears in the list wordList. The procedure does not work as intended. For which of the following code segments will the call to NumOccurrences NOT return the intended value? Select two answers.

A treeList<--birch, maple, birch numOccurances [treeList, birch] B treeList<--birch, maple, oak numOccurances [treeList, maple]

Which of the following actions are likely to be helpful in reducing the digital divide? Select two answers. A Designing new technologies intended only for advanced users B Designing new technologies to be accessible to individuals with different physical abilities C Implementing government regulations restricting citizens' access to Web content D Having world governments support the construction of network infrastructure

B Designing new technologies to be accessible to individuals with different physical abilities D Having world governments support the construction of network infrastructure

Assume that the variables alpha and beta each are initialized with a numeric value. Which of the following code segments can be used to interchange the values of alpha and beta using the temporary variable temp ? A I and II only B I and III only C II and III only D I, II, and III

B I and III only

Internet protocol version 6 (IPv6) has been introduced to replace the previous version (IPv4). Which of the following best describes a benefit of IPv6 over IPv4? A IPv6 addresses are shorter than IPv4 addresses, which allows for faster routing of packets. B IPv6 allows for a greater number of addresses than IPv4, which allows more devices to be connected to the Internet. C IPv6 eliminates the use of hierarchy in addressing, making addresses easier to use. D IPv6 allows users to bypass older security protocols so that data can be sent peer-to-peer without the use of

B IPv6 allows for a greater number of addresses than IPv4, which allows more devices to be connected to the Internet.

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? Select two answers. A B C D

B Multiply [2, -5] D Multiply [-2, -5]

A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application's existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users. (note: 1 MB = 1,000 KB) Which of the following observations is most consistent with the information in the circle graph? A Over 75% of the files stored are 1 MB in size or less. B Over 75% of the files stored are 10 MB in size or less. C Over 75% of the files stored are at least 100 KB in size. D Over 75% of the files stored are at least 1 MB in size.

B Over 75% of the files stored are 10 MB in size or less.

A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. Procedure MaxTwo (x, y) returns the greater of its two integer parameters. Procedure MaxThree (x, y, z) returns the greatest of its three integer parameters. Which of the following procedures is a generalization of the MaxTwo and MaxThree procedures? A Procedure Min (x, y), which returns the lesser of its two integer parameters B Procedure Max (numList), which returns the maximum value in the list of integers numList C Procedure MaxFour (w, x, y, z), which returns the greatest of its four integer parameters D Procedure OverMax (numList, max), which returns the number of integers in numList that exceed the integer value max

B Procedure Max (numList), which returns the maximum value in the list of integers numList

The grid below contains a robot represented as a triangle, initially facing right. The robot can move into a white or gray square but cannot move into a black region. The code segment below uses the procedure GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise. REPEAT UNTIL (GoalReached ()) { <MISSING CODE> } Which of the following replacements for <MISSING CODE> can be used to move the robot to the gray square? A REPEAT UNTIL (CAN_MOVE (forward) = false) { ROTATE_RIGHT () } MOVE_FORWARD () B REPEAT UNTIL (CAN_MOVE (forward) = false) { MOVE_FORWARD () } ROTATE_RIGHT () C REPEAT UNTIL (CAN_MOVE (right)) { ROTATE_RIGHT () } MOVE_FORWARD () D REPEAT UNTIL (CAN_MOVE (right)) { MOVE_FORWARD () } ROTATE_RIGHT ()

B REPEAT UNTIL (CAN_MOVE (forward) = false) { MOVE_FORWARD () } ROTATE_RIGHT ()

The following algorithm is intended to take a positive integer as input and display its individual digits in order from right to left. For example, if the input is 512, the algorithm should produce the output 2 1 5. Step 3 of the algorithm is missing. Step 1: Input a positive integer from the user and store it in the variable number. Step 2: Divide number by 10 and record the integer quotient and the remainder. The integer quotient is the quotient with any part after the decimal point dropped. For example, when 127 is divided by 10, the quotient is 12.7, the integer quotient is 12 and the remainder is 7. Step 3: (missing step) Step 4: Repeat steps 2 and 3 until number is 0. Which of the following can be used as step 3 so that the algorithm works as intended? A Step 3: Display the remainder of number divided by 10 and store the remainder in number. B Step 3: Display the remainder of number divided by 10 and store the integer quotient in number. C Step 3: Display the integer quotient of number divided by 10 and store the remainder in number. D Step 3: Display the integer quotient of number divided by 10 and store the integer quotient in number.

B Step 3: Display the remainder of number divided by 10 and store the integer quotient in number.

Consider the following program. Which of the following describes the result of executing the program? A The program displays the sum of the even integers from 2 to 10. B The program displays the sum of the even integers from 2 to 20. C The program displays the sum of the odd integers from 1 to 9. D The program displays the sum of the odd integers from 1 to 19.

B The program displays the sum of the even integers from 2 to 20.

A library system contains information for each book that was borrowed. Each time a person borrows or returns a book from the library, the following information is recorded in a database. Name and the unique ID number of the person who was borrowing the book Author, title, and the unique ID number of the book that was borrowed Date that the book was borrowed Date that the book was due to be returned Date that the book was returned (or 0 if the book has not been returned yet) Which of the following CANNOT be determined from the information collected by the system? A The total number of books borrowed in a given year B The total number of books that were never borrowed in a given year C The total number of books that were returned past their due date in a given year D The total number of people who borrowed at least one book in a given year

B The total number of books that were never borrowed in a given year

The figure below shows two possible network configurations for devices P through V. A line between two devices indicates a connection. Devices can communicate only through the connections shown. In configuration I, what is the minimum number of connections that must be broken or removed before device T can no longer communicate with device U? A One B Two C Three D Four

B Two

A program contains 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".Substring (str, start, length)Returns a substring of consecutive characters from str, starting with the character at position start and containing length characters. The first character of str is located at position 1. For example, Substring ("delivery", 3, 4) returns "live". Which of the following can be used to store the string "jackalope" in the string variable animal ? Select two answers. A animal ←← Substring ("antelope", 5, 4) animal ←← Concat (animal, "a") animal ←← Concat (Substring ("jackrabbit", 1, 4), animal) B animal ←← Substring ("antelope", 5, 4) animal ←← Concat ("a", animal) animal ←← Concat (Substring ("jackrabbit", 1, 4), animal) C animal ←← Substring ("jackrabbit", 1, 4) animal ←← Concat (animal, "a") animal ←← Concat (animal, Substring ("antelope", 5, 4)) D animal ←← Substring ("jackrabbit", 1, 4) animal ←← Concat (animal, "a") animal ←← Concat (Substring ("antelope", 5, 4), animal)

B animal ←← Substring ("antelope", 5, 4) animal ←← Concat ("a", animal) animal ←← Concat (Substring ("jackrabbit", 1, 4), animal) C animal ←← Substring ("jackrabbit", 1, 4) animal ←← Concat (animal, "a") animal ←← Concat (animal, Substring ("antelope", 5, 4))

Ticket prices for a science museum are shown in the following table. Type of TicketGeneral Admission Cost(in dollars)Guided Tour Cost(in dollars)Regular (ages 13 and up)810Child (ages 12 and below)68 A programmer is creating an algorithm to display the cost of a ticket based on the information in the table. The programmer uses the integer variable age for the age of the ticket recipient. The Boolean variable includesTour is true when the ticket is for a guided tour and is false when the ticket is for general admission. Which of the following code segments correctly displays the cost of a ticket? A cost ←← 6 IF ((age > 12) OR includesTour) { cost ←← cost + 2 } DISPLAY (cost) B cost ←← 6 IF (age > 12) { cost ←← cost + 2 } IF (includesTour) { cost ←← cost + 2 } DISPLAY (cost) C cost ←← 6 IF (age > 12) { IF (includesTour) { cost ←← cost + 2 } } DISPLAY (cost) D cost ←← 6 IF (age > 12) { cost ←← cost + 2 } ELSE { IF (includesTour) { cost ←← cost + 2 } } DISPLAY (cost)

B cost ←← 6 IF (age > 12) { cost ←← cost + 2 } IF (includesTour) { cost ←← cost + 2 } DISPLAY (cost)

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing toward the top of the grid. Consider the procedure below. Which of the following code segments will move the robot to the gray square along the path indicated by the arrows? A B C D

BotMover[1] BotMover[3] BotMover[0]

A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table. Each value is represented in decimal (base 10). Color NameRGB Tripletindigo (75, 0, 130)ivory(255, 255, 240)light pink(255, 182, 193)​light yellow(255, 255, 224)magenta(255, 0, 255)neutral gray(127, 127, 112)pale yellow(255, 255, 160)vivid yellow(255, 255, 14) What is the binary RGB triplet for the color indigo? A (00100101, 00000000, 10000010) B (00100101, 00000000, 01000001) C (01001011, 00000000, 10000010) D (01001011, 00000000, 01000001)

C (01001011, 00000000, 10000010)

Consider the following program. Which of the following expressions represents the value stored in the variable x as a result of executing the program? A 2 * 3 * 3 * 3 B 2 * 4 * 4 * 4 C 2 * 3 * 3 * 3 * 3 D 2 * 4 * 4 * 4 * 4

C 2 * 3 * 3 * 3 * 3

An office uses an application to assign work to its staff members. The application uses a binary sequence to represent each of 100 staff members. What is the minimum number of bits needed to assign a unique bit sequence to each staff member? A 5 B 6 C 7 D 8

C 7

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 true ? A A = true, B = true, C = true, D = false B A = true, B = false, C = false, D = true C A = false, B = true, C = true, D = true D A = false, B = false, C = true, D = true

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

A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowdsourcing? A A mobile application and collar that uses GPS technology to determine the pet's location and transmits the location when the owner refreshes the application B A mobile application and collar that uses wireless technology to determine whether the pet is within 100 feet of the owner's phone and transmits a message to the owner when the pet is nearby C A mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application D A mobile application that transmits a message to all users any time a lost pet is returned to its owner

C A mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application

Which of the following scenarios best exemplifies a phishing attack? A A user connects to a public wireless network. An unauthorized individual intercepts data transmitted on the network, looking for private information that can be used to gain access to the user's accounts. B A user's e-mail account is overwhelmed with messages containing large attachments, which causes the account to exceed the maximum amount of data allowed and temporarily prevents the user from sending and receiving new messages. C A user receives an e-mail from a sender offering technical help with the user's computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user's computer. D A user chooses a weak password for an online account. An unauthorized individual successfully guesses the user's password from a list of common passwords.

C A user receives an e-mail from a sender offering technical help with the user's computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user's computer.

The following procedure is intended to return true if at least two of the three parameters are equal in value and is intended to return false otherwise. PROCEDURE AnyPairs (x, y, z) { IF (x = y) { RETURN (true) } ELSE { RETURN (y = z) } } For which of the following procedure calls does the procedure NOT return the intended value? A AnyPairs ("bat", "cat", "rat") B AnyPairs ("bat", "bat", "rat") C AnyPairs ("bat", "cat", "bat") D AnyPairs ("bat", "cat", "cat")

C AnyPairs ("bat", "cat", "bat")

The figure below shows two possible network configurations for devices P through V. A line between two devices indicates a connection. Devices can communicate only through the connections shown. In which of the configurations is it possible to have redundant routing between devices Q and V? A Configuration I only B Configuration II only C Both configuration I and configuration II D Neither configuration I nor configuration II

C Both configuration I and configuration II

The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom left square of the grid and facing right. The following programs are each intended to move the robot to the gray square. Program II uses the procedure GoalReached, which returns true if the robot is in the gray square and returns false otherwise. Which of the following statements best describes the correctness of the programs? A Program I correctly moves the robot to the gray square, but program II does not. B Program II correctly moves the robot to the gray square, but program I does not. C Both program I and program II correctly move the robot to the gray square. D Neither program I nor program II correctly moves the robot to the gray square.

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

Assume that the list originalList contains integer values and that the list newList is initially empty. The following code segment is intended to copy all even numbers from originalList to newList so that the numbers in newList appear in the same relative order as in originalList. The code segment may or may not work as intended. Line 1: FOR EACH number IN originalList Line 2: { Line 3: IF (number MOD 2 = 0) Line 4: { Line 5: INSERT (newList, 1, number) Line 6: } Line 7: } Which of the following changes, if any, can be made so that the code segment works as intended? A Changing line 1 to FOR EACH number IN newList B Changing line 3 to IF (number MOD 2 = 1) C Changing line 5 to APPEND (newList, number) D No change is needed; the code segment is correct as is.

C Changing line 5 to APPEND (newList, number)

Flight simulation software, which imitates the experience of flying, is often used to train airline pilots. Which of the following is LEAST likely to be an advantage of using flight simulation software for this purpose? A Flight simulation software allows pilots to practice landing in a variety of different terrains and weather conditions without having to physically travel. B Flight simulation software could save money due to the cost of maintenance and fuel for actual training flights. C Flight simulation software provides a more realistic experience for pilots than actual training flights. D Flight simulation software allows for the testing of emergency air situations without serious consequences.

C Flight simulation software provides a more realistic experience for pilots than actual training flights.

A photographer has a collection of digital pictures, each using the same file-naming format: a date tag, followed by a description, followed by the file extension ".jpg". The photographer wants to write a code segment to extract the description from each file name, as shown in the following table. Original File NameExtracted Description2016-05-22-Andrews-Graduation.jpgAndrews-Graduation2016-07-04-Fireworks.jpgFireworks​2017-10-18-Grandmas-Birthday.jpgGrandmas-Birthday The photographer has the following procedures available. Procedure CallExplanation​TrimLeft (str, n)Returns a copy of the string str with the n leftmost characters removed. For example, TrimLeft ("keyboard", 3) returns "board".TrimRight (str, n)Returns a copy of the string str with the n rightmost characters removed. For example, TrimRight ("keyboard", 3) returns "keybo". Let an original file name be stored in the string variable original. Which of the following statements will correctly extract the description and store it in the string variable descr ? descr ←← TrimLeft (TrimRight (original, 4), 11) descr ←← TrimLeft (TrimRight (original, 11), 4) descr ←← TrimRight (TrimLeft (original, 11), 4) A I only B II only C I and III D II and III

C I and III

Which of the following statements correctly explain how the Internet is able to facilitate communication at a large scale? A central monitoring computer is used to track and maintain the connections of the Internet. Data is routed between points in multiple ways so that if a connection fails, the data can be rerouted around the inoperative connections. Protocols for packets and routing are used so that computers from different manufacturers can communicate in a standard way. A I and II only B I and III only C II and III only D I, II, and III

C II and III only

Assume that the list of numbers nums has more than 10 elements. The program below is intended to compute and display the sum of the first 10 elements of nums. Line 1: i ←← 1 Line 2: sum ←← 0 Line 3: REPEAT UNTIL (i > 10) Line 4: { Line 5: i ←← i + 1 Line 6: sum ←← sum + nums[i] Line 7: } Line 8: DISPLAY (sum) Which change, if any, is needed for the program to work as intended? A Lines 1 and 2 should be interchanged. B Line 3 should be changed to REPEAT UNTIL (i ≥ 10). C Lines 5 and 6 should be interchanged. D No change is needed; the program works correctly.

C Lines 5 and 6 should be interchanged.

An Internet user has a need to send private data to another user. Which of the following provides the most security when transmitting private data? A Certifying the data with a Creative Commons license before sending it B Sending the data using a high-bandwidth connection C Sending the data using public-key encryption D Sending the data using redundant routing

C Sending the data using public-key encryption

A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application's existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users. (note: 1 MB = 1,000 KB) Which of the following best describes the growth in the number of registered users for the first eight years of the application's existence? A The number of registered users increased at about a constant rate each year for all eight years. B The number of registered users increased at about a constant rate for years 1 to 5 and then about doubled each year after that. C The number of registered users about doubled each year for years 1 to 5 and then increased at about a constant rate after that. D The number of registered users about doubled each year for all eight years.

C The number of registered users about doubled each year for years 1 to 5 and then increased at about a constant rate after that.

Which of the following is NOT an advantage of using open-source software? A Open-source software is generally free or lower in cost than commercially available software. B The availability of source code makes it possible to customize open-source software to a user's individual needs. C The original developer of open-source software provides free or low-cost support for users installing and running the software. D Unlike commercial software, which can become obsolete when the company that created it goes out of business, open-source software can be updated without the involvement of the original programmers.

C The original developer of open-source software provides free or low-cost support for users installing and running the software.

In a certain computer program, two positive integers are added together, resulting in an overflow error. Which of the following best explains why the error occurs? A The program attempted to perform an operation that is considered an undecidable problem. B The precision of the result is limited due to the constraints of using a floating-point representation. C The program can only use a fixed number of bits to represent integers; the computed sum is greater than the maximum representable value. D The program cannot represent integers; the integers are converted into decimal approximations, leading to rounding errors.

C The program can only use a fixed number of bits to represent integers; the computed sum is greater than the maximum representable value.

The procedure BinarySearch (numList, target) correctly implements a binary search algorithm on the list of numbers numList. The procedure returns an index where target occurs in numList, or -1 if target does not occur in numList. Which of the following conditions must be met in order for the procedure to work as intended? A The length of numList must be even. B The list numList must not contain any duplicate values. C The values in numList must be in sorted order. D The value of target must not be equal to -1.

C The values in numList must be in sorted order.

The transmission control protocol (TCP) and Internet protocol (IP) are used in Internet communication. Which of the following best describes the purpose of these protocols? A To ensure that communications between devices on the Internet are above a minimum transmission speed B To ensure that private data is inaccessible to unauthorized devices on the Internet C To establish a common standard for sending messages between devices on the Internet D To validate the ownership of encryption keys used in Internet communication

C To establish a common standard for sending messages between devices on the Internet

A student purchases a single-user license of a copyrighted application and wants other students to be able to use it at the same time. Under which of the following conditions is it considered acceptable for the student to share the application? A When the application is shared only with students at the same school B When the application is shared on a peer-to-peer network C When the student gets permission from the copyright owner of the application D When the student makes a copy of the application for another student to use only once

C When the student gets permission from the copyright owner of the application

A programmer wants to determine whether a score is within 10 points of a given target. For example, if the target is 50, then the scores 40, 44, 50, 58, and 60 are all within 10 points of the target, while 38 and 61 are not. Which of the following Boolean expressions will evaluate to true if and only if score is within 10 points of target ? A (score ≤ target + 10) AND (target + 10 ≤ score) B (target + 10 ≤ score) AND (score ≤ target - 10) C (score ≤ target - 10) AND (score ≤ target + 10) D (target - 10 ≤ score) AND (score ≤ target + 10)

D (target - 10 ≤ score) AND (score ≤ target + 10)

Which of the following best explains how a certificate authority is used in protecting data? A A certificate authority certifies the safety of a particular Web site so that users know that it does not contain any viruses. B A certificate authority issues passwords that grant access to secure databases. C A certificate authority maintains a secure database that maps all Web domain names to the IP addresses of the servers where the sites are hosted. D A certificate authority verifies the authenticity of encryption keys used in secured communications.

D A certificate authority verifies the authenticity of encryption keys used in secured communications.

A list of binary values (0 or 1) is used to represent a black-and-white image. Which of the following is LEAST likely to be stored as metadata associated with the image? A Copyright information for the image B The date and time the image was created C The dimensions (number of rows and columns of pixels) of the image D A duplicate copy of the data

D A duplicate copy of the data

Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. An algorithm that accesses each element in the list twice An algorithm that accesses each element in the list n times An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list Which of the algorithms run in reasonable time? A I only B III only C I and II only D I, II, and III

D I, II, and III

Which of the following actions are generally helpful in program development? Consulting potential users of the program to identify their concerns Writing and testing small code segments before adding them to the program Collaborating with other individuals when developing a large program A I and II only B I and III only C II and III only D I, II, and III

D I, II, and III

Which of the following can be represented by a sequence of bits? An integer An alphanumeric character A machine language instruction A I only B III only C I and II only D I, II, and III

D I, II, and III

A student wrote the following program to remove all occurrences of the strings "the" and "a" from the list wordList. Line 1: index ←← LENGTH (wordList) Line 2: REPEAT UNTIL (index < 1) Line 3: { Line 4: IF ((wordList[index] = "the") OR (wordList[index] = "a")) Line 5: { Line 6: REMOVE (wordList, index) Line 7: } Line 8: } 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 D Inserting index ←← index - 1 between lines 7 and 8

D Inserting index ←← index - 1 between lines 7 and 8

Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or all tails) the player wins. Otherwise, the player loses. Which of the following code segments best simulates the behavior of the game?

D Sum <--- 0 Repeat 3 times sum<---- sum + Random[0,1]

A small team of wildlife researchers is working on a project that uses motion-activated field cameras to capture images of animals at study sites. The team is considering using a "citizen science" approach to analyze the images. Which of the following best explains why such an approach is considered useful for this project? A Distributed individuals are likely to be more accurate in wildlife identification than the research team. B The image analysis is likely to be more consistent if completed by an individual citizen. C The image analysis is likely to require complex research methods. D The image analysis is likely to take a longer time for the research team than for a distributed group of individuals.

D The image analysis is likely to take a longer time for the research team than for a distributed group of individuals.

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. B Large-scale problems require a crowdsourcing model, which is limited by the number of people available to work on the problem. C The ability of a computer to solve a problem is limited by the bandwidth of the computer's Internet connection. D There exist some problems that cannot be solved using any algorithm.

D There exist some problems that cannot be solved using any algorithm.

An online game collects data about each player's performance in the game. A program is used to analyze the data to make predictions about how players will perform in a new version of the game. The procedure GetPrediction (idNum) returns a predicted score for the player with ID number idNum. Assume that all predicted scores are positive. The GetPrediction procedure takes approximately 1 minute to return a result. All other operations happen nearly instantaneously. Two versions of the program are shown below. Version I topScore ←← 0 idList ←← [1298702, 1356846, 8848491, 8675309] FOR EACH id IN idList { score ←← GetPrediction (id) IF (score > topScore) { topScore ←← score } } DISPLAY (topScore) Version II idList ←← [1298702, 1356846, 8848491, 8675309] topID ←← idList[1] FOR EACH id IN idList { IF (GetPrediction (id) > GetPrediction (topID)) { topID ←← id } } DISPLAY (GetPrediction (topID)) Which of the following best compares the execution times of the two versions of the program? A Version I requires approximately 1 more minute to execute than version II. B Version I requires approximately 5 more minutes to execute than version II. C Version II requires approximately 1 more minute to execute than version I. D Version II requires approximately 5 more minutes to execute than version I.

D Version II requires approximately 5 more minutes to execute than version I.

A student's overall course grade in a certain class is based on the student's scores on individual assignments. The course grade is calculated by dropping the student's lowest individual assignment score and averaging the remaining scores. For example, if a particular student has individual assignment scores of 85, 75, 90, and 95, the lowest score (75) is dropped. The calculated course grade is (85+90+95)/3=90(85+90+95)/3=90. A programmer is writing a program to calculate a student's course grade using the process described. The programmer has the following procedures available. Procedure CallExplanationMin (numList)Returns the minimum value in the list numListSum (numList)Returns the sum of the values in the list numList The student's individual assignment scores are stored in the list scores. Which of the following can be used to calculate a student's course grade and store the result in the variable finalGrade? A finalGrade ←← Sum (scores) / LENGTH (scores) finalGrade ←← finalGrade - Min (scores) B finalGrade ←← Sum (scores) / (LENGTH (scores) - 1) finalGrade ←← finalGrade - Min (scores) C finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / LENGTH (scores) D finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / (LENGTH (scores) - 1)

D finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / (LENGTH (scores) - 1)

Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60). The programmer has the following procedures available. Procedure CallExplanationCombine (myList1, myList2)This procedure creates a new list containing the elements from myList1 ​followed by the entries from myList2. The resulting list is returned. For example, if myList1 contains [2, 4, 6] and myList2 contains [1, 5], the procedure will return the list [2, 4, 6, 1, 5].RemoveAllDups (myList)This procedure creates a new list containing the elements of myList with any duplicate values removed. The resulting list is returned. For example, if myList contains [3, 2, 4, 2, 2, 5, 6, 4], the procedure will return the list [3, 2, 4, 5, 6]. Which of the following can be used to assign the intended value to count ? A bothList ←← Combine (list1, list2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList) B newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) count ←← LENGTH (list1) + LENGTH (list2) - LENGTH (bothList) C newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) count ←← LENGTH (newList1) + LENGTH (newList2) - LENGTH (bothList) D newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList)

D newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList)

n the following program, assume that the variable n has been initialized with an integer value. Which of the following is NOT a possible value displayed by the program? A too high B in range C too low D out of range

D out of range

An algorithm is intended to display the following output. red red blue red red blue red red blue Which of the following code segments can be used to display the intended output?

Repeat 3 times Repeat 2 times Display "red" Display "blue"

A flowchart is a way to visually represent an algorithm. The flowchart below is used by an application to set the Boolean variable available to true under certain conditions. The flowchart uses the Boolean variable weekday and the integer variable miles. BlockExplanationOvalThe start or end of the algorithmDiamondA conditional or decision step, where execution proceeds to the side labeled true if the condition is true and to the side labeled false otherwiseRectangleOne or more processing steps, such as a statement that assigns a value to a variable Which of the following statements is equivalent to the algorithm in the flowchart? A B C D

avaiable <---weekday AND miles < 20

Consider the following spinner, which is used to determine how pieces are to be moved on a game board. The region labeled "Move 1 space" is six times as large as each of the other two regions. Which of the following code segments can be used to simulate the behavior of the spinner? A B C D

spin<--- random 1, 8 If spin = 1 DIsplay "lose a turn" Else If spin = 2 Display "Move two spaces" Else Display "Move one space"


Kaugnay na mga set ng pag-aaral

Real Estate Investment Trusts (REIT)

View Set

section 7 unit 1: A Brief History of Agency

View Set

Information Systems Management - C724 (Set 1)

View Set

Geometry - (Points, Lines, Planes, Rays, Segments)

View Set

HTML5 forms, usability, and accessibility

View Set

Chapter 5 GDP (Gross Domestic Production) Quiz

View Set