CSC121 Test 1

Ace your homework & exams now with Quizwiz!

Subroutines

library program units that can be linked with the main program. (Built-in functions)

Methods vs. functions

A method is attached to a specific object, while a function can perform its operations independently from any object.

Arithmetic operators in Python

** represents exponentiation * represents multiplication / represents division % represents mod (remainder of division) + represents addition - represents subtraction

Binary vs. graylevel or grayscale images

A Grayscale or graylevel image has pixels whose codes have n-bits. Binary images have only two values for each pixel (0 is black , 1 is white).

What is a computational process?

A computational process denotes a collection of rules, or a sequence of operations or transformations, whereby some resulting information is derived from a set of initial or given information and conditions.

Definition of a computer system (key concepts: automated, programmable, electronic, digital processing machine)

A computer system is an automated, programmable, electronic digital data processing machine. a. Data = symbolic representation of information b. Process = a sequence of states during which the data are modified in prescribed ways c. Program = a set of instructions that direct the process

Representing images as arrays

A digital image is represented as a 2D array of pixels that are arranged in columns and rows.

Program vs process

A process is a sequence of states during which the data are modified in prescribed ways. A program is a set of instructions that direct the process.

Two-dimensional arrays (rows, columns)

A two-dimensional array is a collection of elements of the same data type arranged by rows and columns. (digital image)

Definition of "algorithm."

An algorithm is a plan for directing a computational process.

Criteria or conditions for an effective algorithm

An algorithm should satisfy these conditions: a. each of the steps must be clearly and precisely defined b. each step must be effective (for the agent executing) c. the steps must be ordered properly d. the process must terminate at some point

Control instructions (e.g., conditional, unconditional branches)

An unconditional branch changes the address of the next instruction to the one indicated in the branch instruction. A conditional branch: if some condition is true, then change the address of the next instruction to the one indicated in the branch instruction.

Low-level programming languages (e.g., assembly languages)

Assembly language programs contain symbolic instructions representing elements of some machine language instruction. Each instruction typically has: a mnemonic operation code and literals of labels for the operands.

Claude Shannon

Claude Shannon was the first person to come up with a notion of information. He also developed the one-time pad. Shannon, along with ED Thorp, developed applications of game theory. "A Mathematical Theory of Information" = physical, measurable, quantifiable. Digital circuit design and cryptography.

How does computer science differ from computing technology?

Computer science deals with the explanations behind automated processes while computing technology is the application of those.

What is conditional processing?

Conditional processing is the capability of the processor to choose between alternative actions based on evaluating current data.

Information vs. data

Data is a symbolic representation of information.

Digital data (characteristics, contrasted with analog data)

Digital data is represented by discrete samples of variations (of values) overtime and/or space. Digital data has two important properties: each symbol or token is discrete and precise. However, analog data is represented continuously as variations (of values) overtime and/or space.

Digital images: picture elements (pixels)

Digital images are composed of pixels (or picture elements).

Picture resolution and dynamic range

Dynamic range refers to the number of values for the measuring scale used in quantizing. Picture resolution is the number of pixels or samples used to represent the image.

Floating point numbers

Floating point number is any number, negative or positive that has a fractional part. They can store 64 bits.

Assignment statement (=)

For many programming languages, the most basic computation is the assignment statement. Term = expression. The term often refers to a variable. The "=" denotes the assignment of the right hand value to the left hand name. The expression signifies some computation

High-level programming languages (HLLs)

High-level Language (HLL) instructions are more abstract. There is a one-many relation between HLL instructions and machine language instructions. They are portable. More compatible with the may we think Concise Easily modified Adaptable to different computer systems

What is Information?

Information is a primitive concept, which makes it hard to define. Knowledge, facts, news, and intelligence are derived from information. Facts or knowledge provided or learned.

Shannon's model for a communication system

Information source -> transmitter -> communication channel (affected by some noise source) -> receiver -> destination (user)

Interpreters vs. compilers

Interpreters decode and execute programs one at instruction at a time, while compilers analyze and translate the entire HLL source program to produce an executable machine language version.

Int and longs (storage sizes)

Ints hold 32 bits. Longs hold 64 bits. [Range for each (-2^(n-1) to+2^(n-1)-1)]

JPEG images (compressed image files)

Joint Photographers Expert Group images' baseline is lossy compression algorithm with variable compression rates. Lower compression rate has better quality.

Machine languages (e.g., operation, operand codes)

Machine language is the set of possible processor or machine instructions. Op code is the portion of an instruction that specifies the operation to be performed. Operand code specifies what data is to be manipulated or operated on.

One-dimensional arrays

One-dimensional arrays are a sequence of elements of the same type with an index value identifying position. We use arrays in computing to collect related data for processing

Digitizing: sampling and quantizing; sources for error

Sampling renders a continuous signal as discrete data, and quantizing converts samples to a specific numeric value. Sources for error in sampling is undersampling: too few samples contributes to poor resolution and inaccuracies. Quantizing is when each pixel is encoded using a number to represent its relative brightness. Sources for error in quantizing is if the scale is too small, poor dynamic range can result.

Communication: information, message, signal

Signal then message and then it becomes information

What is indirection? (i.e., values vs. references to the location of values)

Some names are pointers or handles that refer to the location of values in order to create a more generic program.

Strings and files

Strings are used with print or input functions, and have "" around it. Text strings when stored on computers. The end of string character is often added to terminate the sequence. The end of file character added to strings when stored as files.

Define "computer science"

Systematic study of algorithmic processes that describe and transform information. It is about mechanism, but not just engineering. It seeks to formulate theories and explanations of how informational processes may be mechanized or automated.

Character codes (ASCII, Unicode)

Text on computers is represented using character codes, where each symbol is denoted by a unique code (number), and the order of these values enforces the collating sequence. ASCII code was one of the earliest character codes. IT is 7 or 8 bits per symbol, and it is limited to the Roman alphabet. Unicode is the current standard code. It is 16 or 32 bits per symbol, and it is international. It is also backwards compatible with ASCII.

What are the core subjects in computer science?

The core subjects in computer science are algorithms and data structures, theory, architecture, operating systems and networks, programming languages and software engineering.

If statement

The if-statement is used to implement conditional processing. The process selects between two courses of action based on the evaluation of current data.

What are the important application areas in computer science?

The important application areas in computer science include: databases and information retrieval, artificial intelligence and robotics, human-computer communication, graphics, and computational science.

Twos complement for integers

The process of two's complement is to invert the binary number and then add one, results in the negative number.

Split( ) method

The split() method can be used to extract the words from a string. It returns a list of the words.

Discrete state machine

These are the machines, which move by sudden jumps of clicks from one quite definite state to another.

Color images and composite color representation (RGB, CMYK)

We represent color images using composite color models. Most digital photography uses the RGB color model employing additive color primaries. RGB has three distinct channels: red, green, blue. (The alpha channel is a fourth channel that is used as a mask to specify the transparency/opacity of pixels in the composite image.) CMYK color model is used for printing and based on subtractive primaries.

Python string operators (+, *)

You can use + for concatenation, or * for repetition.

Relational operators in Python

a. == is equal to b. != is not equal to c. < is less than d. <= is less than or equal to e. > is greater than f. >= is greater than or equal to

What are the basic skills common in all of these disciplines?

a. Algorithmic thinking = understanding an interpreting processes that could be emulated by some agent b. Data Representation = capturing information symbolically c. Programming = implementing algorithms and representations for execution on some machine d. Design = incorporates other extra-systemic issues such as cost constraints, safety, security, ease of use, etc.

Roles for data names: constants, variables, pointers

a. Constants: literals or values that may change from time to time, but are fixed or static for the current execution of the program b. Variables: these denote values that are dynamic, that is, may change in the course of processing c. Pointers (handles): these denote values that are the address of other locations containing values

Evaluating arithmetic expressions Three rules for evaluating arithmetic expressions:

a. Evaluation takes place from left to right, except that b. Expressions in parentheses are evaluated first, starting at the innermost level, and c. Operators are evaluated in order of precedence

Von Neumann machine instruction-execution cycle

a. Fetching the next instruction b. Decoding (or interpreting) that instruction c. Executing what the instruction prescribes

Data types: int, float, string

a. Int = integer, for representing whole numbers (any whole number, negative, positive or 0) b. Float = floating point, for representing real numbers c. Strings = sequences of text characters

Python conversion functions [e.g., int( ), float( ), str( ), and ord( )]

a. Int() returns the integer part of the input b. Float() returns a floating point version of the input c. Str() returns a string representation of the input d. Ord() given a single input character, returns its ASCII numeric representation

Advantages of digital data

a. Precision, makes easier to compare items b. Ordinality, easier to do relative comparisons c. More efficient storage d. Faster transfer e. Absolute replication, no degrading f. Compression, turn data into smaller representation g. Integrative capabilities h. Content analysis and synthesis

The landscape of computational problems (decidable vs. undecidable, tractable vs. intractable)

a. Undecidable problems = problems for which there can be no effective algorithm I.e. The Halting Problem b. Intractable problems = these are decidable but have no practical algorithm solutions I.e. Traveling salesperson c. Tractable problems = these are both decidable and have algorithms that are or would be practical to implement

JES image functions [e.g., getPixels( ), getPixel( ), getWidth( ), getHeight( ), getColor( ) getRed( ), getX( ), etc.]

a. getPixels(pic) takes a picture as an argument and retuens a one-dimensional array of pixels, row by row b. getPixel(pic, x, y) given a picture and the x and y position of that pixel, it returns the pixel object at that location c. getWidth(pic) takes a picture and returns its width in pixels d. getHeight(pic) takes a picture and returns its height in pixels e. writePictureTo(picturevariable, filename) given a picture and a string signifying a file, this writes the picture as a JPEG file f. getRed(pix) the 3 (RGB) functions take a pixel object and returns the corresponding color value (0...255) g. setRed(pix, value) the 3 (RGB) functions take a pixel object and set the corresponding color value to value. h. getColor(pix) takes a pixel and returns its color object i. setColor(pix, color) takes a pixel and a color object, and sets the color for that pixel j. getX(pix) or getY(pix) given a pixel, it returns either x or y k. makeColor(red, green, blue) takes three parameters for red green and blue color values (0...255) and returns a color object l. pickAColor() takes no arguments but displays a color picker; the user an then select a color to return as a color object m. makeDarker(color) takes a color objects a returns it slightly darker n. makeLighter(color) takes a color object and returns it slightly darker

Python string operations, finding single characters, slices, string length, etc.

a. s[i] to get the ith character in string s b. len(s) to find the length of string s c. s[1:3] to find a slice or substring (starting at 1 and up to 3) d. for ch in s: To iterate through the characters in s


Related study sets

environmental ch.3 reading quiz, mes, and video questions

View Set

Práctica: 2-Clarificar (Clarify each sentence with a prepositional phrase) 3.2 p.93

View Set

Risk Management & Insurance Exam 1: Chapters 5, 6, 7, 8

View Set

CMS COVID-19 Nursing Home Staff Answers

View Set

Environmental Science Final Exam

View Set