1/128
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Algorithm
a sequence of instructions that solves a problem
string literal
Text in double quotes “ “ is called?
newline character
\n
//
single line comment begins with?
/* */
multi-line comment starts and ends with?
generates an error
what does the following code output? (if an error is generated, say “generates an error”)
/*
x = 5; /* comment here */
y = 6;
*/
cout « x « y;
syntax error
what kind of error is it when you violate a programming language’s rules on creating a program?
logic error
error that occurs while a program runs; program compiles but doesn’t run as intended
warning
compiler sometimes can report a ______, which indicates a possible logic error, but doesn’t actually stop the compiler from generating a program
memory
a circuit that can store 0s and 1s in a series of thousands of addressed locations
machine instructions
instructions represented as 0s and 1s
executable program
a sequence of machine instructions together form a(n)
assembly language instructions
used with assemblers to automatically translate human readable instructions into machine instructions
high-level languages
created to support programming using formulas/algorithms, more closely related to human thinking
compilers
programs that automatically translate high-level languages programs into executable programs
C
Which language is C++ derived from?
allocation
the process of determining a suitable memory location to store data like variables
character literal
surrounded in single quotes ‘ ‘
10, 15
What range of numbers am I generating from? ___ to ___
(rand() % 6) + 10
branch
a sequence of statements only executed under a certain condition
Precedence Rules
() → ! → Arithmetic Operators → Relational Operators → Equality/Inequality Operators → && → ||
** pay attention to this order! Don’t just breeze through with the name :)
c
What does the following return?
firstName = “Jacob”
cout « firstName.at(2)
push_back()
function that adds a character to the end of a string, or an element to the end of a vector
append()
function that adds one string to the end of another (string that goes on the end goes in the parentheses)
isalpha()
character function that returns true if alphabetic
isdigit()
character function that returns true if digit
isspace()
character function that returns true if whitespace
toupper()
character function that changes the selected character to the uppercase version
tolower()
character function that changes the selected character to the lowercase version of the letter
conditional expression
condition ? exprWhenTrue : exprWhenFalse
short circuit evaluation
skips evaluating later operands if the result of the logical operator can already be determined
break
statement that, in a loop, causes the immediate exit of a loop
continue
statement that, in a loop, causes the immediate jump to the loop condition check
enumeration type
declares a name for a new type and possible values of that type
eg: enum color {red, green, yellow};
top level domain
the last part of an internet domain name (like .com)
resize()
vector function that can be called to change the size of a vector
end
when resize() is called and the new size is larger than the old, elements are added to the ___ of the vector
end
when resize() is called and the new size is smaller than the old, elements at the ___ of the vector are deleted
back()
vector function that returns last element of a vector
pop_back()
vector function that removes the last element of a vector
size, equal
vectorA == vectorB returns true if the vectors are the same _____ and each element pair is _____
null character
strings in a char array must end with a _____ ________
strcpy()
copies sourceStr (include null char) to destStr. destStr must have enough space for sourceStr, including the null character
strncpy()
copies up to numChars characters from sourceStr. destStr must have enough space for the copied characters, including the null character.
strcat()
copies sourceStr to the end of destStr (starting at \0), then appends a null char. destStr needs enough space for all of sourceStr and the null char
strncat()
copies up to numChars characters from sourceStr to end of destStr, then appends a null char
strchr()
return NULL if searchChar doesn’t exist in sourceStr. Else, it returns the address of the first occurrence
strlen()
returns number of characters in sourceStr, not including the null char
strcmp()
returns 0 if str1 and str2 are equal, nonzero if they differ
str2
given strcmp(str1,str2), if a negative number is returned, which string is greater
str1
given strcmp(str1,str2), if a positive number is returned, which string is greater
isalnum()
returns true if char is alphabetic or numeric digit
islower()
returns true if char is lowercase
isupper()
returns true if char is uppercase
isblank()
returns true if char is blank character (includes spaces/tabs)
isxdigit()
returns true if char is hexadecimal digit (0-9, a-f, A-F)
ispunct()
returns true if char is punctuation char
isprint()
returns true if char is printable character (includes alphanumeric, punctuation, spaces)
iscntrl()
returns true if char is control char (all non-printable characters)
function
a grouping of predefined statements for repeatedly used operations
function definition
consists of the new function’s name and a block of statements
function call
an invocation of a function’s name, causing the function’s statements to execute
void
which return type indicates a function does not return any value?
parameter
a function input specified in a function definition
diameter
what is the parameter of this function?
double calcArea(double diameter) {…}
argument
a value provided to a function’s parameter during a function call
12.0
what is the argument used in this function/function call?
double calcArea(double diameter) {…}
int main() {
cout « “area is “ « calcArea(12.0) « endl;
modular development
the process of dividing a program into separate modules that can be developed and tested separately and then integrated into a single program
incremental development
the process in which a programmer writes, compiles, and tests a small amount of code, then writes/compiles/tests a small amount more, and so on.
function stub
a function definition whose statements have not yet been written
unit testing
the process of individually testing a small part/unit of a program (typically a function)
testbench
a separate program whose sole purpose is to check that a function returns correct output values for a variety of input values.
test vector
each unique set of input values in a testbench
local
each function call creates a new set of ______ variables
discarded
each return of a function causes its local variables to be ______
pass by value
normal parameters are _____ ___ _______, meaning the arguments value is COPIED into a local variable for the parameter
pass by reference
this type of parameter does NOT create a local copy of the argument, but rather, refers directly to the argument variable’s memory location
&
appending what symbol to a parameter’s data type makes it pass-by-reference?
reference
a variable type that refers to another variable
const
what keyword can be prepended to a function’s parameter to prevent the function from modifying it?
global variable
a variable declared outside any function (should be used sparingly)
function declaration
specifies the function’s return type/name/parameters, ending with a semicolon where the opening brace would’ve gone
default parameter value
when a function contains this, a function call can omit the last argument(s) and the program uses a default value instead.
end
default parameter values for a function should come at the ___ of a function definition
B
which of these is an invalid use of a function that includes default parameter values?
A : void PrintDate(int currDay, int currMonth = 1, int currYear = 2025, int printStyle = 0);
B : void PrintDate(int currDay = 10, int currMonth, int currYear = 2025, int printStyle = 0);
C : void PrintDate (int currDay, int currMonth, int currYear, int printStyle = 0);
function overloading
when a program has multiple functions with the same name but differing in number/types of parameters
distinct
function overloading is allowed as long as each has _____ parameter types
preprocessor
a tool that scans the file from top to bottom, looking for any lines that begin with #
preprocessor directive
a line that directs the preprocessor to modify the file in some way before the compilation continues
object
a grouping of data and operations that can be performed on that data
abstraction
means to have a user interact with an item at a high-level, with lower level internal details hidden from the usera
abstraction data type
a data type whose creation and update are constrained to specific, well-defined operations
class
construct that defines a new type that can group data/functions to form an object
public member functions
a class’ ____ _______ _______ indicate all operations a class user can perform on an object
implemented, behaves
a class user does not need to know how a class’ data and functions are ________, but only need to understand how each public member function _______.
member access operator
“.”, used to invoke a function on an object
private data members
variables that member functions of a class can access, but class users cannot
scope resolution operator
each member function has the class name and ::, known as the _____ _______ ________, preceding the function’s name.
inline member function
when a member function’s definition appears within the class definition, it is known as an ______ ______ ______
setter
this type of function can modify a class’ data members (aka mutator function)