R
Richard
Can any one correct these true and false answer for me? I did not but I
don't know if they are all corrected. THanks
True. In C++, resersed words the same as predefined identifiers.
False. An indentifier can be any sequence of digits, leters, and the
underscore.
True. When trying to store a double value in an int variable, the double
value is rounded to the nearest interger.
False. An if statement cannot be nested in a switch statement, but a switch
statement can be nested in an if statement.
True. The execution of a break statement in a while loop terminates the
loop.
True. A function definition consists of the function heading and the body of
the function.
True. Parameters allow the programmer to use different values each time the
functions is called.
False. The execution of the return statement in a user-defined function
terminates the program.
True. It is not necessary to specify the names of formal parameters in a
function prototype.
False. The return statement
Return x +1;
First returns the values of x and then increments the values of
x.
True. The following return statement return the value 10.
Return 10,16;
True. The following statement in a value-returning function is legal.(
assume that all variables are properly declared)
If (x%==0)
Return x;
Else
Return x +1;
True. Given the function prototype
Float test();
The statement
Cout<<test;
Is legal because the function test has no parameters.
True. Given the function prototype
Double testAlpha (int u, char v, double t);
The following statement is legal.
Cout<<testAlpha(5, 'A', 2);
False. If a formal parameters is a value parameter and the corresponding
actual parameters is a variable, the actual parameter can be modified.
False. If an ampersand, & is attached to the data type of a formal
parameter, the corresponding actual parameter must be a variable.
True. A value parameter only changes its own content without changing the
value of the actual parameter.
True. A variable name can be passed to a value parameter.
False. The corresponding actual parameter for a reference parameter can be
any expression
True. Any parameter the receives a value and also sends a value outside the
function must be declared as reference parameter.
True. If a formal parameter is a reference parameter, the corresponding
actual parameter must be a varialble
True. The pass by value mechanism must be used if the calling code is to
receive values back from the function.
True. A variable declared outside of every block is called a global
variable.
True. In a program global constants have no side effects.
False. The scope of a formal parameter and the scope of a local variable
declared in the outer block of a function body is the same
True. In C++, function definitions cannot be nested, that is, the definition
of one function cannot be enclosed in the body of another function.
True. A static variable works the same way as global variable because memory
for the static variables remains allocated during program execution.
True. The following is a legal C++ function definition
Void funcTest(int& u, double& v);
{
Cout<<u<<" "<<v<<endl;
}
False. The output of the C++ code
Int alpha =5;
Int beta=10;
Alpha = alpha +5;
{
Int alpha;
Alpha=20;
beta= beta +5;
}
Cout<<alpha<<" "<<beta<<endl;
Is: 10 15
True. In C++ , when declaring an array as a formal parameter, the size of
the array must be specified within square brackets.
True. The word const is used before the array declaration in a function
heading to prevent the function from modifying the array.
False. A struct can be passed as a parameter to a function by value or by
reference.
True. A function cannot return a value of a type struct
True. The Address operator is a urary operator that returns the address of
its operand.
True. Any number can be directly assigned to a pointer variable.
don't know if they are all corrected. THanks
True. In C++, resersed words the same as predefined identifiers.
False. An indentifier can be any sequence of digits, leters, and the
underscore.
True. When trying to store a double value in an int variable, the double
value is rounded to the nearest interger.
False. An if statement cannot be nested in a switch statement, but a switch
statement can be nested in an if statement.
True. The execution of a break statement in a while loop terminates the
loop.
True. A function definition consists of the function heading and the body of
the function.
True. Parameters allow the programmer to use different values each time the
functions is called.
False. The execution of the return statement in a user-defined function
terminates the program.
True. It is not necessary to specify the names of formal parameters in a
function prototype.
False. The return statement
Return x +1;
First returns the values of x and then increments the values of
x.
True. The following return statement return the value 10.
Return 10,16;
True. The following statement in a value-returning function is legal.(
assume that all variables are properly declared)
If (x%==0)
Return x;
Else
Return x +1;
True. Given the function prototype
Float test();
The statement
Cout<<test;
Is legal because the function test has no parameters.
True. Given the function prototype
Double testAlpha (int u, char v, double t);
The following statement is legal.
Cout<<testAlpha(5, 'A', 2);
False. If a formal parameters is a value parameter and the corresponding
actual parameters is a variable, the actual parameter can be modified.
False. If an ampersand, & is attached to the data type of a formal
parameter, the corresponding actual parameter must be a variable.
True. A value parameter only changes its own content without changing the
value of the actual parameter.
True. A variable name can be passed to a value parameter.
False. The corresponding actual parameter for a reference parameter can be
any expression
True. Any parameter the receives a value and also sends a value outside the
function must be declared as reference parameter.
True. If a formal parameter is a reference parameter, the corresponding
actual parameter must be a varialble
True. The pass by value mechanism must be used if the calling code is to
receive values back from the function.
True. A variable declared outside of every block is called a global
variable.
True. In a program global constants have no side effects.
False. The scope of a formal parameter and the scope of a local variable
declared in the outer block of a function body is the same
True. In C++, function definitions cannot be nested, that is, the definition
of one function cannot be enclosed in the body of another function.
True. A static variable works the same way as global variable because memory
for the static variables remains allocated during program execution.
True. The following is a legal C++ function definition
Void funcTest(int& u, double& v);
{
Cout<<u<<" "<<v<<endl;
}
False. The output of the C++ code
Int alpha =5;
Int beta=10;
Alpha = alpha +5;
{
Int alpha;
Alpha=20;
beta= beta +5;
}
Cout<<alpha<<" "<<beta<<endl;
Is: 10 15
True. In C++ , when declaring an array as a formal parameter, the size of
the array must be specified within square brackets.
True. The word const is used before the array declaration in a function
heading to prevent the function from modifying the array.
False. A struct can be passed as a parameter to a function by value or by
reference.
True. A function cannot return a value of a type struct
True. The Address operator is a urary operator that returns the address of
its operand.
True. Any number can be directly assigned to a pointer variable.