-
What is a variable in C++?
Is a named object in memory that excludes functions. -
What is the Definition of a variable?
A named region of memory used to store values. -
What is Instantiation of a variable?
is when memory has been reserved for a variable in RAM. -
What is the difference between an l-value and an r-value?
I-value has a persistent memory address while a r-value is not associated wih a persistent memory address. -
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
An uninitialized variable is one that has not been given a known value yet(usually through initialization or assignment and using an uninitialized variable results in an undefined behavior. -
What is undefined behavior?
It is the result of executing code whose behavior is not well defined by the C++ language.
What is a variable in C
a named object
What is the Definition of a variable?
variable must have a name and a value
What is Instantiation of a variable?
reserving memory for object slot
What is the difference between an l-value and an r-value?
I- value stands for assigned memory that is more persident and r-value is temporary statement that will be dismanteled when the job is done
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
its a variable without a value
What is undefined behavior?
examp.
if you use uninitalized variables, you dont know what u get, because C++ has no rules what would happen
- In C++ a variable is a named object.
- The Definition of a variable is giving it a name and a type so that it can be referenced later.
- The Instantiation of a variable is its creation and assignment to a memory address.
- âAn lvalue ( locator value ) represents an object that occupies some identifiable location in memory (i.e. has an address)â, while an r-value does not represent an object that occupies some identificable location.
- An uninitialized variable is a âvariable that has not been given a known value (usually through initialization or assignment)â. It may contain the value that was previously stored in its memory location.
- âUndefined behavior is the result of executing code whose behavior is not well defined by the C++ language.â This may lead to unpredictability.
- A variable is a block of memory that is named for future use.
- Definition is a statement that instantiates the variable - basically, assigning the memory to some sort of interpretation.
- Instantiation happens when the definition statement is run. The variable now exists.
- I-Values have a persistent spot in memory while R-Values are not persistent.
- An uninitialized variable is a variable that has not been assigned a value yet. It will consist of whatever data (garbage) that was in the memory location.
- Undefined behavior is essentially unpredictable outcomes to our code. It can run inconsistently, it can even run correctly, we just donât know.
-
What is a variable in C++?
It is a named object, uses an identifier to do it so, in C++, the term excludes functions as variables. -
What is the Definition of a variable?
Is a special kind of declaration statement to define a variable value.
Ie.
`
<int x;>
and
<string "name";>
-
What is Instantiation of a variable?
It is the creation of an object and of an assigned location for it, in the memory to access it later, using its identifier. -
What is the difference between an l-value and an r-value?
I-value is a value that refers to a specific/identified address in memory and an r-value is not associated with a permanent memory address access. -
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
Itâs a variable with location but no value instated when compiled, so the program wont knows the next step or which value to return. -
What is undefined behavior?
It is when the code has no well-defined behavior set, according to the language in use, resulting in bad or no execution.
- It is a named object
- The location of the object in memory
- An object that is created and assigned a memory address
4.I value has assigned memory r values do not have an assign memory allocation - An uninitialized variable is a variable that has not been defined and can create spurious bugs in your code
- Bad coding practices resulting is unpredictable behavior
- What is a variable in C++? â a named object where an object is a region of storage usually in memory that has a value and properties. It is a named data structure in memory.
- What is Definition of a variable? â declaring a variable to the compiler of type and name so it can be referenced later, done as int x;
- What is Instantiation of a variable? â during runtime, the variable object is created and assigned a memory address so they can store values.
- What is the difference between an l-value and an r-value? â l-value has persistent address in memory such as int x; where r value does not like int 5;. L-value references left side for assignment purpose and r-value is right expression of assignment operator.
- What is an uninitialized variable and what kind of behaviour can you expect from such a variable? â variable not given initialized value. This can cause undefined behaviour as compiler tries to extract data from memory location but nothing is there.
- What is undefined behaviour? â results from doing undefined or non well defined behaviours of the language with the code such as accessing and uninitialized variable.
What is a variable in C++?
a named region of storage that can store a data value (a named object)
What is Definition of a variable?
a special kind of declaration statement that is used to create a variable
What is Instantiation of a variable?
when the object is created and assigned a memory address. Variables must be instantiated before they can be used to store values.
What is the difference between an l-value and an r-value?
I-value has a persistent memory address, and r-value does not
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
It is a variable that has not been given a known value. You can expect that the compiler will assign a random space in the memory which will change every time you run and compile the code.
What is undefined behavior?
the result of executing code whose behavior and result is not well defined by the language
1. What is a variable in C++?
Objects that are named are variables.
2. What is Definition of a variable?
In order to create a variable we use a âdefinitionâ specifying a type and a name for a variable for example
3. What is Instantiation of a variable?
Instantiation is a fancy word that means when an object is created it is assigned a memory. variables must be instantiated to store memory.
4. What is the difference between an l-value and an r-value?
A l-value expression goes on the left and an r-value can only be written on the right. The critical point is then whether the expression guaranteed refers to an object in memory, an object with an address: if so, then the expression is an lvalue. As a general rule, if you can apply the built-in address operator, then itâs an lvalue expression, and otherwise itâs an rvalue expression. can someone please fact check me on this i had trouble finding where it talked about this in the article and did my own research.
5. What is an uninitialized variable and what kind of behaviour can you expect from such a variable?
An uninitialized variable will hold whatever value C++ has already stored and can change each time you run in. UB or unexpected behavior you donât know what your going to get or if you will get the same thing every time your run it.
6. What is undefined behavior?
UB or unexpected behavior is a result of uninitialized vairables and can cause code to execute in unexpected and varying ways. For example you could get a different result each time you run it, it could work sometimes and others not, it could work 4 out of 5 times. With UB you never really know what your going to get or if it will be different next time.
-
What is a variable in C++? A named object (region of storage).
-
What is the Definition of a variable? A declaration statement called a definition.
-
What is Instantiation of a variable? When we run the program, the object is created and given a memory address so it can then accept a value.
-
What is the difference between an l-value and an r-value? A locator value has an address in memory, whereas an r-value is an expression that does not represent an object with a located address in memory.
-
What is an uninitialized variable and what kind of behavior can you expect from such a variable? The object has not been given a known value. The computer will use some unused memory address and then assign whatever value is already in that address to the variable. Totally random.
-
What is undefined behavior? The output from executing code from variables that have not been defined.
- Variables in C++ are named regions of storage that can store a data value.
- To create a variable we must define it, to do this you declare it with a statement
- Instantiation is the initiation or running of the variable through the program. Variables must be instantiated before they can be used to store value
- I-value (locator value) refers to memory location which identifies an object. R-value is an expression that canât have a value assigned to it.
- An uninitialised variable is a variable that has not been given a known value and C++ will give is a default value that it has in its stored memory. It can cause an error or a bug that will not produce expected results.
- UB is the result of a code execution thatâs result is not defined by the language. It will cause the program to return an unpredictable result and can be difficult to trace while potentially causing the program to unknowingly corrupt the data.
-
A variable is a named object
-
An object that is assigned an identifier
-
When the object is created an assigned a memory address
-
l value is stored in the computerâs RAM while r values are discarded after the program is compiled.
5.It is declared object that has no definite value attached to it. This can lead to errors and bugs in your program.
- Executing a code that has unpredictable actions according to the code you are writing in.
- What is a variable in C++? itâs a named region of memory
- What is Definition of a variable? specifying a type and name for the variable
- What is Instantiation of a variable? means the object will be created and assigned a memory address
- What is the difference between an l-value and an r-value? l-value has an address in memory and r-value does not.
- What is an uninitialized variable and what kind of behaviour can you expect from such a variable? has been stored in memory but has not been assigned a value and produces an unexpected behavior and possibly and error.
- What is undefined behaviour? a result of the code, when executed, produced a behavior that was not defined and unexpected.
- A named object
- It is an object which has an identifier, a type, and a value. Type determines how it will be stored to the memory.
- Object is created and is given an address in the memory.
- l-value is a memory location that identifies an object, r-value is something that canât have a value assigned to it.
- A variable that is declared but doesnât have a value. Unpredictable behavior. Example:
int k;
k = k + 1; - Undefined behaviour is something that happens when a program does something that âis not specified by the standard.â
-
What is a variable in C++?
An named object used to store values -
What is the Definition of a variable?
A variable is a named object preceded by the variable type and the name used is the identifier -
What is Instantiation of a variable?
Instantiation is a word that means the object will be created and assigned a memory address. -
What is the difference between an l-value and an r-value?
An I-value is persistent in memory and an r-value is not persisten in memory. -
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
A no-no as itâs value has been given a known value and thus the value can be unpredictable as itâs value in uninitialized memory can be unknown. -
What is undefined behavior?
Code inadequately defined will likely result in unexpected outcomes.
-
A variable is a NAMED object block in the memory. Used to access data in the memory.
-
A block in the memory which have been given a variable name.
-
The writing of that variable into the memory.
-
String and int. The way the data is treated.
-
You cannot expect a behavior from an uninitialized variable as it has no reserved space in the memory.
-
Undefined behavior is like the example in question number 5.
-
A variable is a named region of memory
-
A variable is a named region of memory
-
Instantiation is the creation of a value in memory when runtime reads the special statement (called the definition) that sets up the value.
-
(4-6)
Am I missing something here?
The assignment asks one to think about the âfollowingâ questions while reading the article however, question 4 - 6 are not covered in the article. Obviously, I can look this up but, due to the instructions of the assignment, I am worried there is something funny going on here (even if it is from my end lake a brain malfunction)
Actually l and r value just refers to the left and right part of the assignment operator.
Not sure either, most students donât have issues with them. They might have just googled the answers which is a good practice because being able to find your answers is an important skill for the developer to have.
- What is a variable in C++?
A variable is a named object
2⌠What is the Definition of a variable?
A declaration statement like int x; which defines the variable x to be an integer.
-
What is Instantiation of a variable?
At runtime an object is created and assigned a memory address. -
What is the difference between an l-value and an r-value?
left value and right value of expression
left value has a memory address, right value has no memory address and is discarded after assignment -
What is an uninitialized variable and what kind of behavior can you expect from such a variable?
An unitialized variable has not been given a value, not by definition nor by assignment. When displaying the variable, It may give whatever value was still stored in the memory address or may give a compile error. This is called undefined behavior. -
What is undefined behavior?
The result of executing code that is not well defined by the language. You never know what youâre going to get, it may be anything, including the correct solution.