1/53
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What does initialized mean?
It means an object is given a known value at the point of definition.
What does assignment mean?
It means an object is given a known value beyond the point of definition.
What does uninitialized mean?
It means an object has not been given a known value yet.
What is an uninitialized variable?
A variable that has not been give a value by the program(generally through initialization or assignment).
Why should you avoid using a uninitialized variable
Using this value will result in undefined behavior.
What is undefined behavior?
It is the result of executing code whose behavior is not well defined by the language. The result can be almost anything, including something that behaves correctly.
Implementation-defined behavior
Behavior chosen by the compiler and documented (consistent per compiler, may differ across compilers)
Unspecified behavior
Behavior chosen by the compiler but not documented (can vary, unpredictable)
Identifier
The name of a variable(or function, type, or other kind of item)
Identifier naming rules
The identifier can not be a keyword. Keywords are reserved.
The identifier can only be composed of letters (lower or upper case), numbers, and the underscore character. That means the name can not contain symbols (except the underscore) nor whitespace (spaces or tabs).
The identifier must begin with a letter (lower or upper case) or an underscore. It can not start with a number.
C++ is case sensitive, and thus distinguishes between lower and upper case letters. nvalue is different than nValue is different than NVALUE.
What is a literal (also known as a literal constant)?
A fixed value that has been inserted directly into the source code.
What is an operation?
A process involving zero or more input values that produce a new value
What is operands?
Zero or more input values.
What is an operator?
The denoted symbol that a specific operation is to be performed with.
What is an arity?
The number of operands that an operator takes as input.
Unary operator
An operator that works on a single operand.
Binary operator
An operator that works on two operands.
Ternary operator(there is only one)
An operator that works on three operands.
Nullary operator (there is only one)
An operator that works on zero operands.
What is an expression?
A non-empty sequence of literals, variables, operators, and function calls that calculates a value.
What is an evaluation?
The process of executing an expression.
What is a Return Value (also know as a return)?
The resulting value produced from a evaluation.
What is an expression statement?
A statement that consist of an expression followed by a semicolon.
What is a side effect? (typically seen with operators)
Some observable effect beyond producing a return value.
What is a subexpression?
An expression used as an operand.
What is a full expression?
An expression that is not a subexpression.
What is a compound expression?
An expression that contains two or more uses of operators.
What is a statement?
A type of instruction that causes the program to perform some action
What symbol ends a statement?
A semicolon (‘;‘)
What is a function?
A collection of statements that execute sequentially.
What is syntax?
The rules that govern how elements of the C++ language are constructed.
When does a syntax error occur?
When you violate the grammatical rules of the language.
What do comments do?
They allow the programmer to leave notes in the code.
What should a comment say at the library, program, or functions definition level?
These comments will describe what the library, program, or function does.
What should a comment say within a library, program, or function?
The comment should describe how the code is going to accomplish its goal.
What should a comment say at the statement level?
The comment should explain why the code is doing something.
What is a variable?
A named piece of memory(an object) that we can use to store values.
What is a definition statement used for?
It is used to create a variable, defining both its type and identifier.
What does instantiated mean?
It means it has been assigned a memory address.
What is a data type used for?
It is a way for the compiler to determine what kind of value a object will store.
What is an object (memory)?
It is a region in storage that can hold a value.
What is Random Access Memory (often called RAM for short)?
It is the main memory in a computer.
What is a value (sometimes called a data value)?
It is a single piece of data.
What is data?
It is any information that can be moved, processed, or stored by a computer.
What does default-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x;
What does copy-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x = 5;
What does direct-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x (5);
What does direct-list-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x { 5 };
What does copy-list-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x = { 5 };
What does value-initialization look like (if there is a type use int, if there is a identifier use ‘x‘, and if there is a value use ‘5‘)?
int x {};
What does std::cout and operator« allow us to do?
It allows us to output the result of and expression to the console.
What does std::endl allow us to do?
It allows us to output a newline character, and flushes any pending output to the console.
What does std::cin and operator» allow us to do?
It allows us to get a value from the keyboard.
What are keywords?
Its a set of names that C++ reserves. These words have special meanings withing the language and may not be used as variable names.