AP CSP Test 2
Suppose we have the following function that modifies a pixel and returns the result: var RED = 0; var GREEN = 1; var BLUE = 2; function filter(pixel) { pixel[RED] = 255 - pixel[RED]; pixel[GREEN] = 255 - pixel[GREEN]; pixel[BLUE] = 255 - pixel[BLUE]; return pixel; }
The image will be inverted, bright pixels will become dark and dark pixels will become bright.
Which of the following is true about lossless data compression?
The compressed data can be restored back to its original state
What is the range of values (expressed in decimal) that each color channel can have?
0base10 - 255base10
What is the value of 9Fbase16 in binary?
1001 1111
Consider the following numbers: The decimal value 10base10 The binary value 1001base2 Hexadecimal value Cbase16 Which of the following lists the number in order from least to greatest?
1001base2, 10base10, Cbase16
What is the value of 13base10 in binary?
1101
What is the decimal value of 1101base2?
13base10
What is the value of F16 in decimal?
15base10
How many different digits are used in the Hexadecimal number system?
16 (0 1 2 3 4 5 6 7 8 9 A B C D E F)
How many different values can be represented using 4 bits?
16 different values
What is the number base of the binary number system?
2
Which of the following best describes the result of using 9-bit values instead of 8-bit values?
2 times as many items can be uniquely identified
Suppose the ESPN website uses 8-bit unsigned integers to store how many points a team has scored in an NBA game. For example: 0000 0010 represents 2 points 0000 1000 represents 8 points What is the highest possible score the ESPN website could display?
255base10
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
How many possible values can be created with only 2 bits?
4
In the binary value 100base2, what is the place value of the 1?
4s place
How many bits are used to encode a character according to the ASCII encoding scheme?
8 bits (ex: 0100 0001 encodes 'A')
What is a pixel?
A single tiny dot, or square, of color in a digital image.
A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 6 and 2, the result is 0. Which of the following is the best explanation for this result?
An overflow error occurred.
Which number system is used to store information digitally in a computer?
Binary (base 2)
Which of the following describes the instructions for a general image filter?
Given an image: for every (x, y) coordinate in the image Get the current pixel at (x, y) Modify the pixel according to a function Update image at (x, y) with this modified pixel
Which of the following are true about Symmetric Key Encryption? I: The same key is used for both encryption and decryption II: The sender and receiver must exchange a shared key in private before using symmeric key encryption to communicate III: Symmetric key encryption is the most common form of encryption for internet communication
I and II only
Which of the following statements are true about Caesar's Cipher? I: Caesar's Cipher is a form of Symmetric Encryption II: Caesar's Cipher is a "hard" encryption to crack
I only
Which of the following are true about Public Key Encryption? I: It requires all senders and receivers to have their own public key and their own private key II: A message encrypted with a person's public key can only be decrypted with the same person's private key III: A public key can be shared with anyone IV: Public key encryption is the most common form of encryption for internet communication
I, II, III, and IV
Which of the following is true about lossy compression?
Lossy compression can compress data down to significantly less bits than lossless compression can Data compressed with lossy compression cannot be restored back to its original state Lossy compression throws away a lot of the original data, but humans can't even tell anything is missing. (all of the above)
Which of the following instructions would brighten a pixel? Assume R is the red value of the pixel, G is the green value, and B is the blue value.
R = Math.min(R + 50, 255); G = Math.min(G + 50, 255); B = Math.min(B + 50, 255);
Which of the following pixels has a color value of #ff0000 (expressed in hexadecimal)
Red Pixel
What are the 3 color channels that make up a pixel according to the RGB color scheme?
Red, Green, and Blue
Which of the following are examples of encoding information?
Representing fast food meals as numbers on the menu. For example a number 1 represents a hamburger. Assigning a numeric value to every area of a region, for example zip codes in the United States Assigning a number to every character of the alphabet so we can represent sentences as series of simple digits.
What is data abstraction?
The process of simplifying complicated data into manageable chunks
A student is transferring photos from her camera to her computer. The student notices that the saved photos on her computer are lower quality than the original raw photo on her camera. Which of the following could be a possible explanation for the difference in image quality?
The saved image files were compressed with a lossless compression technique.
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 is a true statement about the color encoded by this binary sequence: 1110 1001 0111 1100 0000 1111
This color is mostly red.
Why do we compress data?
To save memory space on devices To speed up the time it takes to send a file over the internet The computation it takes to decompress data is cheaper than the storage space required to store uncompressed data (all of the above)
Which of the following functions properly removes all green and blue from a pixel and returns the modified pixel?
var RED = 0; var GREEN = 1; var BLUE = 2; function removeGreenAndBlue(pixel) { pixel[GREEN] = 0; pixel[BLUE] = 0; return pixel; }