Answer
Flashcards · AP® Computer Science Principles · Unit 2
Unit 2: Data (DAT) flashcards
25 cards on topics 2.1 to 2.4. Pick a topic or study the whole unit.
Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.
Choose your cards
Session complete
Worth another look:
All 25 cards
For a quick read-through or printing. Cover the right-hand side to test yourself.
2.1 Binary Numbers
- What are a bit and a byte?
- A bit is a binary digit, 0 or 1. A byte is 8 bits.
- How do you convert binary to decimal?
- Add the place values above each 1, reading from the right: 1, 2, 4, 8, 16, 32, 64, 128. For 100110 the 1s are at 32, 4 and 2, so the value is 38.
- How do you convert decimal to binary?
- Take the largest place value that fits, write 1, subtract it, and repeat, writing 0 for place values not used. Or divide by 2 repeatedly and read the remainders from last to first.
- How many values can n bits represent?
- 2 to the power n different values, so each extra bit doubles the count. The largest non-negative whole number is 2 to the power n minus 1, because counting starts at 0.
- How many bits are needed for k different values?
- The smallest n such that 2 to the power n is at least k. For 200 character codes, 7 bits give 128 (too few) and 8 bits give 256, so 8 bits are needed.
- What is the difference between overflow and round-off?
- Overflow: a whole number is too large for the bits available. Round-off: a real number cannot be stored exactly with a fixed number of bits, so only an approximation is kept.
- What are analog data and sampling?
- Analog data change smoothly; digital data are discrete. Sampling measures analog data at regular intervals. More samples per second and more bits per sample give a better approximation.
2.2 Data Compression
- What is data compression?
- Reducing the number of bits needed to store or transmit data. Fewer bits does not necessarily mean less information.
- What is the difference between lossless and lossy compression?
- Lossless usually reduces bits and guarantees the original can be reconstructed completely. Lossy can reduce bits much more, but only an approximation of the original can be rebuilt.
- When should you choose lossless compression?
- When quality or exact reconstruction matters most, such as text, program code or a document, where one changed character could change the meaning.
- When should you choose lossy compression?
- When minimising size or transmission time matters most and some loss of quality is acceptable, such as streaming video or photographs. Name the trade-off in your answer.
- How does run-length encoding work?
- It stores a value and the length of its run. WWWWWBBWWWWWWWW becomes 5W2B8W: 15 characters become 6. It is lossless, and it can make data longer if there are few repeats.
- How do you work out the percentage saved by compression?
- (original size − compressed size) ÷ original size × 100. Divide by the original size, not the compressed size. For 15 reduced to 6 the saving is 9 ÷ 15 = 60%.
2.3 Extracting Information from Data
- What is the difference between data and information?
- Data are values. Information is the facts and patterns extracted from data.
- What is metadata, and what happens if it is changed?
- Metadata are data about data, such as date, size, author or location. They help find and organise data. Changing or deleting metadata does not change the primary data.
- What does it mean to clean data?
- To make entries uniform without changing their meaning, for example typing the same answer in one consistent format. Cleaning must not merge answers that really differ.
- Why does a larger data set not remove bias?
- Bias comes from the type or source of the data. More data from the same biased source repeats the bias; data from a wider range of sources is needed.
- Why does correlation not show causation?
- Two variables can move together because of a third factor. Umbrella and raincoat sales both rise in rainy weather; neither causes the other. More research, such as weather data, is needed.
- What is the difference between filtering and transforming data?
- Filtering keeps only the items that meet a condition, usually giving fewer items. Transforming applies the same change to every item, giving the same number of items.
2.4 Using Programs with Data
- What are the four main ways a program processes a list of data?
- Transform every element, filter to keep some elements, combine or compare to reduce many elements to one result (a total or a maximum), and visualise as a chart, graph or table.
- What does a transform produce?
- A result with the same number of elements as the input. Doubling every price in a list of 5 prices gives a list of 5 prices.
- What does the filter pattern look like in code?
- FOR EACH item IN list { IF(condition) { APPEND(result, item) } }. The result may be shorter than the input.
- What does this code display for the list [3, 8, 5, 10]? total ← 0, FOR EACH n IN list { IF(n > 4) { total ← total + n } }, DISPLAY(total)
- 23. It keeps only 8, 5 and 10, which are greater than 4, and adds them. It both filters and combines.
- What are clustering and classifying?
- Clustering groups similar items together. Classifying assigns items to categories. Both help find patterns and insight in data.
- How can you avoid a misleading result when comparing groups?
- Clean the data first, check the data are representative, and compare shares or averages rather than totals when the groups differ in size. A chart shows a pattern, not a cause.
Study Unit 2 further
- 2.1 Binary Numbers Study guide: 2.1 Binary NumbersRevision notes: 2.1 Binary NumbersPractice questions: 2.1 Binary Numbers
- 2.2 Data Compression Study guide: 2.2 Data CompressionRevision notes: 2.2 Data CompressionPractice questions: 2.2 Data Compression
- 2.3 Extracting Information from Data Study guide: 2.3 Extracting Information from DataRevision notes: 2.3 Extracting Information from DataPractice questions: 2.3 Extracting Information from Data
- 2.4 Using Programs with Data Study guide: 2.4 Using Programs with DataRevision notes: 2.4 Using Programs with DataPractice questions: 2.4 Using Programs with Data
AP® and Advanced Placement® are trademarks registered by the College Board, which is not affiliated with, and does not endorse, this website. Marlbridge is an independent tuition provider. It is not an authorized AP course provider, an AP school or an exam centre, and these resources are not official College Board materials. Reading them or doing simulations does not meet the laboratory requirement of an AP science course.