UNIT 3 STUDY GUIDE (Creating Graphics & Images Bit by Bit)

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

set Button1 BackgroundColor to red

-Set the background color using only 1 Set block. -Complete the block shown here so that it sets Button1's BackgroundColor to red.

When testing software, it is important to test critical values or boundary values--both valid and invalid values at the extremes of a range of legal values. In an app where the user enters a number for the month of the year, what would be appropriate boundary values to check?

0 and 1, also 12 and 13

Describe briefly two examples of "code smell" and how refactoring would eliminate them.

Some examples of code smell are methods that are too long, and a repetitive use of the same code. Refactoring would make it so that in long methods one or more smaller subroutines can be extracted, and duplicates can be removed and replaced with one shared function.

List

Stores multiple items under one variable name and uses an index to number and access them.

Operator

Symbols like +,-,*,/ used for addition, subtraction, multiplication, division.

The Lists drawer contains lots of blocks such as

insert item into list and select random item from list that let you manipulate the items in the list

What does the following AP CSP pseudocode display? Remember to trace through the code keeping track of the values in a and b after each line of code. a ← 1 (Set a to 1) b ← a (Set b to the current value of a) b ← b + 1 (Add 1 to b) a ← a + b (Set a to be the current value of a + b) DISPLAY(a) DISPLAY(b)

3 2

What are some of the limitations of using parity bits for error detection?

An example of a limitation in using parity bits is the occasion in which multiple errors are made in multiple rows and columns.

List are sometimes called

arrays

Byte

8 bits.

Parity Bit

A bit that acts as a check on a set of binary values, calculated in such a way that the number of 1's in the set plus the parity bit should always be even (even parity) or should always be odd (odd parity).

ASCII

A code for representing English characters as numbers, with each letter assigned a number from 0 to 127

Run Length Encoding

A compression algorithm that represents an image in terms of the length of runs of identical pixels

Lossless Compression

A data compression technique in which no data are lost.

Lossy Compression

A data compression technique in which some amount of data is lost.

String

A sequence of characters that can be stored in a variable or list.

Bitmap

A type of memory organization or image file format used to store digital images.

Megabyte

A unit for characterizing the amount of data. It is roughly 1 million bytes or, more precisely, 220 bytes, which is 1,048,576 bytes.

□ 10 🗹 paintBrush □ "hello" □ true 🗹 x

A variable is an abstract symbol that refers to some particular value. Which of the following symbols is a variable? □ 10 □ paintBrush □ "hello" □ true □ x

How do APIs simplify complex programming tasks? Pick an app that you use on your device (e.g. Twitter, Google Maps) and see whether it provides an API and some of the functions you can control with it. Describe your results below.

APIs simplify complex programming tasks by using software to choose an output of what users see. For example, google maps uses APIs when its providing the locations and routes for people. Google maps uses APIs to give you visual directions (like the route along the roads) rather than just coordinates and the worded directions.

GPS

Allows people to pinpoint their geolocation (geographic location) on Earth using satellites.

How are audio files digitized?

Analog refers to data with values that change continuously, or smoothly, over time, like sound or music files. Analog data is converted to a digital forms, 0s and 1s in binary, using a sampling technique, which means measuring values of the analog signal at regular intervals (usually in time or space) called samples. The samples are measured to figure out the exact bits required to store each sample. The use of digital data to approximate real-world analog data is a great example of abstraction!

Megapixel

One million pixels, used in reference to the resolution of a graphics device.

Digital

Any system based on discontinuous data or events. Computers are digital machines because at the basic level they can distinguish between just two values, 0 and 1.

Vertically

By default, when you add components to the App Inventor Viewer they are laid out ___________.

Another type of error detection is a check sum. Research what a check sum is and then describe it in your own words. Can a check sum identify where an error occurs?

Check sum is the added total of the bits in a single string. Check sum cannot tell where an error occurred because it only determines if the string is correct or not.

What is code smell?

Code smell is code that isn't technically wrong but negatively impacts the quality of the code.

Abstract Data Type (ADT)

Defines a general data type like list that describes a collection of data without worrying about the specific implementation.

API

Defines how other programs can communicate with it and use it.

Spam

Electronic junk mail or junk newsgroup postings.

Explain in your own words the difference between error detection and error correction. Describe how the error correction process used in the video above allows the computer to fix errors.

Error detection is simply finding errors while error correction is reconstructing the code to make it correct. The error correction process in the video allows the computer to fix errors by adding extra/redundant bits to the string that help make the preexisting string correct (adding extra bit if original was odd).

The card "trick" shows that it is always possible to identify the card that was flipped as long as only one card was flipped. Would it be possible always to determine if an error occurred if two cards were flipped?

If the two flipped cards weren't in the same row or column, then it might be possible to determine if two cards were flipped. However, if they were in the same row or column, then they would,in a way, cancel each other out, in the sense that they would form an even party bit instead of two odd parity bits.

Parity

In math, means the fact of being even or odd.

B

In the video, you learned how black and white images can be represented using bits and numbers. What letter of the alphabet would be represented by the following set of numbers representing its RLE compression? You can use the interactive pixel grid above under Practice or in another tab to work this out.1, 4, 21, 1, 3, 1, 11, 1, 3, 1, 11, 5, 11, 1, 4, 11, 1, 4, 11, 1, 4, 11, 5, 1

Expression

Involves values, variables, and operators for example (a+b)/2

How does JPEG encoding work?

JPEG is an example of a lossy compression algorithm. JPEG, which uses the file extension .jpg or .jpeg, is the most common format used today to represent images.The JPEG algorithm was created by the Joint Photographic Experts Group (JPEG), hence its name. The fact that JPEG is a lossy technique means that some of the information present in the image is lost during compression and cannot be recovered. Here is a video lecture on the JPEG compression algorithm (Teacher Tube version). The compression algorithm involves some math, but the video describes just enough of the math so that you can see how JPEG works. The video is a summary of an excellent, more detailed presentation by Randell Heyman -- you should really check out the Heyman video if you are interested in more of the mathematical details.

Cryptography

Means, literally, 'secret writing'. The art and science of writing secret messages.

Abstraction helps programmers use less code and understand the information better because its simpler.

One aspect of abstraction is that it helps to reduce details to focus on what's relevant. How does the use of a variable, such as dotsize, instead of a value, such as '5', help to reduce detail and focus on what is essential in this program.

Substring

Part of an existing string.

What are the advantages of using procedural abstraction? Try to name at least 2 advantages.

Procedural abstractions help to simplify code, make it easier to read, and shorten the process of changing code functions.

Data Abstraction

Provides a general way to access a collection of data.

Concatenation

Putting two strings together to make a new string.

Analog

Refers to data with values that change continuously, or smoothly, over time like sound and music files

Sampling

Refers to measuring values of the analog signal at regular intervals (usually in time or space) called samples in order to digitize it into a binary representation.

Cloud Computing

Relies on sharing resources online on the Internet rather than having data and process located on a personal computer.

abstraction at work

Representing an image digitally is an example of

set Button1 TextColor to magenta

Set the text color using only 1 Set block (do not put in Button.click event handler)

Assignment

Sets a variable to a value or a mathematical expression.

Bit

Short for 'binary digit'

Pixel

Short for a picture element, a single point in a graphic image.

Stenography

The art and science of hiding information by embedding messages within other, seemingly harmless messages.

Give a specific example of a binary sequence that can represent more than one type of data -- e.g., a number, a color, a character -- and describe how to interpret its different values.

The binary sequence 01000001 can represent the decimal number 65, the color magenta, or the letter A. The meaning of a binary sequence really just depends on how it is being used; for example, if a binary sequence is being used in an image, one can assume that it is a color rather than a number or letter.

🗹A variable is more general and more abstract than a specific value such as 5. 🗹 Using a variable instead of a specific value makes an app more generally useful. 🗹 A variable is an abstract symbol that can represent lots of different values. □ Using a variable instead of a specific value makes an app more vague.

Using a variable is an example of abstraction because □ A variable is more general and more abstract than a specific value such as 5. □ Using a variable instead of a specific value makes an app more generally useful. □ A variable is an abstract symbol that can represent lots of different values. □ Using a variable instead of a specific value makes an app more vague.

Describe what it means to say that JPEG is a lossy compression technique and whether or not it affects the quality of camera pictures.

When a compression technique is lossy, it loses some data. Although JPEG is a lossy compression technique, it doesn't affect the quality of the picture because the data it loses is invisible to the human eye.

Describe an algorithm for identifying the card that was flipped

When looking at the cards If there is an odd number of face-up cards in a row and column Then the row and column with an odd number of face cards had a card flipped Else no card was flipped

Explain how the error card trick from the Error Detection lesson uses a parity scheme. Was it an even or odd parity scheme?

The error card trick used parity scheme by adding an extra bit to the end of each string of bits in order to make the number of 1s/faces in each row and column even. It was an even parity scheme because it needed an even number of 1's/faces to be correct.

Even Parity

The number of 1s in the sequence add up to an even number.

Odd Parity

The number of 1s in the sequence add up to an odd number.

Index

The number or position of an element in the list.

Render

The process of adding realism to a computer graphics by adding 3-D qualities, such as shadows and variations in color and shade.

OCR

The process of reading text from paper and translating the images into a form that the computer can manipulate.

Modeling

The process of representing a real-world object of phenomenon as a set of mathematical equations.

Raster

The rectangular area of a display screen actually being used to display images.

Data Type

The type of data stored in a variable, for example number, string, boolean, or list.

Download

To copy data (usually an entire file) from an online source to a personal computer.

initialize global Z to 10 set global Z to add get global Z+16

Use a setter to increment global Z by 16.

D)

Which of the following is a true statement about data compression? A) Data compression is only useful for files being transmitted over the Internet. B) No matter what compression technique is used, once a data file is compressed, it cannot be restored to its original state. C) Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user. D) There are trade-offs involved in choosing a compression technique for storing and transmitting data.

□ Button1 □ ButtonOne 🗹 ButtonRefresh □ B1 🗹 RefreshButton

Which of the following would be a good name for a button whose purpose was to allow the view to refresh the screen? □ Button1 □ ButtonOne □ ButtonRefresh □ B1 □ RefreshButton

userName

Which of the following would be a valid App Inventor variable name?

Fill parent

Which value would you set the Width property to if you want your component, e.g., a Button, to fill its container?

X ← X + 1

X is the initial number and it is apparently 10. If you add 1 and 10 you get 11.

To define a list, we can create a global variable that can be initialized to

an empty list (a list with no items on it)

In the AP CSP pseudocode, lists are represented using square brackets [ ] as shown below. The assignment operator ← (the left-pointing arrow) can be used to assign a value to a variable. This value can be any data type including a number, a string, a boolean, or a list. So the initialization of the global variable for the destinations list in App Inventor would look like this in the AP pseudocode:

destinations ← [ "Statue of Liberty", "Chichen Itza" ]

Data abstractions manage complexity in the program by

giving a collection of data a name that can be used without knowing the specific details of its representation

run-length encoding (RLE)

image compression technique.

Define a procedure named double that doubles the global variable X.

initialize global Z to 1

abstract data type

list

we can assign the variable a specific list of items using

make a list

Procedural Abstraction

the ability to name a block of code in a procedure and call it whenever needed

The items in a list are indexed which means

they are numbered from 1 to the length of the list

The simplest data abstraction in programming

variable

Notice that a variable in App Inventor can hold a single data item like a number or a whole list containing many items. Actually, variables in App Inventor can hold a variety of data types including:

‣Numbers: integers or decimal numbers, ‣Strings: text, any sequence of characters you can type on a keyboard, represented inside quotes like "Hello World! 123". ‣Booleans: like true or false ‣Lists: a collection of related items given a name. The items can be any data type but they are usually all the same data type, for example all strings or all numbers.

What does refactoring mean? □ Restructuring a program to make it behave differently. □ Changing the way the program behaves. □ Revising a program to remove bugs. □ Restructuring a program without changing its basic behavior.

□ Restructuring a program to make it behave differently. □ Changing the way the program behaves. □ Revising a program to remove bugs. 🗹 Restructuring a program without changing its basic behavior.

Which of the following statements are true for a TinyDb component. Choose all that apply. □ a. Data stored in a TinyDb can easily be shared with other devices and users. □ b. Data stored in a TinyDb will persist between different uses of the app. □ c. Data stored in a TinyDb disappears when you quit the app. □ d. Data stored in a TinyDb is stored in the cloud. □ e. Only strings (text) can be stored in a TinyDb.

□ a. Data stored in a TinyDb can easily be shared with other devices and users. 🗹 b. Data stored in a TinyDb will persist between different uses of the app. □ c. Data stored in a TinyDb disappears when you quit the app. □ d. Data stored in a TinyDb is stored in the cloud. □ e. Only strings (text) can be stored in a TinyDb.

For this table, identify the bit that was flipped. 1001 1111 0011 0100 □ The bit in row 4 column 4. □ The bit in row 4 column 3. □ The bit in row 1 column 2. □ The bit in row 2 column 2.

🗹 The bit in row 4 column 4. □ The bit in row 4 column 3. □ The bit in row 1 column 2. □ The bit in row 2 column 2.

True or False: It is possible to have an empty list -- i.e., a list with no elements. □ True □ False

🗹 True □ False


Conjuntos de estudio relacionados

PSY MODULE 42 MAJOR DEPRESSIVE DISORDER AND BIPOLAR DISORDERS

View Set

Part 2 managment chpt 6 and part of 7 W

View Set

Chapter 43: Assessment of Digestive and Gastrointestinal Function 3

View Set