This site is 100% ad supported. Please add an exception to adblock for this site.

Computer Science 1248

Terms

undefined, object
copy deck
Statistics
refers to a range of techniques and procedures for analyzing data, interpreting data,displaying data, and making decisions based on data. Any data is studied to make informed decisions.
Variables
• Categorical
– Sex
– Job category
• Quantitative
– Age
– Weight
– Systolic blood pressure
observations, or scores that have something in common.
Sample
is a subset of a population
A population
consists of an entire set of objects, observations, or scores that have something in common.
A) concrete (ages 15-18)
B) hypothetical (reading scores)
Central Tendency or Measures of Central Location
1. Mean
2. Median
3. Mode
C programming Software Development Method
1.Specify the problem requirements
2. Analyze the problem (problem/Data)
3. Design the Algorithm to solve the problem
4. Coding (Implement the algorithm)
5. Testing and verification
6. Maintenance
How is the data input?
Waterfall Method
one step is dependent on the previous step
All algorithms written using three basic types of
control structures:
1. Sequential
2. Selection
3. Repetition
1. Sequential
- Statements are performed sequentially in the order written.
- May be a single statement or more than one
statement performed in a sequence (compound
statement)
2. Selection
- Based on some condition, a choice of alternative actions may be made. (control words:if, if-else, switch)
3. Repetition
- One or more statements are performed repeatedly.
- Repetition of statements is dependent on some
condition. (control words :while, do-while, for)
bit
(binary digit)
– is the smallest unit of
information
– can have two values - 1 and 0.
Numbers, Codes or instruction
Data
refers to raw facts(no value), numbers.
Information
communication that has value. Words, numbers and pictures are symbols
Byte
a grouping of eight bits of information. Each Byte
normally represents one character
8 bits =
4 bits =
16 bits =
1 byte
nibble= 1/2 byte
2 bytes
ASCII code numbers
range from 0 to 127.
Unicode =
1. 65000 character set
2. character set that uses 2 bytes or 16 bits , 256*256
= 65536 distinct codes.
Integers
(int) can be positive or negative as long as a whole number (23, -1000, 999)
Float
(float) are real numbers, fraction/ single precision (99.9, 34.90)
Double
(double) are real numbers, fraction/ double precision (99.9999, 34.8765)
Character
(char) Can be alphabets, numbers any character on the keyboard including space, enter key etc(‘A’, ‘7’, ‘*’, ‘$’ etc)
Arithmetic operators
1. Addition (2 + 3 = 5)
2. Subtraction (2 – 3 = -1)
3. Multiplication (2 * 3 = 6)
4. Division (3/2 = 1) INTEGER
5. Modulus (2% 2 = 0/ 4%2 = 0/ 3%2 = 1)
Modulus Operator
Remainer operator, ONLY WORKS ON INTEGERS
(EVEN AND ODD NUMBERS)
Logical operators
1. NOT !
2. AND &&
3. OR ||
1. Not
2. And
3. Or
1. True = 0 False = 1
2. Has to be true for all = 1
3. True for only one = 1
Blackbox testing
(functional testing) where internal workings are being tested are not known by the tester
Whitebox testing
(glass box, structural, clear box, or open box testing)knowledge of internal workings are being tested are used to select the test data
0101 +5
1101 -5
0 represents positive value
1 represents negative value
1. %c (char)
2. %d (int)
3. %f (double)
4. %lf(double)
5. %f (float)
1. printf/scanf (one byte)
2. printf/scanf (four bytes)
3. printf (four bytes)
4. scanf (eight bytes)
Major tasks
a) input
b) processing
c) output
Variable
a named data element in a program whose contents can be changed by referencing the unique name for its corresponding storage location(s).
Initialize a variable
counting and summing variables must be set to zero before using.
Verification
make sure output has produced the right (correct) values.
An algorithm
is a series of instructions, which if performed in order will solve a problem.
1-All capital letters
2-small letters
1- constant macro
2- variable
The preprocessor directives
are commands that give
the instructions to the C preprocessor.(A preprocessor
is a system program that modifies a C program before
its compilation)
Constant macro
a name that is replaced by a
particular constant value before the program is sent to
the compiler
Input operation
is an instruction that copies data from an input device into memory.
Output operation
is an instruction that displays information stored in memory.
The output function (printf)
is used to display the results stored in the
variable in memory
Function call
is calling or activating a function
Oval symbol
- Beginning and end of a complete
algorithm
Small circles
– Connector symbols to denote the beginning and end of a segment of an algorithm
Arrows
- denote the order and sequence. Also
called flowlines
Rectangle symbol
– indicates an action such as acalculation or an input/output.
Diamond symbol
– indicates that a decision is to be made
Sequential
– statements are executed one after another
If Selection Structure
– Choose among alternative courses of action
If /Else Selection Structure
-Selects between two different actions
Selection
– single-selection structure
If the condition is true, only one
action is performed
– double-selection structure
Resulting action performed is
one of two choices
– multiple-selection structure
Resul
1. If
2. If/Else
3. Switch
1. If
single-selection structure
If the condition is true, only one action is performed
2. If/else
double-selection structure
Resulting action performed is
one of two choices
3. Switch
multiple-selection structure
Resulting action chosen from
many choices
Repetition
– An action is to be repeated
while some condition remains true. Flow of execution loops until the condition is false.
Repetition
(Two general types:)
1. Counter-Controlled
2. Sentinel-Controlled
1. Counter-Controlled
1. definite repetition
Number of repetitions is known before any action is taken. Action is repeated a knownnumber of times.
2. Sentinel-Controlled
2. indefinite repetition
Number of repetitions is not
known before any action is
taken. Trailer value signals that the looping is not to continue. Some event will cause the end of the repetition of the actions.
Sentinel Values
show the end of a program/ it is not part of the regular
input data (-1, 99999)
Trailer value
The last value in a file is called
Counter-controlled
1. Loop counter variable (control variable)
2. Initial value of the counter
3. The amount that the counter will be
modified each time through the loop.
4. The condition that determines whether the
looping should continue.
Good Programming
Avoid off-by-one errors!
If code is to be looped X times, using
an incremental modifier,
1. Initialize counter to 1
2. Always use
counter less than or equal to X as the stopping condition.
Sum
Sum of the numbers (Integer values >100? int)
Sum odd number
Starting at 1, add two to it to calculate the next odd
number (Integers < 30+ int)
Count
Counter (int 1 to 11 int)
A block
is a sequence of variable declarations and statements enclosed within braces. A block is a compound
statement with declarations.
External variable or Global variable:
If a variable is defined outside any function at the same level as function definitions, it is available to all the functions defined below in the same source file, and is called an external variable.
Debugging:
Removing errors from a program.
Syntax error:
A violation of the C grammar rules, detected during program translation(compilation).
Run time error:
An attempt to perform an invalid operation, detected during program execution. (Divide by zero.)
Logic error:
An error caused by following an incorrect algorithm. Do not cause run time errors and are difficult to detect.
Ternary operator:
(expression1 ? expression2 : expression3)
Dangling else problem
When conditional statements are nested, it may not be apparent to which of several conditional statements an else belongs( if not indented properly). Normally else is associated with the closest previous else-less if. Braces can be used to force the else match with any if condition in a nested if statements.
Nested if statement:
an if statement with another if statement as its true task or its false task.
A comma operator(,)
is used to combine two related expressions into one, To make programs more compact.
The expression is evaluated left to right. , (comma) operator has lowest precedence.
Loop
is a control structure that repeats a group of steps in
a program.
Switch:
It is also called constant multiway decision.The
value of the expression in the parentheses can be of type int or char only, but not of type double
Loop body
:the statements that are repeated in the loop.
Loop repetition condition:
the condition that controls the loop repetition.
Loop control variable:
the variable whose value controls loop repetition.
Accumulator
is a variable used to store a value being computed in increments during the execution of a loop.
Counting loop:
A loop whose required number of iterations can be determined before loop execution begins.
Loop boundaries:
initial and final values of the loop control variable.
Infinite loop:
loop that executes forever.
Batch Mode
a mode of program execution in which the program scans its data from a previously prepared file
Interactive mode
a mode of program execution in which the user responds to prompts by entering data
program area
where the object code is stored
static data area
-where external variables declared with the storage class 'static', function names, prototypes, and global variables are stored
-static variables exist for the entire execution of the program
runtime stack
where activation records(function data areas) for invoked functions are stored
heap
-(in C memory may be allocated and deallocated at execution time)
-where dynamically allocated memory is obtained
registers
where data declared with the storage class 'regiter' is stored (only if a register si available)
Modular:
Functions should be in modules. Each module performing one specific task.
Readable
overall process is outlined in the main() function with all the subprocesses detailed in functions that follow
Debug
it is easy to debug, small functions and segments of code than in a large program
Repeatability
if a process is being used more than once during a program, the code may be written only once and the function can be called when needed
Reusability
reuse of code saves time and effort required in designing new functions from scratch
fun_type
fun_name (parameter-type-list);
User defined functions
Function prototypes:
1. Has to be declared before it can be referenced.
2. Should be declared before the main function. The function
prototype must appear before the first call to the function.
3. Tells the compiler :
a. Datatype of the function ie the value returned by the
function
b. Function name
c. Number of arguments the function expects, order of the
argument list
d. Datatypes of the arguments in the function
fun_type fun_name (parameter-type-list);
The prototype of a function
must agree with the function definition and its use. The parameter name in the prototype can be different from the names used in the
function definition. These names are effectively treated as comments , and may even be omitted. A parameter list is a comma separated list containing the values a function receives.
A functions parameters
are also called local varaibles
No value specified in the arguement
assumed to be void
Local declarations
can be accessed or referenced only within the function they are defined. Variables declared local to a function supersede any identically named variables outside the function
Void function_name(void);
arguement list (void) indicated that the function has no arguements. void datatype of the function implies it doesn't return any value
A function declared to return some value (datatype) must
return a value (datatype)
Function call
(fun_name(arguement list);
1. function calls are executed in the order they are called
2. after function ends it transfer control back from the calling statement
3. called from main or from any other function
4. can be called more than once
Function defintion
(void function_name(void))
specifies the function operation. Function heading is similar to the function prototype, excep that it does not end in semicolon
block
(aka the function body)a compound statement that includes declarations
Function CANNOT
BE DEFINED INSIDE ANOTHER FUNCTION UNDER ANY CIRCUMSTANCES
Input arguments:
arguments used to pass information into a function subprogram
Output arguement
arguements used to return results to the calling function
Acutal arguement
is an expression used inside the parenteses of a function call
Formal parameters
is an identifier that represents a corresponding actual arguement in a function definition
Precondition
is a condition assumed to be true before a function call
Postcondition
is a condition assumed to be true after a function executes
Two ways to invoke functions are:
1. call by value
2. call by reference
Call by value
NO CHANGE IN MAIN
meaning that the called function is only provided with the current values of the arguements, but not their addresses, and the corresponding parameters are assigned these values (copy of value is made/ copy and not original is passed to call function)
Call by reference
CHANGES IN THE MAIN
(pointers)
1. declaring a function parameter to be a pointer
2. using th edereferenced pointer in the function body
3. passing an address as an arguement when the function is called
Sort
is a rearrangement of data in a particular sequence (increasing or decreasing)
Array
is a data structure used to store a collection of data items of the same type. (all int, all float, all double, all char)
Scope
scope of an array is defined within the block in which the array is declared
Duration
an array willl cease to exist (memory is released) when the control flow of execution leaves the block in which it was declared
Arrays
1. same name and datatype
2. 0,1,2...7 (subscript)
3. 8 element array
4. first 0th or x[0]
5. iTH ELEMENT ARRAY X[i-1]
Array element
is a data item that is part of an array (collection of two or more adjacent cells- associated with particular symbolic names)
Firts position in an array
zero (0)
Position numbers
1. subscript
2. HAVE TO BE INTEGERS
Declaring Arrays
1. (single) set array in memory, we declare both the name and number of memory cells associated with it
2. (double) type name and to numbers (rows and columns)
Parallel arrays
Two or more arrays with the same number of elements used for storing related information about a collection of data objects.
SD
is a statistic that measures the spread of the values in a data set
Linear Regression
method of finding the linear equation that comes closest to fitting a collextion of data points
Residue
(VERTICAL DISTANCE)
difference between the predicted value adn the observed value
Sum-of-squares error
(smaller sse better approximation)
add up the squares or the residues, get a measure of how well the line fits
The regression line (least squares line, best-fit line)
associated with the
points (x1, y1), (x2, y2), ... , (xn, yn) is the line that gives the minimum sum-ofsquares
error (SSE).
Correlation coefficient r,
which, like SSE, is a way of measuring the goodness
of fit of a line to the given data. However, it is more useful than SSE for
comparing the goodness of fit of different lines to different data.
Population
consists of an entire set of objects, observations, or scores that
have something in common.
Describe population
described by several parameters such as
the mean and standard deviation. Estimates of these parameters taken from a
sample are called statistics
A confidence interval
(M - zϒM µ M + zϒM)sigma know
(sM = s(sqrt(N))(N is the sample size)
is a range of values that has a high probability of containing the parameter being estimated.

Deck Info

136

permalink