AP Computer Science Principles Exam
Which of the following is not a raster-graphics format?
Flash
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing out the letters of a word "HELLO"
Function(s)
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing a circle of any size at any point on the screen
Functions
Which of the following is NOT true about functions in programming?
Functions cannot make calls to other functions within the same program.
The various protocols in use on the internet are said to operate in layers in which the protocol(s) at each layer solve one problem related to networked communication, and higher layers are built on top of, and rely on, the lower layers to do their jobs. From the list provided choose the two (2) answers that correctly describe which internet protocol relies on the other. For example: if protocol A relies onprotocol B, it means that A is a higher level protocol than B, and thus protocol B must exist and work properly in order for protocol A to do its job. Select two answers.
HTTP relies on TCP/IP DNS relies on TCP/IP
Which of the following provides a way to uniquely identify a single computer among all others on the Internet?
Hostname
Which text compression technique uses variable-length binary strings to represent characters, assigning frequently used characters short codes?
Huffman Encoding
Which of the following is made up of 128 bits?
IPv6 address
How does a computer resolve a domain name into an IP address?
It asks a DNS server for the corresponding IP address
what is lossy data compression?
It is a form of data compression that reduces the data file size with an acceptable loss of data information. It does not allows the original file to be restored.
what is lossless data compression?
It is a form of data compression that reduces the data file size without any of loss of data information. It allows the original file to be restored.
What is the best explanation for why digital data is represented in computers in binary?
It's easier, cheaper, and more reliable to build machines and devices that only have to distinguish between binary states.
Consider the following incorrect program, which is intended to move the robot around the perimeter of a grid, as indicated by the drawing below. The starting position and direction of the robot is indicated in the diagram. Line 1: REPEAT 4 TIMES Line 2: { Line 3: MOVE_FORWARD() Line 4: ROTATE_RIGHT() Line 5: MOVE_FORWARD() Line 6: MOVE_FORWARD() Line 7: MOVE_FORWARD() Line 8: MOVE_FORWARD() Line 9: ROTATE_RIGHT() Line 10: } Fig: What the robot is supposed to do Given the options below, which lines should be removed so the program will work as intended?
Line 3 and Line 4
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
Which of the following BEST describes how protocols on the Internet (e.g. IP, TCP, HTTP) make use of abstraction to accomplish their respective purposes?
Low level protocols can provide functionality to high level protocols without revealing the details of how this is accomplished.
Which audio format is the most popular today?
MP3
The image below shows an encoding for a black and white pixel image. The first two bytes of the data (circled in red) are used to encode the width and height of the image. What is the best term for this type of "data about the data"?
Metadata
Which of the following most accurately describes Moore's Law:
Moore's Law is the observation that computing power tends to double every two year
Why are parameters useful when programming?
Parameters allow for more flexible, generalized behaviors in functions.
Which of the following can be used to express the value of every number in any number system?
Polynomial
When programmers work together, what is an example of how abstraction in programming can promote collaboration?
Programmers can use functions created by their partners, relying on the functionality without needing to know the specific details of how the function is implemented.
Which of the following statements best describes the properties of public key encryption?
Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Which of the following statements are true about routers and routing on the Internet. Choose two answers.
Routers act independently and route packets as they see fit. A packet traveling between two computers on the Internet may be rerouted many times along the way or even lost or "dropped".
Number systems with different bases such as binary (base-2) and decimal (base-10) are all used to view and represent digital data. Which of the following is NOT true about representing digital data?
Some large numbers cannot be represented in binary and can only be represented in decimal.
Two students working on a project together don't want their classmates...
Symmetric encryption
Which of the following breaks messages into packets, hands them off for delivery, and then orders and reassembles them at their destination?
TCP
Which of the following is NOT true about TCP/IP packets?
TCP guarantees that no packets are ever dropped
Which of the following is a suite of protocols and programs that support low-level network communication?
TCP/IP
Which of the following is a high-level protocol used to log into a computer system from a remote computer?
Telnet
What is the most likely outcome of running the code shown below? drawStar(0);
The program will run without error, but will not draw anything.
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.
Which of the following indicates the general type of an organization or a country of origin?
Top-Level Domain
Bandwidth is the number of bits or bytes that can be transmitted from one place to another in a fixed amount of time.
True
Information is data that has been organized and/or processed in a useful way.
True
True or False? Huffman encoding uses variable length binary strings to represent particular characters.
True
Which of the following is true about the way digital data is transmitted on the Internet?
Two devices must communicate using the same bit-rate to successfully send and receive digital data.
Which one of the following statements about functions is TRUE
Two functions in a single program can have different names but contain identical code.
Which of the following statements about writing functions and Top-Down Design is NOT true?
Two programmers solving the same problem using Top-Down Design should arrive at identical programs.
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
A school starts tracking which websites each computer in the school is visiting by monitoring the packets leaving the school. A sample of the information they have collected appears below:Which of the following is MOST likely to be answerable using all the data collected by this monitoring?
Which websites are most frequently visited before and after school hours from a school computer
Which of the following scenarios is most characteristic of a phishing attack.
You get an email from the IT support desk that asks you to send a reply email with your username and password to verify your account
Select the two true statements about functions with parameters:
a. Parameters help generalize the solution of a specific problem. b. Functions with parameters can be used to prevent the creation of duplicated code.
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com?
about.example.com
Which of the following blocks is least similar to the others?
arcLeft(angle, radius)
Which of the following will call the function drawStar?
drawStar();
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
Which of the following is a computer on a LAN that handles all communication between that network and others?
gateway
Which of the following is generally made up of readable words and uniquely identifies a particular computer among all the computers on the Internet?
hostname
what is metadata?
it is data about data, such as file size, data format, creation date, etc
Which of the following is true about representing color as an RGB value?
it mimics the way color is perceived by the human eye
Select the answer that lists the units of bytes in ascending order (from smallest to largest)
kilobyte, gigabyte, terabyte
What is now the primary reason for compressing data?
limited network bandwidth
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing a hexagon (six-sided shape)
loop
A compression scheme for long strings of bits called run-length encoding is described as follows: Rather than record each 0 and 1 individually, instead record "runs" of bits by storing the number of consecutive 1s and 0s that appear. Since it's binary, any run of 0s must be followed by a run of 1s (even if the run is only 1-bit long) and vice versa. Thus, you can store a list of small numbers that represents the alternating runs of 0s and 1s. Here is an example: To uncompress the data back into its original binary state, you simply reverse the process. This technique is an example of what type of compression?
lossless compression
What is a group of four binary digits called?
nibble
What is the lowest base in which the number 767 could be a valid number?
octal
How is it possible to reduce data file in size for compression and then restore it to its original format without any loss of information?
repetitive data, like a color on an image, can be stored with a formula
The world is currently in a transition to using IPv6, a newer version of the IP protocol that uses 128-bit addresses instead of 32-bit addresses used by IPv4. What is the main problem that IPv6 was created to solve?
32-bit addresses could not ensure that every internet-connected device can receive a unique IP address
How many bytes are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode each pixel with 24 bits of RGB data?
3753
Graphics images are stored as two dimensinal arrays of pixels. Many use 24-bits of memory space for each pixel. This is further divided up into three 8-bit sequence s that stores the RGB (RED, GREEN , BLUE) value of each pixel. if 24-bits are used for one pixel and this pixel's color is determined by the three Red, Green and Blue value, each using 8-bits, how many different color combination exitst for a pixel?
16,777,216
How many digits are there in the binary number system?
2
What is the modulo of 257 MOD 59 =
21
Two students have developed a protocol in which they send 4-bit messages to each other. They decide to modify their protocol to start sending 8-bit messages instead. How many more values can be represented in an 8-bit message than a 4-bit message?
24 = 16 times as many values
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.
What is the minimum number of bits needed to represent 6 things?
3
Consider the following three binary numbers: 01010 010000 1110 Which of the following lists the numbers in order from least to greatest?
01010, 1110, 010000
Which number represents the value of the base in every number system?
10
A computer program is originally designed to store customer identification using a 6-bit binary sequence. As the number of unique customers grows the program mest handle a far greater number of identifications than were originally possible. The new program must handle 12 times the original customer size. Which of the following binary sequence uses the smallest amount of memory and can still handle new requirements?
10-bit binary sequence
Approximately how much bigger (how many more bytes) is a megabyte than a kilobyte?
1000 times bigger
Consider the following three numbers 10100(base 2), 123(base 10), d7(base-16) which of the following displays the numbers in ascending order?
10100, 123, d7
if the decimal number 89 represents ASCII charater Y, what binary number is used to strore ASCII charater Q?
1010001
consider the following four numbers 101010(base 2), 43(base 10),101100 (base 2), 37( base 10) which of the following displays the numbers in descending order?
101100(base 2) 43(base 10) 101010 (base 2) 37( base 10)
The chart below show ASCII encoding for some charaters what binary number is used to store char c?
1100011
What is the 4-bit binary number for the decimal number fifteen (15)?
1111
consider the following four binary numbers 11100111 , 10101010, 11110000, 11001100 which of the following displays the numbers in the decending order?
11110000, 11100111, 11001100, 10101010
consider the following four hexadecimal numbers AB3D2A, FEDCB, 11A2B, A7BC26 Which of the following displays the numbers in asscending order?
11A2B,FEDCB, A7BC26,AB3D2A,
The next two questions use a robot in a grid of squares. The robot is represented as a triangle, which is initially facing up, towards the top of the grid. The robot is moved according to the following instructions. Instruction Explanation MOVE_FORWARD() The robot moves one square forward in the direction it is facing. ROTATE_RIGHT() The robot rotates in place 90 degrees clockwise (i.e., makes an in-place right turn). ROTATE_LEFT() The robot rotates in place 90 degrees counterclockwise (i.e., makes an in-place left turn). REPEAT n TIMES The block of instructions contained between the braces { } is repeated n times. Consider the following program which uses commands from the pseudocode described above. REPEAT 4 TIMES { MOVE_FORWARD() MOVE_FORWARD() MOVE_FORWARD() ROTATE_RIGHT() MOVE_FORWARD() ROTATE_RIGHT() MOVE_FORWARD() ROTATE_RIGHT() } Which of the following images shows the path and ending location of the robot that will result from executing the code above. The starting location of the robot is shown as dotted triangle for cases where the robot does not start and end at the same location.
5 boxes 4 in different corners one in middle
What is the minimum number of bits you would need to encode the 26 upper and low case letters of the alphabet plus a space - a total of 53 characters?
6 bits
What is the largest digit in the octal number system?
7
Which line of code should be removed to make the program do what it's supposed to? A programmer wants to write a program in which the turtle draws 8 squares in a row while moving forward. The final result should look like this: But something is wrong! The incorrect code is shown below. The programmer has attempted to write a function to draw a single square. Then he wrote another function that attempts to call that function 8 times. Mentally trace through the code and determine which line of code should be removed to make the program do what it's supposed to.
7
How many things can be represented using three bits?
8
Pick the two expressions involving the Modulo operation that compute to the exact same value (choose 2)
9 MOD 8 1 MOD 16
8 bits is enough to represent 256 different numbers. How many total bits do you need to represent 512 (twice as many) numbers?
9 bits
Choose the answer that is NOT a feature of Public Key Cryptography:
A Public Key database ensures 3rd party accountability of security
What is one important naming convention of functions?
A function name should be as descriptive as possible to indicate what the function does.
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.
what is the function parameter?
A way to give input to a function that controls how the function runs.
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. ASCII characters can also be represented by binary numbers. According to ASCII character encoding, which of the following letters is represented by the 8-bit binary value:0100 0010
ASCII Character: B
A middle school is expanding to open a high school next year, doubling the total number of students. The school keeps a database in which each student's unique ID number is stored as an 8 bit number called studentID. Before the arrival of the new students almost every 8 bit number has already been assigned to a student. Of the options provided below, which is the smallest change to the way studentID is represented necessary to ensure each incoming student receives a unique ID?
Add a bit to studentID to double the number of IDs that the database can represent.
How automatic collection of data is a privacy concern
All of the above
social media companies, like Facebook, lower picture quality of high reslotion images before posting them on the Internet. Why is this an acceptable practice?
All of the above
what is API?
Application Program Interface
Which of the following blocks is least similar to the others?
B. turnLeft(angle);
Which of the following describes a set of high-speed networks on the Internet, sponsored by companies such as AT&T and Verizon?
Backbone
Which of the following terms is synonymous with the term data transfer rate?
BandWidth
What is the lowest base in which the number 10 could be a valid number?
Binary
Programming languages have some similarities and differences to the "natural" language you use in everyday speech. Select the two true statements about programming languages:
Compared to the number of words in a natural language, the number of defined words in a programming language is very small. Ambiguities in natural language necessitate the creation of programming languages for controlling a computer
The figure represents a network of physically linked computers labeled A through F. 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. The weight or cost of sending information from one computer to another is indicated by the number above the line. For example, information can be sent directly between computers A, and B and will cost 5. Information sent between computers A and D must go through either computer C (with total cost 5), or through computer B (with total cost 8) Question: Computer A sends a packet intended to reach computer F. Along its path it arrives at Computer C. Which computer should Computer C forward the packet to in order to use the most cost effective path?
Computer D
Which of the following images represents the most likely output produced by the code segment given below? moveForward(random Number(15,75);
D. rectangle bunched up coming out of each other