AP CompSci Midterm Review

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

A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is 0. Which of the following is the best explanation for the result?

A. An overflow error occurred

For which of the following values of numCorrect does the code segment NOT display the intended grade?

B. and D. 6 and 8

Convert the decimal (base-10) number 20 to binary (base-2).

D. 10100

Which of the following best describes the protocols used on the Internet?

D. The protocols of the Internet are open and used by all devices connected to the network

computing system

a group of computers working together for a common purpose

Which of the following is the most appropriate documentation to appear with the printNums procedure?

Prints all positive odd integers that are less than or equal to max.

A large spreadsheet contains the following information about the books at a bookstore. A sample portion of the spreadsheet is shown below. An employee wants to count the number of books that meet all of the following criteria. Is a mystery book Costs less than $10.00 Has at least one copy in stock For a given row in the spreadsheet, suppose genre contains the genre as a string, num contains the number of copies in stock as a number, and cost contains the cost as a number. Which of the following expressions will evaluate to true if the book should be counted and evaluates to false otherwise?

A. (genre = "mystery") AND ((1 ≤ num) AND (cost < 10.00))

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

Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which an overflow error occur?

C. 16

What is the MINIMUM number of paths that would need to be broken to prevent Computing Device A from connecting with Computing Device E?

C. 3

Which of the following is true of how the Internet has responded to the increasing number of devices now using the network?

C. The protocols of the Internet were designed to scale as new devices are added

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?

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

Which of the following changes can be made so that the code segment works as intended?

D Interchanging lines 3 and 7

How many total numbers can be represented with an 8-bit binary (base-2) system?

D. 256

Which of the following Internet protocols is used to request and send pages and files on the World Wide Web?

D. HyperText Transfer Protocol (HTTP)

Which of the following best describes the behavior of the code segment?

D. The code segment displays the value of 2(53) by initializing result to 2 and then multiplying result by 5 a total of three times.

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?

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

The following program is run. Then the user clicks the "bottomButton" ONCE and then clicks the "topButton" ONCE. What will be displayed in the console?

D. ccc, bbb, aaa

Three students in different locations are collaborating on the development of an application. Which of the following strategies is LEAST likely to facilitate collaboration among the students?

C. Having all three students write code independently and then having one student combine the code into a program

Which of the following best describes the behavior of the procedure?

C. It displays true if x is negative and displays nothing otherwise.

Device A is attempting to send data over the Internet to Device E. Which of the following is true of how the data will travel through the network?

C. It is possible that the data travels through any of the devices in the network before arriving at device E

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

Which of the following binary (base-2) numbers is LARGEST?

A. 11000000

Convert the binary (base-2) number 1001 to decimal (base-10).

A. 9

Which of the following situations is most likely to cause issues arising from the digital divide?

A. A state makes voter registration forms available only by visiting a government website

A company that develops educational software wants to assemble a collaborative team of developers from a variety of professional and cultural backgrounds. Which of the following is NOT considered a benefit of assembling such a team?

A. Collaboration that includes diverse backgrounds and perspectives can eliminate the need for software testing.

Which of the following is NOT a reason to include comments in programs?

A. Comments help the computer decide whether certain components of a program are important.

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?

A. Compressing the file using a lossless compression algorithm before uploading it; Assume that applying either of the filters will not change the relative order of the rows remaining in the spreadsheet.

DineOutHelper is a mobile application that people can use to select a restaurant for a group meal. Each user creates a profile with a unique username and a list of food allergies or dietary restrictions. Each user can then build a contact list of other users of the app. A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions. Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia. Which of the following data are needed for DineOutHelper to recommend a restaurant for the group? Each group member's list of food allergies or dietary restrictions Alejandra's geographic location The usernames of the people on Brandon and Cynthia's contact lists

A. I and II only

Which of the following best describes the purpose of an IP address?

A. IP addresses provide a unique number for identifying devices that send and receive information on the Internet

Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form complete messages?

A. Transmission Control Protocol (TCP)

Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the network that is currently being used by the devices to communicate. The network immediately begins using a different path through the network and communication continues as normal. This situation best exemplifies which principle?

A. fault-tolerance

In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?

A. investigating and reflecting

Which of the following is true of how computers represent numbers?

B. With a fixed number of bits some numbers are too large to represent in a computer which will lead to overflow errors.

A large spreadsheet contains information about the schedule for a college radio station. A sample portion of the spreadsheet is shown below.

B. (genre = "talk") AND ((day = "Saturday") OR (day = "Sunday"))

A time stamp indicates the date and time that a measurement was taken. A data scientist has a list containing 10,000 time stamps, sorted in chronological order. Which of the following is closest to the maximum number of values that will need to be examined when performing a binary search for a value in the list?

B. 15

A sorted list of numbers contains 200 elements. Which of the following is closest to the maximum number of list elements that will need to be examined when performing a binary search for a particular value in the list?

B. 8

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

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

Jesse purchases a new smartphone and is immediately able to use it to send a photo over the Internet to a friend who lives in a different country. Which of the following is NOT necessary to make this possible?

B. A single direct connection is established between any two devices connected to the Internet

Which of the following is NOT true of how computers represent complex information?

B. Abstraction helps represent complex information by surfacing complexity that might otherwise be hidden

Arman takes a picture with his smartphone which he subsequently posts online. Beatrice finds the picture online and posts a copy of it on her website with an attached Creative Commons license. Which of the following best describes who owns the photo?

B. Arman owns the photo because he was the original creator and did not license the work.

The following program is run. Then the user clicks the "bottomButton" TWO TIMES. What will be displayed in the console?

B. bbb, ddd, ccc, ccc

Which of the following data is not provided by Alejandra but is necessary for DineOutHelper to recommend a restaurant for the group?

B. III only

Which line of code in this program is MOST likely to result in an error?

B. Line 2

Which of the following is true of lossy and lossless compression algorithms?

B. Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.

Which of the following is true of how packets are sent through the Internet?

B. Packet metadata is used to route and reassemble information travelling through the Internet

If the user does NOT click the button what color will "topButton" be when this program finishes running?

B. blue

Which of the following can be represented by a single binary digit?

B., C. The remainder when dividing a whole number by 2, the value of a boolean

Which of the following is MOST likely to be an outcome of the digital divide?

B. People from some racial or ethnic groups have unequal access to computing technology.

Which of the following is the most appropriate documentation to appear with the swapListElements procedure?

B. Returns a copy of numList with the elements at indices j and k interchanged. The values of j and k must both be between 1 and LENGTH(numList), inclusive.

The code segment compares pairs of list elements, setting containsDuplicates to true if any two elements are found to be equal in value. Which of the following best describes the behavior of how pairs of elements are compared?

B. The code segment iterates through myList, comparing each element to all subsequent elements in the list.

A student is creating an application that allows customers to order food for delivery from a local restaurant. Which of the following is LEAST likely to be an input provided by a customer using the application?

B. The cost of a food item currently available for order

When visiting a museum Lian takes a photo of a painting with a smartphone which stores the photo as an image file. Which of the following best describes the differences between the painting itself and the photo of the painting stored on the smartphone?

B. The photo is a digital representation of the analog painting

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?

C. 9

Which of the following best describes how computing devices represent information?

C. A computer represents data as bits which is either a 0 or a 1

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?

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

Which of the following is true of intellectual property?

C. Creative Commons enables content creators to freely distribute their otherwise copyrighted work.

Which of the following best describes the purpose of a design specification?

C. Describing the requirements for how a program will work or users will interact with it

Which of the following is the most appropriate documentation to appear with the calculate procedure?

C. Displays the value of (x + y) / x.The value of the parameter x must not be 0

What ASCII character is represented by the binary (base 2) number 1001010 ?

C. J

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?

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

An ISP is considering adding additional redundant connections to its network. Which of the following best describes why the company would choose to do so?

C. Redundant networks are more reliable

Jorge is sending a large image file to a friend as part of a shared classroom project. Which of the following is most likely true if Jorge opts to compress the image before sending it?

D. The image will require fewer bits in order to be represented.

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?

C. V

Which of the following best describes the behavior of the procedure?

C. Which of the following best describes the behavior of the procedure?

What will the "background-color" of the "topButton" be when the program is finished running?

C. blue

The following program is run. Then the user clicks the "topButton" button ONCE. What will be displayed in the console?

C. cat, dog, bird

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

D. 1, 2, and 3

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?

D. 10 times as many items can be uniquely identified.

A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory?

D. Four bits are enough to store the eight directions.

Which of the following BEST describes the differences between sequential and event-driven programming?

D. In sequential programming commands run in the order they are written. In event-driven programming some commands run in response to user interactions or other events.

Ryan is designing an app that needs to quickly send low quality photos between users. Most smartphones take much higher quality photos than Ryan needs for his app. Which answer best describes the type of compression Ryan should choose and why?

D. Lossy compression since it typically results in smaller data sizes.

Which of the following sequences of steps can be used to identify the desired entry

D. Sort by year, then filter by year, then filter by photographer

Emilee is watching an online video. The video is being sent to her laptop by a server over the Internet which splits the video into packets and sends them in the order they appear in the video. Which of the following is true about how the packets will arrive at her computer?

D. The packets may arrive out of order

A company that develops mobile applications wants to involve users in the software development process. Which of the following best explains the benefit in having users participate?

D. Users can provide feedback that can be used to incorporate a variety of perspectives into the software.

Lucy is completing a project as part of a science class using materials she found online. Which of the following is MOST LIKELY to lead to legal consequences?

D. Using images posted online by another student without permission or citation.

For which of the following contents of myList does the procedure NOT return the intended result?

D. [1, 2, 3]

computing network

a group of connected computers that can send or receive data

computing device

a machine that can run a program

path

a sequence of direct connections


Conjuntos de estudio relacionados

Psychology Module 5 Chapter 3 & 4

View Set

Connecticut Casualty Adjuster for All Lines

View Set

ATI Nutrition Practice Questions

View Set

Teas math practice tests practice 7

View Set

NurseLogic Knowledge and Clinical Judgment Advanced

View Set

Business 110 chapters 10, 11, 13, 14

View Set