click below
click below
Normal Size Small Size show me how
CS010
Term | Definition |
---|---|
bits | Contain 0s (zero voltage) and 1s (positive voltage) |
circuits | Connections of switches to perform calculations such as multiplying two numbers. |
processors | Execute a list of desired calculations |
instructions | Calculations |
memory | Circuit that can store 0s and 1s in each of a series of thousands of addressed locations. |
application | Or program; programmer-created sequence of instructions. |
machine instructions | Instructions represented as 0s and 1s. |
executable program | A sequence of machine instructions together. |
assembly language | Human-readable processor instructions; an assembler translates to machine instructions (0s and 1s). |
high-level languages | support programming using formulas and algorithms. |
compiler | translates a high-level language program into low-level machine instructions. |
disk | non-volatile storage with slower access. |
nonvolatile | can maintain their contents even when powered off. |
RAM | volatile storage with faster access usually located off processor chip. |
byte | 8 bits (memory size) |
cache | Relatively-small volatile storage with fastest access located on processor chip. |
clock | The frequency a processor executes instructions. |
Moore's Law | The doubling of IC capacity roughly every 18 months. |
operating system | Manages programs and interfaces with peripherals. |
C | First published in 1978 |
C++ | First published in 1985 |
code | Textual representation of a program. |
line | A row of text. |
main | Starting place of a program. |
braces | Denoting a list of statements. |
statements | Program instructions. |
variable | 1.Represents a particular memory location 2.takes up a different amount of space in memory depending on its type 3. Use good names to read program 4. Can change that variable of program |
compiler | Converts a program into low-level machine instructions of computer. |
cout | Supports printing |
string literal | Text in double quotes |
endl | starts a new output line |
newline character | A new line that can also be output by insterting \n |
cin | Short for "characters in"; reads input |
comment | Text added to code by programmer. |
multi-line Comment | /* and */ or block comment |
declaration | Variable definition |
int variable | Can only hold numbers between +2 and -2 billion |
assignment statement | stores the right side item's current vale into the variable on the left side (numApples=8;) |
expressions | numbers, variable names, simple calculations, or combo of var, literals and operators. Example: numKids+numAdults; |
reserved Word | int, short, or double |
literal | specific value in code like 2. |
char | can store a single character, like the letter m or the symbol %. |
character literal | surrounded with single quotes; ex: 'm' |
string | sequence of characters |
whitespace Character | character used to print spaces in text and include spaces, tabs, newlinchar. |
getline(cin, stringVar); | reads all user text on the input line, up to newlinchar resulting from user pressing ENTER. |
double | stores floating-point numbers (0.0) |
floating-point literal | written with fraction part even if is 0 as in 1.0, 99.0 (decimal form) |
overflow | occurs when the value being assigned to a variable is greater than the maximum value the variable can store. |
long long | uses 64 bits if value goes over 2billion |
type conversion | conversion of one data type to another, such as an int to a double. |
type casting | explicit conversion by the programmer of one type to another |
static cast <double> | converts the expression's value to the indicated type (from int to double) Ex: static_cast<double>(myIntVar) converts int 7 to double 7.0 |
math library | 20 math operations available listed #include<cmath> |
function | list of statements that can be executed by referring to the function's name. |
constant variable (const) | an initialized variable whose value cannot change. |
debugging | process of determining and fixing the cause of a problem in a computer program. |
troubleshooting | "debugging"; predict possible cause of problem, conduct a test to validate cause. |
branching | directs a program to execute one statement group or another, depending on expression's value. |
logical operator | treats operands as being true or false, and evaluates to true or false. Example: a&&b (true when BOTH of its operands are true); a||b (true when AT LEAST ONE of its two operands are true); !a (true when its single operand is FALSE) |
bool | data type for variables that should store only values true or false. Example: define bool result; result = true or as in result = (age<25) or use if then statements: ((!result) && (b==c)) |
index | each string character has a position called an index. The numbering starts with 0, not w. |
at() | someString.at(0) accesses the character at a particular index of a string. |
exception | a detected runtime error that commonly prints an error message and terminates the program. |
loop | a construct that repeatedly execute specific code as long as some condition is true |
while loop | a program construct that executes a list of sub-elements a list of sub-statements repeatedly as long as the loop's expression evaluates to true |
looping | iteration |
loop variable | counts the number of iterations of a loop |
increment operator | (i = i + 1) or (++i) |
decrement operator | (i = i - 1) or (--i) |
for loop | collects: loop variable initialization, loop expression, & loop variable update. |
while loop | use when the number of iterations is not computable before entering the loop, as when iterating until a user enters a particular character. |
for loop | use when the number of iterations is computable before entering the loop, as when counting down from X to 0, printing a character N times. |
syntax | |
syntax error | violate a programming language's rules on how symbols can be combined to create a program. Example: forgetting to end a statement with a semicolon. |
syntax error | also known as a type of compile-time error since it was detected by the compiler. |
logic error | an error that occurs while a program runs. Also called a RUNTIME ERROR or BUG. |
warning | compiler will sometime report THIS, which doesn't stop the compiler from creating an executable program, but indicates a possible logic error. |
misleading error messages | many errors confuse compiler resulting in_____ and are common. |
statement int userAge; | defines or declares a new variable named userAge. Compiler allocates memory location for userAge capable of storin an integer (int). |
address | compiler allocated variable name to memory location (97,98 or etc). The programmer must define a variable BEFORE any statement that assigns or reads the variable, so that the variable's memory locat. is known. |
litterSize * yearlyLitters is assigned to annualMice | annualMice = litterSize * yearlyLitters |
identifier | name created by a programmer for an item like a variable or function. Must be a sequence of letters (a-z, A-Z,_) and digits (0-9). Example: c, cat, Cat, n1m1. Invalid: 42c (don't start with #), hi there (no space) and cat! (no symbols!)CASE SENSITIVE! |
reserved word | also known as a KEYWORD. A programmer CANNOT use a reserved word as an identifier. |
lower camel case | capitalizing each word except the first: numApples, ppleOnBus |
operator | symbol for a built-in language calculation like + for addition. |
arithmetic operators | + - * / % |
expressions | mostly follow standard arithmetic rules such as order of evaluation, but does NOT allow multiplication shorthand of (example) 5y to represent 5 times y. DO NOT DO THAT. Factorials 5! are also not valid. |
unary minus | - can be used as a negative. |
modulo operator % | evaluates to the remainder of the division of 2 integer operands. Example: 24 % 10 = 4. Reason: 24 / 10 is 2 with remainder 4. And it ONLY WORKS for INTEGERS. |
division | division by 0 causes program to terminate. Second operand of / or % must NEVER be 0. |
precedence rules | compiler evaluates an expression's arithmetic operators using the order of standard mathematics. |
compound operators | provide a shorthand way to update a variable, such as userAge += 1 being shorthand for userAge = userAge + 1. |
char variables | under the hood, char var stores a letter as a number, the compiler knows to output a char type as the corresponding character. |
ASCII | early standard for encoding characters as numbers. |
string data type | isn't built into C++ as are char, int or double. But is available in stdrd library & can be used after add: #include <string> Programmer then defines a string variable as: string firstName; Can also do string firstMonth = "January"; otherwise empty. |
cin | do not add spaces. Example in "betty sue" since there's a space, will only store "betty" and "sue" will be in next input. |
scientific notation | useful for representing floating - point numbers that are much greater than or less than 0 such as 6.02x10^23. do 6.02e23 or decimal -23 |
floating - point variable | should be used to represent a quantity measured in distance, temperature, volume, weight, etc. But agains using for money bc it is a countable item. |
binary number | each memory location is composed of bits (0s and 1s), a processor stores a number using base 2. |
overflow | compiler may not report a syntax error (syntax is correct) but may output a compiler warning message. |
implicit conversions | compiler auto performs several common conversions between int and double types. BUT DON'T EVER MIX THOSE 2 TOGETHER. Ex: int-to-double 25 becomes 25.0 double-to-int 4.9 becomes 4. |
argument | an input value to function appears between the parenthesis. Example: at.(argument) Function executes and RETURNS a new value. Ex2: pow(b,e)= b^e (multiple argument) |
function call | invoking a function |
abs() | computing the absolute value of an integer. |
process of debugging | 1. Predict a possible cause of problem. 2. Conduct a test to validate that cause. 3. Repeat |
if-else statements | supports branching; can be written without the else part. NOTE: A statement is NOT part of a branch (random lol) |
relational operator (or equality operator) | if-else expression commonly involves this. Example: (a<b), (a>b), (a<=b), (a==b), (a!=b) |
boolean | true or false (if a<b or a>=b etc) |
multiple if-else branches | if; else if; else if; else if; else. if-else, else-if statements However, if one if-statement is true, then the rest is considered false. |
nested if-else statements | a branch's statment can include any valid statements, including another if else. Ex: if; else if; (sub)if....else; (out) else |
multiple if statements | each if-statement is independent, and thus more than one branch is executed in contrast to the multi-branch if-else where it checks for the truth of each then test only ONE correct statement. Also takes much longer to execute the multiple if-else stat. |
rules for arithmetic operatbooors | In order of evaluation: (), unary (negative #'s), */%, + - , left to right. Errors ex: (5 * x + 1) = (5 * x) + 1 instead of 5 * (x+1). |
relational and logical operators (except for !) | 1.are binary operators (takes 2 operands (from left to right) and evaluate to true or false. 2.Only one operator is evaluated at a time, based on precedence rules. |
Precendence rules for logical and relational operators | In order of evaluation: (), !, */%+-, < <= > >=, == !=, &&, || |
int / double | = double |
double/double | = double |
nested loop | a loop that appears as part of the body of another loop. Commonly referred to as the INNER LOOP and OUTER LOOP. |