Chapter 3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

RLE Compression

#of white pixels, # blacks, etc., lossless compression technique

Tiny DB

app inventor's database, values stored and retrieved by their tag, stores data permanently on device, will return empty space if cannot find

It would crash because there is no item with that index

What do you suppose would happen if your app asked App Inventor for the item at index 10 in the list of 8 items shown here?

lossless compression

data compression techniques in which no data is lost

lossy compression

data compression techniques in which some amount of data is lost.

Amount of RLE Compression

depends on # bits /pixel, but depends on # of different colors in the image (the more colors, more color changes, more numbers needed)

Comments

document what every procedure does, clarify any complex algorithms you do, helps future programmers maintain your code

Refactoring

editing your code to make it more readable, no change to how it works

Modified RLE

if there are more than 2 colors, RLE needs 2 #s per run, the color and run length

metadata

information attached to a text or image file, like file name, user name, location etc. Not visible in a WYSWYG editing window.

It can use the WiFi to find location in a less accurate way.

What does it mean to say that a mobile device can get a fix on its location even when it does not have access to GPS satellites -- e,g, when in a building?

The data is permanent and does not disappear when you leave the app or the device is off.

What does it mean to say that data is 'persistent'?

D

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

Code Smell

it works but you can tell by reading it that something stinks

Variable Names

make it clear what the variable's purpose is, form of abstraction

Fill Parent

which value would you set the width property to if you want your component to fill its container?

It makes the code easier to read and reduces the odds of making an error. It allows us to focus on the general framework instead of individual details, and it allows us to rename a procedure.

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

ASCII

7 bit code, 128 characters

Odd Parity Scheme

8th bit set to 1 if row is even

Even Parity Scheme

8th bit set to 1 if row is odd

When there is overly repetitive actions that could be reduced to a procedure. If there are many of the repeats, then errors could occur more easily. Typos are easy errors, these can happen the more something has to be retyped. Code Smell also occurs when it is more difficult to read through the code. When someone gets too wordy in explaining something, the definition can get lost in words. Code smell is when there is a bug in the code that will not make it crash immediately, but will increase chances of bugs in the code in the future. A code could be too long, or it could be a duplicate of a nearby code. Refactoring would combine the code so it is not as repetitive, and the code is in a new form but no longer runs the risk of crashing or developing bugs.

1. The Wikipedia article on refactoring talks about code smell and one motivation for engaging in refactoring. What is code smell? Describe briefly two examples of "code smell" and how refactoring would eliminate them.

It only detects an odd number of errors, and it is hard to locate which bit was flipped.

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

Vertically

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

A lossy compression technique means that some data may be lost during compression, but it is okay for camera data where the lost data cannot be perceived by the human eye

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

Error Detection tells us that there is an error. Error correction actually finds the error and fixes it.

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.

It allows the user to choose from a list of destinations in the map

How is the ListPicker component used in this app?

Activity starter allows the app to connect to Google Maps and pull up a specific location from it and display it to the user

How was the Activity Starter used in this app?

A variable helps us reach a wider spectrum of numbers instead of having to focus on a single value. It helps us stop focusing on a certain value and helps us focus on the wider spectrum of numbers and variables.

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 asdotsize, instead of a value, such as '5', help to reduce detail and focus on what is essential in this program.

True

True or False. An ActivityStarter can be used to start any application that is installed on the device.

True

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

a variable is more general and more abstract than a specific value, makes an app more generally useful, symbol that can represent lots of different values

Using a variable is an example of abstraction because

Filename extensions are the 3 letters after the dot at the end of a file name, which indicates how the contents are to be interpreted.

What are filename extensions? What are they used for?

A model is a representation of something. It almost always leave out information, and the information that is left out is decided by the creator of the model.

What is a model?

Free and open source software is software that is open to anybody to use. It is given out by people who are willing to share their work. An example is Open Office.

What is free and open source software?

Lossless representation allows exactly the same image to be rendered, but it takes a lot of memory. It typically helps that color does not vary pixel to pixel. Lossy representation allows approximately the same image to be rendered, but it causes the image to be different in ways that the eye can and cannot see, and it takes less memory.

What is lossless representation? What is lossy representation? What are the trade-offs in using each representation?

Metadata is information about the document, such as the date it was created or the author of the document. The user might not even be aware of this information that is being recorded. This could be helpful to see when changes were made to a document.

What is metadata? Give an example of how a piece of metadata could be used to increase the usefulness of an image or document.

Steganography is the art and science of embedding seemingly harmless messages within each other

What is steganography and what is it used for?

We would have to zero the document, or rewrite the code with zeros. This takes a while.

What would you have to do to delete a document from your computer so that it could not possibly be read by anybody else?

A raster image is a representation of something based on a division into pixels. An ASCII representation of a text document is a collection of 8 bit codes used to represent a string of symbols/letters.

What's the difference between a raster image and an ASCII representation of a text document?

The data is stored in the RAM of the device when using a global variable, but is stored in memory when using a database

What's the difference in terms of where data is located between data stored in a global variable and data stored in a database?

Because the picture is saved to the random access memory, which is not long-term memory and the picture is lost when the device is turned "off" or the app is closed. In order to prevent the picture from disappearing when the app is restarted, we could try saving it on a disk drive for long term memory. Also, the original display on camera is set to the kitty picture, so when it is restarted the kitty picture will always be brought up.

When you use the Camera component to take a picture as the Canvas background, explain why the picture goes away when the app is restarted. HINT: Think about the different hardware components we talked about in an earlier lesson and where on the device the picture is stored. What do you think could be done to prevent the picture from disappearing when the app is restarted?

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.

b

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, b, c, d

Which of the following tasks can be started by an ActivityStarter. Choose all that apply. (a) Start Google maps and display a location. (b) Start Google maps and display directions. (c) Start PaintPot (assuming it's on your device). (d) Start the Barcode Scanner (assuming it's on your device). (e) Access the TinyDb on the device.

ASCII

a code for representing English characters as numbers from 0 to 127

Lossless

original image can be perfectly reconstructed from the compressed data, good for medical, archival images

Long Procedures

procedures that are very similar

modeling

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

Parity

refers to eveness/oddness (parity added to make even, parity added to make odd)

Procedural Abstraction

replace a block of code with a procedure with a clear name, then call procedures instead

algorithm

set of precisely written steps for solving a problem

cloud computing

sharing resources rather than having local servers handle applications

pixel

short for a picture element, a single point in a graphic image

Lossy

some data may be lost during compression, okay for camera data where the lost cannot be perceived by the human eye

Lossless Encoding

the image is exactly the same as the original

Run Length Encoding (RLE)

the image is sent as a series of numbers, indicating the length of the run of black or white pixels. THis is lossless encoding

download

to copy data (usually an entire file) from a main source to a peripheral device


Ensembles d'études connexes

History Chapter 22 Multiple Choice

View Set

AP US Government Multiple Choice pg. 30-34 (Unit 1)

View Set

Intro to Information Security Chapter 1

View Set

Capsim Capstone Man 4900 TQM quiz

View Set

Operating Systems Ch. 9 Virtual Memory

View Set

CEE 365 Final (Q's from Quizzes and Examples)

View Set

Newspaper--Journalism 1 and 2+ Review

View Set