AP Computer Science Principle: Unit 1

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

Use math to convert binary number 0110 to decimal

(8x0) + (4x1) + (2x1) + (1x0) = 4 + 2 = 6

Use math to convert binary number 1010 to decimal

(8x1) + (4x0) + (2x1) + (1x0) =8 + 2 = 10

compression

- decreases dynamic range - changes gray scale mapping - subtract compression dB from original dB to get compressed signal's dynamic range

Use 4 bit-binary to count from 1 to 10.

0001 0010 0011 0100 0101 0110 0111 1000 1001 1010

"#" is assigned to number 35. Write # in binary

00100011

"=" is assigned to number 61. Write = in binary

00111101

Capital "A" is assigned to number 65. Write A in binary

01000001

Lowercase "m" is assigned to number 109. Write m in binary

01101101

Fractions and decimal binary rule

1. Binary can precisely represent some fractional amounts from the decimal number system (Example: 4.75 or 1.5) 2. Binary cannot precisely represent other fractional values from the decimal number system (Ex: 0.39) Can be rounded.

How do we convert 116 to binary?

1. Divide 116 by 2 = 58 R 0 2. Divide 58 by 2 = 29 R 0 3. Divide 29 by 2 = 14 R 1 4. Divide 14 by 2 = 7 R 0 5. Divide 7 by 2 = 3 R 1 6. Divide 3 by 2 = 1 R 1 7. Divide 1 by 2 = 0 R 1 8. Write all the remainders, starting from 0R0 or 0R1: 1110100

How do we convert 733 to binary?

1. Divide 733 by 2 = 366 R 1 2. Divide 366 by 2 = 183 R 0 3. Divide 183 by 2 = 91 R 1 4. Divide 91 by 2 = 45 R 1 5. Divide 45 by 2 = 22 R 1 6. Divide 22 by 2 = 11 R 0 7. Divide 11 by 2 = 5 R 1 8. Divide 5 by 2 = 2 R 1 9. Divide 2 by 2 = 1 R 0 10. Divide 1 by 2 = 0 R 1 11. Write all the remainders, starting from 0R0 or 0R1: 1011011101

How do we convert decimal to binary.

1. Suppose x is a decimal. 2. Divide x by 2. Answer should be whole number, followed by a remainder. 3. Ignore the remainder and divide your answer (from step 2) by 2. Answer should be whole number followed by a remainder. 4. Repeat step 3 until you have 0R0 or 0R1. 5. The remainders (0,1) is x in binary. Order it starting from 0R0 or 0R1

In binary, the value of tenth and hundredth place are

1/2 and 1/4 respectfully OR 2⁻¹ and 2⁻² respectfully

Convert 2.511 to binary. Estimate if needed.

10.1

What Binary number represents "9"

1001

Use math to convert 11 to binary number

1011

convert 733 to binary

1011011101

Convert 1011.01101 to decimal

11.40625

Convert 13.67 to binary. Estimate if needed

1101.11

convert 116 to binary

1110100

Example of byte

11110110

A bunch of computer scientists take over an island and start their own country. They want the license plates to use binary numbers. There's space for 7 digits on each license plate and the first plate starts at 0000000. How many unique license plates can their country support?

128

If every color is represented as a mix of red, green, and blue... ... and we allocate a byte for the brightness of each of these colors ... ... how many colors can a computer represent?

16581375

The binary system works the same way as decimal. The only difference is that instead of multiplying the digit by a power of 10, we multiply it by a power of

2

Wifi can be turn off or on. What is the minimum number of bits that can be represented?

2

HOW DO WE ANSWER THIS: Convert 1011.01101 to decimal

2³+2¹+2⁰+2⁻²+2⁻³+2⁻⁵ =8+2+1+(1/2) + (1/8) + (1/32) =11.40625

HOW DO WE ANSWER THIS: convert 11.01 to decimal

2¹+2⁰+2⁻² =2+1+1/4 = 3.25

Formula for the highest number that can be represented by n bits

2ⁿ-1

Convert 11.01 to decimal

3.25

11111 in decimal

31

Decimal numbers less than 16 can be represented by

4-bit binary numbers (like 0000)

How many bytes long is this binary sequence? 1011100111011011011010010011010101111111

5

In Binary Numbers, the value of thousand digit can be represented as

8 or 2^3

How many bytes is equal to 72 bits?

9

bit

A contraction of "Binary Digit". A bit is the single unit of information in a computer, typically represented as a 0 or 1.

Sampling

A process for creating a digital representation of analog data by measuring the analog data at regular intervals called samples.

Lossy Compression

A process for reducing the number of bits needed to represent something in which some information is lost or thrown away. This process is not reversible.

Lossless Compression

A process for reducing the number of bits needed to represent something without losing any information. This process is reversible.

A programmer is designing a computer program for a weather application that will use a variety of data sources. They want to understand which data sources are analog so that they can think carefully about the process of converting the analog data into digital data. Which of these data sources is analog? A. Thirty Seconds from a thunderstorm in Miami B. Daily time of sunrise and sunset in New York C. Two weeks of weekly high temperature in Death Valley D. Predicted inches of snowfall in Juneau E. All of above

A. Thirty Seconds from a thunderstorm in Miami

A scanner is a device that can scan a piece of paper and encode it into a digital form. The resolution of a scanner measures the number of dots per inch (dpi) that it captures. This table lists the resolutions of various scanners: Canon CanoScan LiDE 300 - 2400 dpi Epson Perfection V39 - 4800 dpi Fujitsu fi-65F Image Scanner - 600 dpi HP Scanjet Pro 3500 f1 - 1200 dpi Which of the following comparisons between scanners is the most likely to be true? A..The Fujitsu scanner may capture some detail of a scanned document that the Canon scanner misses. B .The HP scanner may capture some detail of a scanned document that the Fujitsu scanner misses. C.The Canon scanner may capture some detail of a scanned document that the Epson scanner misses. D. The HP scanner may capture some detail of a scanned document that the Epson scanner misses.

B .The HP scanner may capture some detail of a scanned document that the Fujitsu scanner misses.

Which of these values can be stored in a single bit? A. 5 B. 0 C. 1 D. [0,1]

B. 0 C. 1

Suppose you have an alarm clock. Which of the displays could be represented by a single bit? A. Current day of week B. PM/AM indicator on the clock C. The current hour (1-12) D. Temperature Unit indicator (C/F) E. The current date (1-31)

B. PM/AM indicator on the clock D. Temperature Unit indicator (C/F)

A scientist is running a program to calculate the volume of a cone: radius ← 17.24 height ← 5.24 volume ← PI * (radius * radius) * (height / 3) The code relies on the built-in constant PI. After running the code, the variable volume stores 1630.9266447568566. Their supervisor checks their results by running the same calculation on their own computer. Their program results in a volume of 1630.9266447564448. The two values are very close, but not quite the same. Which of these is the most likely explanation for the difference? A.The two computers executed the arithmetic operations using a different order of operations. B. One of the computers has a bug in its mathematical operations. C. One of the computers experienced an integer overflow error when calculating the result D. The two computers represent the constant PI with a different level of precision, due to their rounding strategy or size limitations. E.One computer used an integer representation for the numbers while the other computer used the more accurate floating-point representation.

D. The two computers represent the constant PI with a different level of precision, due to their rounding strategy or size limitations.

Digital Data

Data that changes discretely through a finite set of possible values

Analog Data

Data with values that change continuously, or smoothly, over time. EXAMPLE: music, colors of a painting, or position of a sprinter during a race.

0 and 1

Different value and store information

Binary digit

Either character used in the binary number system, so a 0 or a 1.

A musician decides to make a digital recording of their concert so that they can share it with fans that cannot attend the concert in person. What is true about the process of converting the concert's audio waves into a digital recording?

If the recording equipment uses a very small sampling interval, the digital recording will be a very good representation but will not contain every detail.

Railways have devices called "axle counters" that count up how many train axles have passed by, and helps decide if a train has fully passed part of a track. However, because of a bug in the design of the axle counter logic, a train that has exactly 256 axles will result in a count of 0, and its existence will be ignored. Thus, trains that run on these buggy railways must have less than 256 axles. What is the most likely cause of this bug?

Integer overflow error

I am Sam, Sam I am. That Sam-I-am! That Sam-I-am! I do not like that Sam-I-am! Do you like green eggs and ham? I do not like them, Sam-I-am. I do not like green eggs and ham. What sequences could be replaced to compress the text?

Sam, like, am, eggs

Karla is making a website about the fluffiest dogs. She discovers a photo of a dog on a social media account Assuming US copyright laws, is Karla allowed to use the photo on her website?

She can use the photo if it is explicitly licensed for re-use, like with a Creative Commons license, and she follows the conditions of that license

Things that cab be stored in a single bit

Sound effects

HOW DO WE ANSWER THIS: A bunch of computer scientists take over an island and start their own country. They want the license plates to use binary numbers. There's space for 7 digits on each license plate and the first plate starts at 0000000. How many unique license plates can their country support?

The binary contains 7 digits 2⁷-1 =127 127 is the highest decimal number that can be represented by 7 bits- binary number. Including the 0, the binary numbers can be converted to 128 decimal numbers.

Binary

The binary number system is base 2, using only bits 0 and 1.

What is true about the process of converting analog data into digital data?

The digital version is a representation of the analog data but cannot include all of the details.

The binary number is old if and only if

The last digit of the bit ends with 1.

A photographer puts their photos online and encourages their fans to make memes with the photos by overlaying funny captions. What approach will allow fans to legally make memes of the photos?

The photographer should write "This work is licensed under a Creative Commons Attribution license."

Pixels

The smallest identifiable area of an image

Overflow Error

When the result of an addition is too big for the number of bits the computer works with

byte

a group of 8 bits

American Standard Code for Information Interchange (ASCII)

a standard code set for representing characters. It consists of 128 characters including letters, numbers, punctuation and symbols. Each character has been assigned a unique binary string.

Intellectual Property

a work or invention that is the result of creativity, such as a manuscript or a design, to which one has rights and for which one may apply for a patent, copyright, trademark, etc.

Creative Common

licenses that give everyone from individual creators to large institutions a standardized way to grant the public permission to use their creative work under copyright law.

Lossinter-frame coding: Instead of storing every pixel for every frame, the computer stores the differences between the pixels. lossless or lossy?

lossless

entropy coding: The computer replaces frequently occurring patterns of bits with shorter representations, remembering the replacements in a table. lossless or lossy?

lossless

subjective field of interest: The computer detects when a person is the focus of the video frame, and stores less information about the background. lossless or lossy?

lossy

Round-off Error

non-exact representation of decimal numbers, because of limitations in representing some decimal numbers with binary. For example, 63.10000000001 instead of 63.1.

Colors: Byte can be used to represent

the brightness of the color

copyright meaning

the legal right of the owner of intellectual property.

copyright infringement

when a copyrighted work is reproduced, distributed, performed, publicly displayed, or made into a derivative work without the permission of the copyright owner.


Conjuntos de estudio relacionados

3 C's (Commun./Nursing process, Pulmonary, Med. Adm., Wounds/Skin

View Set

Business Law Ch. 35 True & False

View Set