AP Comp Sci exam review
What symbol is used at the beginning of an in-line comment?
#
Martin is creating a website for his high school yearbook teacher. He will upload all the senior yearbook photos to this website in order for the senior students to securely log in and retrieve favorite photos. The students will be able to print the photos using the Media Center's high-resolution color printer. Choose the correct format for saving and uploading images to the website.
.PNG because it offers lossless compression, and is compatible for viewing on the web
If you wanted Tracy to complete her command immediately, which speed value would you use?
0
Approximately how much bigger (how many more bytes) is a megabyte than a kilobyte?
1,000 times bigger
What will be displayed when the following program is executed? list ← [7, 10, 14] FOR EACH item IN list { DISPLAY (item MOD 3)
1,1,2
Which two statements are true about routing on the Internet? (Choose 2) 1. A packet traveling between two computers on the Internet may be rerouted many times along the way. 2.There is one router which receives and redirects all the traffic of the Internet. 3. A packet contains addressing information to allow routers to decide how best to forward along that packet towards its destination. 4. Your router receives all the traffic of the Internet and delivers to your computer only the messages intended for you.
1. A packet traveling between two computers on the Internet may be rerouted many times along the way. 3. A packet contains addressing information to allow routers to decide how best to forward along that packet towards its destination.
Which of the following is the binary equivalent to the decimal number 218?
1101 1010
Select two expressions involving the Modulo operation that compute to the exact same value (Choose 2).
17 MOD 16 9 MOD 8
When responding to a question with 4 choices, the most efficient way will require what number of bits?
2
A video-streaming Web site uses 32-bit integers to count the number of times each video has been played. In anticipation of some videos being played more times than can be represented with 32 bits, the Web site is planning to change 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 as many values can be represented.
The following loop draws 3 circles on the screen. 1 for i in range(3): 2 circle(25) 3 forward(50) If I were to alter this loop to draw 10 circles, how many lines would my code be?
3 lines
Which lines of the code below will be repeated 4 times? 1 penup() 2 for i in range(4) 3pendown() 4circle(25) 5forward(50) 6 backward(200)
3, 4, and 5
Select two statements about packets and routing on the Internet that are true. 1. TCP depends on the infrastructure of the Internet to be reliable enough to ensure no packets are lost in transmission 2. TCP must account for the fact that packets may not arrive at a destination computer in the intended order 3. TCP ensures messages can be reliably transmitted across the Internet 4.Packets travelling across the Internet take a standardized amount of time and so can be counted on to arrive in the order they were sent
3. TCP ensures messages can be reliably transmitted across the Internet 4.Packets travelling across the Internet take a standardized amount of time and so can be counted on to arrive in the order they were sent
If you just had two shapes (say, a circle and a square), how many 3-place patterns could you make?
8
With 8 bits, it is possible to represent 256 different integer values. How many bits do you need to represent twice as many integer values (512)?
9
Select two items that can be represented in a binary state. (Choose 2) a median test score a senate bill vote a trend a byte of data a power supply
?
What two things must be included in your function definition?
A function name and commands to be performed
The Internet Engineering Task Force (IETF) defines the protocols and standards for how the Internet works. The members of the IETF are:
A loosely organized collection of citizens and engineers who communicate mostly by email.
What is a Distributed Denial of Service (DDoS) attack?
An attempt to compromise a single target by flooding it with requests from multiple systems.
How many parameters can we use in each function?
As many as we need
Which of the following are equivalent representations of the same number?
Binary 1110 Hexadecimal E Decimal 14
Top Down Design makes it easier to solve a problem by:
Breaking the problem down into smaller parts
You decide you are going to take your Internet privacy seriously. Which poses the greatest risk to your Internet privacy?
Encrypting your files and sharing your private key to ensure others can read them.
An artist makes an RGB raster image in which each pixel color is encoded with 12-bits --- 4 bits each for red, green and blue. Which of the following correctly shows the hexadecimal value for Red as a 12 -bit representation?
F00
A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats." The programmer will use the fact that the word "foxes" does not appear anywhere in the original text.Which of the following algorithms can be used to accomplish the programmer's goal?
First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep."
Which of the following expressions will report true? I. ✓ and ✓ II. ✓ and X III. ✓ or ✓
I and III
Which of the following statements are correct about a low-level programming language compared with a high-level programming language? I. Low-level language programs are generally harder for people to understand than programs written in a high-level language. II. A low-level language provides programmers with more abstractions than a high-level language. III. Low-level language programs are generally harder to debug than programs written in a high-level language.
I and III
Which statements about compression are true? I. Compression is only useful when transferring files over a network. II. After a file is compressed, it can never be restored to its original state without some loss of information or quality. III. In some situations, it is more appropriate to use lossy data compression rather than lossless data compression.
III only
What is a packet of data that uses 32-bit addresses?
IPv4 packet
The figure below shows a circuit composed of two logic gates. The output of the circuit is true. Which of the following is a true statement about input A?
Input A must be true
A program is written in a high-level programming language. Select the correct statement about this program.
The program can also be written in machine language using binary code, but then it will be less easily understood by people.
The name 'color' cannot be used for our variable because:
The word 'color' is already used as a Tracy command
Why are parameters useful?
They allow us to tailor functions to be used in multiple situations
Which statement is true of abstraction? a. Abstraction extracts common features from specific examples to generalize concepts. b. Abstraction has very little use in computing, as it is mainly an art concept. c. Pictures can be abstracted into specific colors which are further abstracted into bits. d. An abstraction is created by moving from the general to the specific.
a. Abstraction extracts common features from specific examples to generalize concepts.
Which statement is false regarding abstraction as applied to computer science? a. Binary sequences are abstractions which are used to represent colors in an image. b. Higher level languages utilize abstraction to hide details of the CPU instructions from the programmer. c. A computer chip is often an abstraction of many lower level logic gates and memory combined to perform a specific function. d. Smaller programs can be combined into large programs to create higher level abstractions.
a. Binary sequences are abstractions which are used to represent colors in an image.
A programmer is writing a system that is intended to be able to store large amounts of personal data. As the programmer develops the data system, which of the following is LEAST likely to impact the programmer's choices in designing the structure of the system? a. The frequency of a particular item occurring in a data set. b. Maintaining privacy of the information stored in the data set. c. Scalability of the system. d. Structuring the metadata of the information for analysis
a. The frequency of a particular item occurring in a data set.
To create a function that will draw 2 squares, which would be the best name option? a. draw_squares b. draw_shapes c. Draw_Two_Squares d. 2_squares
a. draw_squares
Which of the following is a true statement about data compression? a. Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user. b. There are trade-offs involved in choosing a compression technique for storing and transmitting data. c. Data compression is only useful for files being transmitted over the Internet. d. Regardless of the compression technique used, once a data file is compressed, it cannot be restored to its original state.
b. There are trade-offs involved in choosing a compression technique for storing and transmitting data.
Which of these is not a computing-related innovation for the medical field? a. Social media based health support groups b.Manual blood pressure monitor c.Heart rate monitors in smart watches d.A database with patient information
b. manual blood pressure monitor
What is the correct way to draw a circle that is filled in?
begin_fill() circle(20) end_fill()
Which program will have Tracy move forward 10, then turn left and move forward 20? a. distance = 10 distance = distance * 2 forward(distance) left(90) forward(distance) b. distance = 10 forward(distance) left(90) forward(distance) distance = distance * 2 c.distance = 10 forward(distance) left(90) distance = distance * 2 forward(distance) d. distance = 10 forward(distance) left(90) forward(distance
c. distance = 10 forward(distance) left(90) distance = distance * 2 forward(distance)
Which statement best describes the properties of public key encryption? a. Public key encryption makes use of certain types of problems which are easier for humans to solve than computers. b.Public key encryption makes use of mathematical problems which no algorithm can be used to solve. c. Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information. d.Public key encryption is a highly secure encryption scheme that in which a single shared key is used by both the sender and receiver of the message.
c. Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? a. When the problem can be solved in a reasonable time and an exact solution is needed b. When the problem can 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 approximate solution is acceptable d. 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
Which of the names below follow all naming rules? a. my_function b. Draw a Circle c. make_square d. 4_circles
c. make_square
What is a single physical device that contains millions or billions of basic electrical parts?
chip
How would a programmer change Tracy's trail to a yellow line with a thickness of 10 pixels?
color("yellow") pensize(10)
Which of the following is NOT a reason for loops can be useful when writing code? a. Loops help us write the same program with fewer lines of code b.Loops make it easier to alter code once it is written c. Loops make our code easier to read d.Loops help us make shapes of multiple sizes
d.Loops help us make shapes of multiple sizes
What would be the output of the following command? circle(50,180,3)
draws half a hexagon
Select the answer that lists the units of bytes in ascending order (from smallest to largest)
kilobyte, gigabyte, terabyte
The colors of the pixels in a digital image are often represented by red, green, and blue values between 0 and 255 (an RGB triplet). A photographer is manipulating a digital image to lighten it because all of the RGB values in the image are less than 100, making it very dark. He does this by adding 20 to the R, G, and B values of each pixel, then overwriting the original image. What type of transformation is the photographer using on the digital image?
lossless transformation
A raw digital sound file samples a sound wave at some interval and measures the height of the wave at each point. Thus, raw sound is recorded as a list of numbers. In very broad terms the MP3 audio compression algorithm identifies frequencies and volume levels - low and high - that are outside the range of human hearing and removes the data representing these frequencies from the original. This technique results in a smaller audio file that sounds exactly the same to the human ear. This technique is an example of what type of compression?
lossy compression
Select the two best answers to complete the sentence: If I understand how the Internet works then I will be able to: (Choose 2) -make informed choices about my privacy on the Internet. -connect the latest devices to the Internet. -assist me with choosing a cell phone plan - speed up my downloads of movies I purchase - make informed choices to support or oppose decisions my government makes about access to the Internet.
make informed choices about my privacy on the Internet and make informed choices to support or oppose decisions my government makes about access to the Internet.
Small chunks of information that have been carefully formed from larger chunks of information are called what?
packets
How would I collect a number from the user to use for the radius of a circle?
radius = int(input("What is the radius?: "))
In the process of digging, a landscaping company cuts a fiber line. Transmission of Internet traffic is still possible through additional pathways that provide alternate routes between the source and destination. The additional pathways describe a concept known as:
redundancy
If you use the command right(180), which way will Tracy turn?
she will turn around
Variables allow us to:
store information to use in our programs
If you want three circles to be drawn next to each other (as seen in the image below), after drawing the first circle, how far would you need to move Tracy before drawing the next circle?
the circle's diameter
Which is the proper way to call the function three_circles?
three_circles()
What is the correct way to ask a user for a "color" and store the answer as a variable?
user_color = input("Give a color: ")