AP computer science Final exam

¡Supera tus tareas y exámenes ahora con Quizwiz!

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.

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?

7

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 duplicate copy of the data

Which of the following best explains how an analog audio signal is typically represented by a computer?

An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.

A smartphone stores the following data for each photo that is taken using the phone. The file name of the photo The date and time the photo was taken The geographic location where the photo was taken Assume that all of the photos that have been taken on the phone are accessible. Which of the following can be determined using the photo data described above? I. The number of photos that were taken at a particular geographic locationII. The number of photos that were taken in the last yearIII. The name of the person who took the most recent photo

I and II only

ASCII is a character-encoding scheme that uses 7 bits to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table below.

J. 74

A binary number is to be transformed by appending three 0s to the end of the number. For example, 11101 is transformed to 11101000. Which of the following correctly describes the relationship between the transformed number and the original number?

The transformed number is 8 times the value of the original number.

ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter "G" is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table below.

V/86

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?

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

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.

Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters. For example, the string THIS_IS_THE_BEST_WISH can be encoded as by replacing all instances of with and replacing all instances of with . For which of the following strings is it NOT possible to use byte pair encoding to shorten the string's length?

LEVEL_UP

A researcher wrote a program to simulate the number of mice in an environment that contains predators. The program uses the following procedures. Code for the simulation is shown below.

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

Which of the following can be represented by a single binary digit? Select two answers.

The remainder when dividing a whole number by 2 The value of a Boolean variable

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

Consider the 4-bit binary numbers 0011, 0110, and 1111. Which of the following decimal values is NOT equal to one of these binary numbers?

9

Which of the following is an advantage of a lossless compression algorithm over a lossy compression algorithm?

A lossless compression algorithm can guarantee reconstruction of original data, while a lossy compression algorithm cannot.

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?

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

A certain programming language uses 4-bit binary sequences to represent nonnegative integers. For example, the binary sequence 0101 represents the corresponding decimal value 5. Using this programming language, a programmer attempts to add the decimal values 14 and 15 and assign the sum to the variable total. Which of the following best describes the result of this operation?

An overflow error will occur because 4 bits is not large enough to represent 29, the sum of 14 and 15.

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.

Author B Title

A database of information about shows at a concert venue contains the following information. Name of artist performing at the show Date of show Total dollar amount of all tickets sold Which of the following additional pieces of information would be most useful in determining the artist with the greatest attendance during a particular month?

Average ticket price

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. Which of the following code segments will move the robot to the gray square along the path indicated by the arrows?

BOTMOVER 1 BOTMOVER 3 BOTMOVER 0

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. procedure below: Proceedure Botmover X Move forwad Repeat x times Rotate__Right Move Forward

BotMover 1 Botmover 3 Botmover 0

Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters. For example, the string THIS_IS_THE_BEST_WISH can be encoded as by replacing all instances of with and replacing all instances of with . Which of the following statements about byte pair encoding is true?

Byte pair encoding is an example of a lossless transformation because an encoded string can be restored to its original version.

A group of students take hundreds of digital photos for a science project about weather patterns. Each photo file contains data representing the level of red, green, and blue for each pixel in the photo. The file also contains metadata that describes the date, time, and geographic location where the photo was taken. For which of the following goals would analyzing the metadata be more appropriate than analyzing the data?

Determining the chronological order of the photos Determining whether two photos were taken at the same location on different days

A team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the United States. The program is intended to combine county data sets and then process the data. Which of the following is most likely to be a challenge in creating the program?

Different counties may organize data in different ways.

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?

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?

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

A programmer is writing a program that is intended to be able to process large amounts of data. Which of the following considerations is LEAST likely to affect the ability of the program to process larger data sets?

How many programming statements the program contains

A large data set contains information about all students majoring in computer science in colleges across the United States. The data set contains the following information about each student. The student's gender The state in which the student attends college The student's grade point average on a 4.0 scale Which of the following questions could be answered by analyzing only information in the data set?

How many states have a higher percentage of female computer science majors than male computer science majors attending college in that state? C

Some programming languages use constants, which are variables that are initialized at the beginning of a program and never changed. Which of the following are good uses for a constant?I. To represent the mathematical value π (pi) as 3.14 II. To represent the current score in a game III. To represent a known value such as the number of days in a week

I and III only

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?

I, II, and III

Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. I An algorithm that accesses each element in the list twice II An algorithm that accesses each element in the list n times III 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?

I, II, and III

Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher provides a way for students to improve their course grades if they receive high scores on the final exam: if a student's final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The table below shows two students' scores on the midterm and final exams and the calculated total points each student earns. Khalil does better on the midterm exam than on the final exam, so his original midterm and final exam scores are added to compute his total points. Josefina does better on the final exam than on the midterm exam, so her final exam score replaces her midterm exam score in the total points calculation. 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 studentII. The average increase in total points per student as a result of the score replacement policyIII. The proportion of students who improved their total points as a result of the score replacement policy

I, II, and III

Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher provides a way for students to improve their course grades if they receive high scores on the final exam: if a student's final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The table below shows two students' scores on the midterm and final exams and the calculated total points each student earns. Khalil does better on the midterm exam than on the final exam, so his original midterm and final exam scores are added to compute his total points. Josefina does better on the final exam than on the midterm exam, so her final exam score replaces her midterm exam score in the total points calculation. 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 studentII. The average increase in total points per student as a result of the score replacement policyIII. The proportion of students who improved their total points as a result of the score replacement policy A

I, II, and III

Which of the following are true statements about the data that can be represented using binary sequences? Binary sequences can be used to represent strings of characters. Binary sequences can be used to represent colors. Binary sequences can be used to represent audio recordings.

I, II, and III

The procedure below searches for the value in . It returns if is found and returns 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 is sorted.

II only

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 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

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 X 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.

A population researcher is interested in predicting the number of births that will occur in a particular community. She created a computer model that uses data from the past ten years, including number of residents and the number of babies born. The model predicted that there would be 200 births last year, but the actual number of births last year was only 120. Which of the following strategies is LEAST likely to provide a more accurate prediction?

Removing as many details from the model as possible so that calculations can be performed quickly

A researcher is analyzing data about students in a school district to determine whether there is a relationship between grade point average and number of absences. The researcher plans on compiling data from several sources to create a record for each student. The researcher has access to a database with the following information about each student. Last name First name Grade level (9, 10, 11, or 12) Grade point average (on a 0.0 to 4.0 scale) The researcher also has access to another database with the following information about each student. First name Last name Number of absences from school Number of late arrivals to school Upon compiling the data, the researcher identifies a problem due to the fact that neither data source uses a unique ID number for each student. Which of the following best describes the problem caused by the lack of unique ID numbers?

Students who have the same name may be confused with each other.

Historically, it has been observed that computer processing speeds tend to double every two years. Which of the following best describes how technology companies can use this observation for planning purposes?

Technology companies can set research and development goals based on anticipated processing speeds. D

A cable television company stores information about movie purchases made by subscribers. Each day, the following information is summarized and stored in a publicly available database. The day and date each movie was purchased The title of each movie purchased The cities where subscribers purchased each movie The number of times each movie was purchased by subscribers in a given city A sample portion of the database is shown below. The database is sorted by date and movie title. Which of the following CANNOT be determined using only the information in the database?

The number of movies purchased by an individual subscriber for a particular month

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.

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?

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

Two different schools maintain data sets about their currently enrolled students. No individual student is enrolled at both schools. Each line of data contains information, separated by commas, about one student. East High School stores the data in the following format. West High School stores the data in the following format. The two schools would like to combine their data to make a single data set. Which of the following can be done with the combined data? Select two answers.

The schools can create a single list of student names, sorted by last name. The schools can determine the average number of days students are absent.

Two different schools maintain data sets about their currently enrolled students. No individual student is enrolled at both schools. Each line of data contains information, separated by commas, about one student. East High School stores the data in the following format. West High School stores the data in the following format. The two schools would like to combine their data to make a single data set. Which of the following can be done with the combined data? Select two answers.

The schools can create a single list of student names, sorted by last name. B The schools can determine the average number of days students are absent.

A student is recording a song on her computer. When the recording is finished, she saves a copy on her computer. The student notices that the saved copy is of lower sound quality than the original recording. Which of the following could be a possible explanation for the difference in sound quality?

The song was saved using fewer bits per second than the original song.

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?

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.

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.

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?

The values in numList must be in sorted order.

Which of the following best explains why it is not possible to use computers to solve every problem?

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

A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata. The time the message was posted The name of the user who posted the message The names of any users who comment on the message and the times the comments were made For which of the following goals would it be more useful to analyze the data instead of the metadata?

To determine the topics that many users are posting about

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?

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

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 II requires approximately 5 more minutes to execute than version I.

A program developed for a Web store represents customer account balances using a format that approximates real numbers. While testing the program, a software developer discovers that some values appear to be mathematically imprecise. Which of the following is the most likely cause of the imprecision?

The account balances are represented using a fixed number of bits, resulting in round-off errors.

Each student that enrolls at a school is assigned a unique ID number, which is stored as a binary number. The ID numbers increase sequentially by 1 with each newly enrolled student. If the ID number assigned to the last student who enrolled was the binary number 1001 0011, what binary number will be assigned to the next student who enrolls? A

1001 0100

An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of items it sells and is considering using 7-bit binary sequences. Which of the following best describes the result of using 7-bit sequences instead of 6-bit sequences?

2 times as many items can be uniquely identified

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.

A social media site allows users to send messages to each other. A group of researchers gathered user data for the first 10 years of the site's existence. Some of the data are summarized in the table below, along with some of the company milestones. The researchers noticed that the total number of registered users appears to be increasing at about a constant rate. If this pattern continues, which of the following best approximates the total number of registered users, in millions, in year 12 (two years after the last entry in the table) ?

31.2

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 , which returns the number of unique users who viewed videos of a given category in the past year. The 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

A store uses binary numbers to assign a unique binary sequence to each item in its inventory. What is the minimum number of bits required for each binary sequence if the store has between 75 and 100 items in its inventory?

7

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 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 library of e-books contains metadata for each book. The metadata are intended to help a search feature find books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of each e-book?

An archive containing previous versions of the e-book

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.

Author Title

A user wants to save a data file on an online storage site. The user wants to reduce the size of the file, if possible, and wants to be able to completely restore the file to its original version. Which of the following actions best supports the user's needs?

Compressing the file using a lossless compression algorithm before uploading it

Digital images are often represented by the red, green, and blue values (an RGB triplet) of each individual pixel in the image. A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossless transformation of the digital image?

Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original; light areas appear dark, and colors are reversed.

Consider the following numeric values. Binary 1011 Binary 1101 Decimal 5 Decimal 12 Which of the following lists the values in order from least to greatest? A

Decimal 5, binary 1011, decimal 12, binary 1101

A digital photo file contains data representing the level of red, green, and blue for each pixel in the photo. The file also contains metadata that describes the date and geographic location where the photo was taken. For which of the following goals would analyzing the metadata be more appropriate than analyzing the data?

Determining the likelihood that the photo was taken at a particular public event

Biologists often attach tracking collars to wild animals. For each animal, the following geolocation data is collected at frequent intervals. The time The date The location of the animal Which of the following questions about a particular animal could NOT be answered using only the data collected from the tracking collars?

Do the movement patterns of the animal vary according to the weather?

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?

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

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)

I and III

Which of the following can be represented by a sequence of bits? An integer An alphanumeric character A machine language instruction

I, II, and III

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 , the returned list would contain (because ,Kayak ,Level and 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

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+3will result in an overflow error.

II only

A programmer is developing software for a social media platform. The programmer is planning to use compression when users send attachments to other users. Which of the following is a true statement about the use of compression?

Lossy compression of an image file generally provides a greater reduction in transmission time than lossless compression does.

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)

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

Each student at a school has a unique student ID number. A teacher has the following spreadsheets available. Spreadsheet I contains information on all students at the school. For each entry in this spreadsheet, the student name, the student ID, and the student's grade point average are included. Spreadsheet II contains information on only students who play at least one sport. For each entry in this spreadsheet, the student ID and the names of the sports the student plays are included. Spreadsheet III contains information on only students whose grade point average is greater than 3.5. For each entry in this spreadsheet, the student name and the student ID are included. Spreadsheet IV contains information on only students who play more than one sport. For each entry in this spreadsheet, the student name and the student ID are included. The teacher wants to determine whether students who play a sport are more or less likely to have higher grade point averages than students who do not play any sports. Which of the following pairs of spreadsheets can be combined and analyzed to determine the desired information?

Spreadsheets I and II

In which of the following situations would it be most appropriate to choose lossy compression over lossless compression?

Storing music files on a smartphone in order to maximize the number of songs that can be stored

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.

A video-streaming Web site keeps count of the number of times each video has been played since it was first added to the site. The count is updated each time a video is played and is displayed next to each video to show its popularity. At one time, the count for the most popular video was about two million. Sometime later, the same video displayed a seven-digit negative number as its count, while the counts for the other videos displayed correctly. Which of the following is the most likely explanation for the error?

The count for the video became larger than the maximum value allowed by the data type used to store the count.

A social media site allows users to send messages to each other. A group of researchers gathered user data for the first 10 years of the site's existence. Some of the data are summarized in the table below, along with some of the company milestones. Which of the following hypotheses is most consistent with the data in the table?

The mobile app release led to users tending to write shorter messages.

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?

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

The position of a runner in a race is a type of analog data. The runner's position is tracked using sensors. Which of the following best describes how the position of the runner is represented digitally?

The position of the runner is sampled at regular intervals to approximate the real-word position, and a sequence of bits is used to represent each sample.

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?

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

Which of the following is a true statement about data compression?

There are trade-offs involved in choosing a compression technique for storing and transmitting data.

A student is creating a Web site that is intended to display information about a city based on a city name that a user enters in a text field. Which of the following are likely to be challenges associated with processing city names that users might provide as input? Select two answers.

Users might enter abbreviations for the names of cities. Users might misspell the name of the city.

A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie studio would like to be able to access full-quality videos if they are needed for future projects. Which of the following actions is LEAST likely to support the studio's goal?

Using lossy compression software to reduce the size requirements of the data being stored

Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher provides a way for students to improve their course grades if they receive high scores on the final exam: if a student's final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The table below shows two students' scores on the midterm and final exams and the calculated total points each student earns. Khalil does better on the midterm exam than on the final exam, so his original midterm and final exam scores are added to compute his total points. Josefina does better on the final exam than on the midterm exam, so her final exam score replaces her midterm exam score in the total points calculation. 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 and . The procedure returns the larger of and . 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 ?

adjusted trouble-Max (midtermExam,final Exam) + Final Exam

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?

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 ?

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


Conjuntos de estudio relacionados

Chapter 10 - Work, Retirement, and Leisure

View Set

Business (BUSINESS LEADERSHIP SKILLS)

View Set

Chapters 4,5, & 6 - Mastering A&P

View Set

Intro to MicroEcon 247 Unit 2 (chapter 4)

View Set

Abdominal Assessment Chapter 21- Test 3

View Set