AP CSP Q1 final review

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

what is the output to the console after the following code segment is executed? var x= 10 increase(); x= x+3; console.log(x); function increased(){ var x=5; }

13

what is displayed by the console.log statement after the following code segment executes? var a= 3; var b= 6; var c = 10; a=b/a; b=c-a; c=b/a; what is the value of c

4

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? When the problem can be solved in a reasonable time and an approximate solution is acceptable A When the problem can be solved in a reasonable time and an exact solution is needed B When the problem cannot be solved in a reasonable time and an approximate solution is acceptable C When the problem cannot be solved in a reasonable time and an exact solution is needed

C. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable

An author is considering publishing an e-book using a Creative Commons license. In which of the following situations would it be better for the author to use a Creative Commons license instead of a traditional copyright? I. The author wants to make the e-book available as a free download. II. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. III. The author wants to allow people permission to use and modify the e-book

I and III

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. decimal - ASCII character 65 - A 86 - V 76 - L 89 - Y ASCII characters can also be represented by hexadecimal numbers. According to ASCII character encoding, which of the following letters is represented by the hexadecimal (base 16) number 56?

V

A program is expressed in a programming language. Which of the following is true of the program? A The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language. B The program can also be expressed as binary code, which will reduce the likelihood of errors. C The program cannot be expressed as binary code, because binary code can only be used to represent data. D Some parts of the program can be expressed as binary code, but operations must be expressed using a higher-level programming language.

a

A retailer that sells footwear maintains a single database containing records with the following information about each item for sale in the retailer's store. Item identification number Footwear type (sneakers, boots, sandals, etc.) Selling price (in dollars) Size Color Quantity available Using only the database, which of the following can be determined? A Which items listed in the database are not currently in the store B Which colors are more popular among men than women C Which type of footwear is most popular among adults D The total number of shoes sold in a particular month

a

A user enters a Web address in a browser, and a request for a file is sent to a Web server. Which of the following best describes how the file is sent to the user? A The file is broken into packets for transmission. The packets must be reassembled upon receipt. B The file is broken into packets for transmission. The user's browser must request each packet in order until all packets are received. C The server attempts to connect directly to the user's computer. If the connection is successful, the entire file is sent. If the connection is unsuccessful, an error message is sent to the user. D The server repeatedly attempts to connect directly to the user's computer until a connection is made. Once the connection is made, the entire file is sent.

a

According to the domain name system (DNS), which of the following is a subdomain of the domain example.com? A about.example.com B example.co.uk C example.com.org D example.org

a

Which of the following are true statements about digital certificates in Web browsers? Digital certificates are used to verify the ownership of encrypted keys used in secured communication. Digital certificates are used to verify that the connection to a Web site is fault tolerant. A I only B II only C I and II D Neither I nor II

a

Which of the following has the greatest potential for compromising a user's personal privacy? A A group of cookies stored by the user's Web browser B The Internet Protocol (IP) address of the user's computer C The user's e-mail address D The user's public key used for encryption

a

Which of the following is FALSE about element IDs? A. An element with a unique ID must always have an event handler associated with it. B. Any element that needs to be triggered by onEvent must have a unique ID. C. Two or more onEvent calls may reference the same ID. D. While not a requirement, IDs should be meaningful and descriptive. E. IDs allow a programmer to reference interface elements within their code.

a

Which of the following is FALSE about event-driven programs? A. Event-driven programs do not implement algorithms. B. Some portions of an event-driven program may never execute while the program is running. C. An event-driven program is written to respond to specified events by executing a block of code or function associated with the event. D. The order in which an event-driven program will run cannot always be known ahead of time. E. Event-driven programs can be run multiple times with different outcomes, based on user interactions.

a

Two students, Kaleb and Hunter, are arguing in class about an App Lab project. Kaleb states, "Huh, a button and an image are basically the same thing!". Hunter replies, "That doesn't make any sense at all!". Explain what Kaleb may have meant by that statement.

an image can be a button because both are entered in the smae way because the coding is the same too

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? A The date when a certain movie was purchased the greatest number of times B The number of movies purchased by an individual subscriber for a particular month C The total number of cities in which a certain movie was purchased D The total number of movies purchased in a certain city during a particular month

b

A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled player has a turn, the game runs slowly because the computer evaluates all potential moves and selects the best one. Which of the following best describes the possibility of improving the running speed of the game? A The game's running speed can only be improved if the game is played between two human players instead of with the computer-controlled player. B The game's running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn. C The game's running speed cannot be improved because computers can only be programmed to find the best possible solution. D The game's running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.

b

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? A Do students majoring in computer science tend to have higher grade point averages than students majoring in other subjects? B How many states have a higher percentage of female computer science majors than male computer science majors attending college in that state? C What percent of students attending college in a certain state are majoring in computer science? D Which college has the highest number of students majoring in computer science?

b

Both online newspapers and social media sites are used to distribute information on the Internet. Which of the following best describes an advantage that online newspapers have over social media sites? A The ability to distribute information instantaneously B The ability to provide credibility to the information distributed C The ability to provide information that is widely accessible D The ability to provide media-rich content for low cost

b

Consider the following numbers. Binary 1100 Decimal 11 Hexadecimal D Which of the following lists the numbers in order from least to greatest? A Binary 1100, Decimal 11, Hexadecimal D B Decimal 11, Binary 1100, Hexadecimal D C Decimal 11, Hexadecimal D, Binary 1100 D Hexadecimal D, Decimal 11, Binary 1100

b

Many Web browsers allow users to open anonymous windows. During a browsing session in an anonymous window, the browser does not record a browsing history or a list of downloaded files. When the anonymous window is exited, cookies created during the session are deleted. Which of the following statements about browsing sessions in an anonymous window is true? A The activities of a user browsing in an anonymous window will not be visible to people who monitor the user's network, such as the system administrator. B Items placed in a Web store's shopping cart for future purchase during the anonymous browsing session will not be saved on the user's computer. C A user will not be able to log in to e-mail or social media accounts during the anonymous browsing session. D A user browsing in an anonymous window will be protected from viruses launched from any Web sites visited or files downloaded.

b

The figure below represents a network of physically linked computers labeled A through G. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. Which of the following statements about security in the network is true? Computers A and D need to communicate with at least two additional computers in the network in order to communicate with each other. Computers B and C can communicate with each other without additional computers being aware of the communication. A I only B II only C I and II D Neither I nor II

b

Which of the following best describes a Distributed Denial of Service (DDoS) attack? A An attempt by a country to deny its citizens access to the Internet B An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems C An attempt by one user to deny service to another user by posting material on a social network D An attempt by a user of the Internet to get private information from a secure database

b

Which of the following best explains what happens when a new device is connected to the Internet? A A device driver is assigned to the device. B An Internet Protocol (IP) address is assigned to the device. C A packet number is assigned to the device. D A Web site is assigned to the device.

b

Which of the following is a characteristic of the fault-tolerant nature of routing on the Internet? A The ability to use a hierarchical naming system to avoid naming conflicts B The ability to provide data transmission even when some connections have failed C The ability to resolve errors in domain name system (DNS) lookups D The ability to use multiple protocols such as hypertext transfer protocol (HTTP), Internet protocol (IP), and simple mail transfer protocol (SMTP) to transfer data

b

Which of the following are actions a programmer could take when debugging a segment of code that would most likely lead to finding a problem and fixing it? (choose two) A. Change the names of variables within the program and run the program again. B. Display the value of variables at various points during the program. C. Ask a friend or collaborator to look over the code segment to see if they are able to find any errors. D. Delete the code and re-type it to make sure there were no spelling errors and that it was written correctly.

b, c

var a= 0; var b= 3; var c= 4; a= a+c; b= a+c; c= a+c; what are the values of a, b, and c

b?

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? A To determine the users who post messages most frequently B To determine the time of day that the site is most active C To determine the topics that many users are posting about D To determine which posts from a particular user have received the greatest number of comments

c

A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following activities is LEAST likely to be effective in this purpose? A Holding basic computer classes at community centers B Providing free wireless Internet connections at locations in low-income neighborhoods C Putting all government forms on the city Web site D Requiring that every city school has computers that meet a minimum hardware and software standard

c

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? A 2 times as many values can be represented. B 32 times as many values can be represented. C 232 times as many values can be represented. D 322 times as many values can be represented.

c

An algorithm will be used to identify the maximum value in a list of one or more integers. Consider the two versions of the algorithm below. Algorithm I : Set the value of a variable max to − 1. Iterate through the list of integer values. If a data value is greater than the value of the variable max, set max to the data value. Algorithm II : Set the value of a variable max to the first data value. Iterate through the remaining values in the list of integers. If a data value is greater than the value of the variable max, set max to the data value. Which of the following statements best describes the behavior of the two algorithms? A Both algorithms work correctly on all input values. B Algorithm I always works correctly, but Algorithm II only works correctly when the maximum value is not the first value in the list. C Algorithm II always works correctly, but Algorithm I only works correctly when the maximum value is greater than or equal to − 1. D Neither algorithm will correctly identify the maximum value when the input contains both positive and negative input values.

c

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? A 2 more items can be uniquely identified. B 10 more items can be uniquely identified. C 2 times as many items can be uniquely identified. D 10 times as many items can be uniquely identified.

c

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? A Approximately how many miles did the animal travel in one week? B Does the animal travel in groups with other tracked animals? C Do the movement patterns of the animal vary according to the weather? D In what geographic locations does the animal typically travel?

c

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? A Technology companies can accurately predict the dates when new computing innovations will be available to use. B Technology companies can plan to double the costs of new products each time advances in processing speed occur. C Technology companies can set research and development goals based on anticipated processing speeds. D Technology companies can spend less effort developing new processors because processing speed will always improve at the observed rate.

c

Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every time someone clicks the "addItemButton", she would like the variable to increase by 1. var carTotal = 0; onEvent("addItemButton", "click", function() { //missing code console.log(carTotal); What code should Jasmine insert where it says <missing code> in order for her app to work? A. cart total = 1; B. cartTotal + 1; C. cartTotal = cartTotal +1; D. var cartTotal = cartTotal + 1; E. var cartTotal + 1;

c

The figure below represents a network of physically linked computers labeled A through G. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. What is the minimum number of connections that must be broken or removed in the network before computer E can no longer communicate with computer F? A 1 B 2 C 3 D 4

c

There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A Step 1: All students stand. Step 2: A randomly selected student writes his or her height on a card and is seated. Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased. Step 4: Repeat step 3 until no students remain standing. Step 5: The sum on the card is divided by 32. The result is given to the teacher. Algorithm B Step 1: All students stand. Step 2: Each student is given a card. Each student writes his or her height on the card. Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student's card; the other student is seated. The previous value on the card is erased. Step 4: Repeat step 3 until one student remains standing. Step 5: The sum on the last student's card is divided by 32. The result is given to the teacher. Which of the following statements is true? A Algorithm A always calculates the correct average, but Algorithm B does not. B Algorithm B always calculates the correct average, but Algorithm A does not. C Both Algorithm A and Algorithm B always calculate the correct average. D Neither Algorithm A nor Algorithm B calculates the correct average.

c

When a cellular telephone user places a call, the carrier transmits the caller's voice as well as the voice of the person who is called. The encoded voices are the data of the call. In addition to transmitting the data, the carrier also stores metadata. The metadata of the call include information such as the time the call is placed and the phone numbers of both participants. For which of the following goals would it be more useful to computationally analyze the metadata instead of the data? To determine if a caller frequently uses a specific word To estimate the number of phone calls that will be placed next Monday between 10:30 A.M. and noon. To generate a list of criminal suspects when given the telephone number of a known criminal A I only B II only C II and III only D I, II, and III

c

Which of the following is a true statement about cloud computing? A Cloud computing is convenient to implement but has a negative effect on the scalability of systems. B Cloud computing is useful for large businesses but is not useful for individuals. C Storing data using cloud computing can help ensure that data are not lost if a user's computer stops functioning. D Storing data using cloud computing improves security over storing data on a personal computer.

c

Which of the following is considered an unethical use of computer resources? A Downloading freeware or shareware onto your home computer B Purchasing a game from an app store and downloading it directly to a mobile device C Purchasing a single-user copy of photo editing software and installing it on all the computers in a computer lab D Searching online for an electronic version of a school textbook

c

Which of the following is true about while loops in JavaScript? A. While loops terminate after a fixed number of loops that is pre-determined B. While loops terminate after a fixed number of loops that is determined after the loop executes once. C. While loops run as long as a given boolean condition is true. D. While loops run as long as a given boolean condition is false. E. While loops are known as "forever loops" and never stop until the program is halted by the user.

c

Which of the following programs is most likely to benefit from the use of a heuristic? A A program that calculates a student's grade based on the student's quiz and homework scores B A program that encrypts a folder of digital files C A program that finds the shortest driving route between two locations on a map D A program that sorts a list of numbers in order from least to greatest

c

Which of the following statements about strings in JavaScript is FALSE? A. Strings consist of a sequence of concatenated characters. B. Strings are indicated by quotation marks. C. Strings with numerical digits in them are invalid. D. A string can be empty, meaning that it contains nothing. E. Strings sometimes include spaces.

c

Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system? A Computer simulations can only be built after the real-world object or system has been created. B Computer simulations only run on very powerful computers that are not available to the general public. C Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled. D It is difficult to change input parameters or conditions when using computer simulations.

c

A car manufacturer uses simulation software during the design process for a new car. Which of the following are reasons to use simulation software in this context? Using simulation software can save the company money by helping to compare designs early in the process, before prototype cars are built. Using simulation software can help to identify safety issues by providing data about how different mechanical components will interact in a wide variety of situations. The manufacturer can present simulation software to customers to demonstrate different design possibilities. A I and II only B I and III only C II and III only D I, II, and III

d

A new bank plans to make customer convenience a priority by minimizing the amount of time a customer waits in line. The bank is considering two options: a single line where the customer at the front waits for the next available teller, or separate lines for each teller. The bank decides to use a computer simulation of these two options to determine the average wait time for customers. Which of the following is NOT true about the bank's plan? A The bank can incorporate other factors, such as the number of tellers, in the simulation. B The bank can use the simulation to investigate these two options without causing inconvenience for customers. C The bank may consider new alternatives based on the simulation results. D The simulation will not produce usable results because actual customer data are not available.

d

A programmer wrote an essay for his history class, and realized he has confused the names of Benjamin Franklin and Alexander Graham Bell. Instead of going through the whole paper and changing the names, he used the following incorrect algorithm in an attempt replace every occurrence of "Benjamin Franklin" with "Alexander Graham Bell" and vise versa: First, change all occurrences of "Benjamin Franklin" to "apple" Then, change all occurrences of "apple" to "Alexander Graham Bell". Then, change all occurrences of "Alexander Graham Bell" to "Benjamin Franklin". Here is an example of one of the sentences from the paper: Alexander Graham Bell was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. Which of the following is the result of running the described incorrect algorithm on the sentence above? A. Benjamin Franklin was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors. B. apple was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. C. Alexander Graham Bell was born 141 years before apple, so he was never able to telephone his neighbors. D. Benjamin Franklin was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. E. Alexander Graham Bell was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors.

d

An Internet service provider (ISP) is considering an update to its servers that would save copies of the Web pages most frequently visited by each user. Which of the following is LEAST likely to occur as a result of the update? A Average response time for user requests might decrease. B Privacy of users might be negatively affected. C Storage requirements for the servers might increase. D Web sites that are not visited frequently might no longer be accessible to users.

d

Jose is writing a reply function for a text messaging app. He'd like to swap the sender and receiver so that the value currently in variable From ends up as the value in To and To ends up in From Which of the following code segments will correctly swap the values as described? A. to = from; from = to; B. from = var temp; to = temp; from = to; C. var temp = from; from = to; to = from; D var temp = from; from = to; to = temp; E var temp = to; from = to; to = temp;

d

Two computers are built by different manufacturers. One is running a Web server and the other is running a Web browser. Which of the following best describes the ability of the two computers to communicate with each other across the Internet? A The computers cannot communicate because different manufacturers use different communication protocols. B The computers can communicate, but additional hardware is needed to convert data packets from one computer's protocol to the other computer's protocol. C The computers can communicate directly only if the messages consist of text; other formats cannot be interpreted across computers. D The computers can communicate directly because Internet communication uses standard protocols.

d

Which of the following statements is true? A Every problem can be solved with an algorithm for all possible inputs, in a reasonable amount of time, using a modern computer. B Every problem can be solved with an algorithm for all possible inputs, but some will take more than 100 years, even with the fastest possible computer. C Every problem can be solved with an algorithm for all possible inputs, but some of these algorithms have not been discovered yet. D There exist problems that no algorithm will ever be able to solve for all possible inputs.

d

when might a programmer create a global variable instead of a local variable

when they want to refer to it throughout the whole program rather than just in the area


Ensembles d'études connexes

Give Me Liberty:Chapter 4 Slavery, Freedom, And The Struggle For Empire, To 1763

View Set

Telecom Chapter 5 - Ethernet (802.3) Switched LANs

View Set

Biology - Deforestation, Greenhouse effect and Greenhouse gases.

View Set