Shared Flashcard Set

Details

Programming Logic
Programming Logic
104
Computer Science
Undergraduate 1
10/12/2007

Additional Computer Science Flashcards

 


 

Cards

Term

pseudocode

Definition

an english-like representation of the logical steps it takes to solve a problem

Term
flowchart
Definition
A pictorial representation of the logical steps it takes to solve a problem
Term
flowchart shapes
Definition

input output/parallelogram
processing/rectangle
start stop (terminal)/lozenge
decision/diamond
connector/inverse triangle
method or pre-defined process/rectangle with margins
note-ann./bent rectangle

Term

class

Definition

a category of things. it defines the characteristics of its objects and the methods that can be applied to its objects

Term

method

Definition

a set of statements that performs some task or group of tasks.

Term

main() method

Definition

name of method when class contains only one method

Term

identifier

Definition

name of programming object.
may only be one word-no spaces. should use appropriately descriptive name.

Term

return statement

Definition

marks the end of every method

Term

variables

Definition

location in computer memory (ram). contents can vary or differ over time. mostly hold attributes of object. name must be one word-no spaces and can not begin with a number-only letter

Term

assignment statements

Definition

statements that assign value to variables

Term

=

Definition

variable assignment symbol e.g.

calculatedAnswer=inputNumber*2

Term

named constant

Definition

memory location whose contents do not vary during execution of program

Term

2 data types

Definition

text, numeric
can be variable or constant

Term

string constant

Definition

one or more characters enclosed within quotation marks. e.g. lastname="Lincoln" - last name will be 'Lincoln' throughout method
synonymous with 'character constant'

Term

string variable

Definition

variable that holds character values

Term

numeric variable

Definition

variable that holds a number

Term

integer variable

Definition

numeric variable holding whole numbers ranging from -2147483647 to 2147483647

Term

float variable

Definition

a real number in a floating point representation
e.g.
float GPA=3.99

Term

char variable

Definition

ONE character-letter, or small INTEGER in the range from -128 to 127
often used for yes/no

Term

boolean

Definition

value that can be ONLY true(1) or false (2)

Term

static variable

Definition

variable that is GLOBAL
e.g.
static int global_counter

Term

order of operations

Definition

Precedence, Exponents, Multiplication, Division, Addition, Subtraction.

Term

!, ++x,--x, *, /, %, +, -, <, <=, >, >=, ==,  !==, &&, II, x++, x--

Definition

in order of highest to lowest priority: not; increment, decrement, multiplication, division, modulus, addition, subtraction, less than, less than or equal to, greater than, greater than or equal to, identical-used to compare if equal, not identical-used to compare if not equal, and, or, increment after operation, decrement after operation

Term

modulus operation

Definition

operation where variables are divided, answer is the remainder.
12/7= 1 w/remainder of 5. 
answer is 5

Term

operation scenario
int*int =

Definition

int

Term

operation scenario
int*float =

Definition

float

Term

operation scenario
float *int =

Definition

float

Term

operation scenario
double*int =

Definition

double

Term

operation scenario
int*double =

Definition

double

Term

operation scenario
programmer set*float =

Definition

float

Term

operation scenario
int/int =

Definition

int

Term

operation scenario
float/float =

Definition

float

Term

operation scenario
float/float =

Definition

float

Term

operation scenario
int/float =

Definition

int

Term

operation scenario
float/int =

Definition

float

Term

operation scenario
programmer set/int =

Definition

int

Term

operation scenario
programmer set/float =

Definition

float

Term

member access specifier: public, protceted, private

Definition

Public: methods/prototypes and variables that can be accessed by the source and the main (can be changed by end user)
Protected: access member via ONLY the subclass class methods
Private: methods/prototypes and variables that can not be accessed by the main, but can be accessed by the source (program - eg. tests scores can be entered by end user. average is worked out and displayed by the computer, not entered by user.)
NEITHER CAN BE INITIALIZED, whatever the fuck that means

Term

inheritance theory
"is-a(n)" relationship

Definition

needed when multiple classes are very similar in nature. structure is Super Class & Sub Classes that share common variables with eachother. e.g.
Super Class - Employee
Sub Class - Full Time Proff
Sub Class - Part Time Proff
name, ssn, d.o.b., address fields will be the same, though each subclass will have unique fields in addition to common fields

Term

polymorphism

Definition

a single name can have multiple meanings in the context of inheritance. it allows coder to set up method of the same name can call appropriate method in respective classes. e.g. "endOfMonthFees" can be applied to checking account info and savings account info using same method in different classes, using some common variables

Term

logical expression

Definition

used for certain conditions, can be exact, or wide ranging, computer will match up conditions you create, wathch for conditions that are alike, prepare fo ANY possible condition, even if you think it's impossible. type of coding: if/else; if/else-if's; logical symbols used to compare

Term

relational operators

Definition

<,>,<=,>=,==,!

Term
logical gates
Definition

variables, conditions
or-ll(if x is true, or y is true, answer is true)
x=0,y=0;answer=false
x=1,y=1;answer=true
same process with and-&&, not-!, equal-==
order of operations is !; ==/!==; ll

Term

unknown variable tables

Definition

used when designing a project with many possible conditions to make sure all (im)possible conditions are covered. helpful for error checking.
e.g. if ((grade teamallowed))

Term

binary increments

Definition

128, 64, 32, 16, 8, 4, 2, 1

Term

if/else statements

Definition

when "if" conditions are met, process will run. if not, and it meets "else" statement, that process will run. if there's no "else" statement when "if" condition is not met, program will not run, there will be an error message.
if(condition)
{statement; } //if one line statement
if (condition)
{
statement1;
statement2;
} //if multiple lined statement

ELSE
if (condition)
{statement;}
else
{statement2;}
e.g.
else//then passed
if(score>90)
{ cout <<"teacher's pet!!!"<<endl;}
else
{ cout<<"You Passed"<<endl; }

Term

nested if/else statement(s)

Definition

if/else statement(s) within if/else statments. after branching off, statements do not interact
you want to make as many branches as possible to narrow down conditions. e.g.
if (condition 1) -->(if)
                        -->(else)
else
if(condition 2)
    if(condition2)-->(if)-->(if)
                                 -->(else)
                         -->(else)-->(if)
                                      -->(else)
else
   if(condition3) - ad infinitum

  

Term

return statement within if statements

Definition

return will break out of function, will end program, but may return some value (t,f,void, or a value)

Term

loop

Definition

iterative statements (repeated steps)

Term

loop - steps

Definition

initialization, testing/condition, incrementing

Term

loop initialization

Definition

variable is sole controller of when loop is started and stopped.
variable can be a number that will need to change from a starting value, to an ending value, usually the start and ending values are big enough

Term

loop testing/condition

Definition

must have condition in any loop or variable and loop will fail and the world will end.
conditions in loop are the same as in if statements

Term

incrementing/decrementing

Definition

++x changes value before modification/loop in code completed.
x++ changes value (adds 1)after modification/loop in code completed
--x, x-- (same as above process but subtracts 1instead)

Term

while loop (counter)

Definition

//initialization
int count=0
while (coun<10)//condition
{statements;
...
...
count ++; //incrementation
}

Term

while loop (non-counter)

Definition

//initialization
char answer='N';
while (answer !='Q')//condition
{
statements;
...
...
cout <<Press Q to Quit<< endl;
cin>>answer;
}

Term

while loops

Definition

used extensively in reading data from a file.
make sure { }'s are in block line structure
initialize variable BEFORE the loop
initializing variable is SET so that the loop will run
used when NOT exatly sure when the loop should or will end, or when the USER will define when to end

Term

for loop

Definition

puts all three parts (initialization, testing, incrementing) in one line statements inside { }'s are in block like structure;used when you know  EXACTLYwhen the loop should end, or how many times the loop should be run before it ends
NONE of the three stages HAVE to be set, in order to work-you could have a totally empty for loop. that's unusual though. when condition is no longer met, loop ends.
e.g.
void main()
{int i;
/*repeat 10 times*/
for (i=0; i <10; i++
{cout<< "I will not chew gum in class."<< endl; }
}

Term

importance of initialization's position - inside loop/outside loop

Definition

initialization variable declared inside loop is only applied while loop is running
if declared outside loop, variable retains declared value even after loop ends.

Term
loop break/continue/
return
Definition
break: used to break out of the loop and go to the next statement (within nested loop, will break out of inner loop and continue through rest of outer loop)
continue: skips rest of statements in loop, increments, then goes to the next pass of the loop
return: will break out of the entire function (same as break, but it will return some value-t,f,void, or value)
Term

loop break e.g.

Definition

void main ()
{
for(int i=0; i<10; i++)
{
if (i>3)&&(i<7))
{cout << "Greater than 3"<< endl; continue; }
if(i<5)
{cout<<"Less than 5"<<endl; }
if(i>6)
{cout<< "See ya"; break;}
}

Term

void main ()

Definition

function will not return a value

Term

methods in theory

Definition

procedure to complete a task, no matter how large or small; should be in small pieces for many reasons; sequential-compiler will read top to bottom so variables must be declared at the beginning of the method for later use. first line of any method is called a "method header"

Term

function

Definition

short cut consisting of pre-defined steps bundled under 1 name or designation. you can reference throughout program (calling function) and all instructions in function will run. imagining 3 blocks stacked upon eachother, the top is for global variables, the middle for the main, the bottom contains the function(s). mechanically, the program starts at the main and follows instructions until coming upon pre-defined instruction to call a function. the program then skips down to the function instructions (bottom block), follows the instructions of the function and upon completion, returns to main(middle block) and to continue where it left off.

Term

int method e.g.

Definition

global
_____________
int zipcode()
{
....
....
int zip=21118; //put in your zip code 
return zip;
}
no parentheses because this is not a function but a variable!!! zipcode() acts like a value, since it returns an int value

Term

simple method calling

Definition

to call a method, it must be called from another method.
e.g.
void main()
{
hello x=new Hello();
         x.greeting
}
public void greeting()
{
cout<< "Hi, my name is Mr. Lupoli"<<endl;
}
parameters were needed so () was left empty. all that was needed to call method was method name and ()s. any method can call any other method.

Term

scope of variables-global/local

Definition

global variables can be accessed throughout the entire program
local variables begin and finish within the method it was created and can only be accessed by that method

Term

parameters

Definition

indicate what is needed for specific method to run. if (), there are no parameters. used when you need to pass if you wish to, change more than one value/variable, pass in variables that are needed to run a program

Term

simple void method with parameters

Definition

int Ravens=0, Steelers=14
temp_swap(Ravens, Steelers);
void temp_swap(int a, int b)
{
int temp = a;//a=0, b=14
b= a;
b= temp;
cout <<a<<"-"<<b<< endl; //result is a=14, b=0, displays as Ravens 14, Steelers 0.
in this example, int a is the ALIAS for Ravens, int b is the ALIAS for Steelers. when commanded to swap, the method switches aliases, keeps the inputed scores.

Term

key features of method to identify

Definition

return type - ie void etc.
local variables - defined inside or outside method?
returning a value - if void, none, if not void, must return value

Term

reason for using methods

Definition

reusability. one method can be called many times throughout program to take care of several matrices.

Term

methods within classes

Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Term
logical gates
Definition

variable that holds character values

Supporting users have an ad free experience!