C++ questions
5.Which of the following function prototype(s) are correct. void setValue(int &value); void setValue(int &); void setValue(int value, int max=100); void setValue(int ++value);
6. T/F Calling an overloaded function can result in multiple values being returned to the caller.
7.A ____ function has ____ return value(s), but can have ____ parameter(s). Otherwise a function can return _____ value(s).
8.T/F Only variables can be passed as reference.
9.T/F When writing a C++ program you must be careful to arrange all the functions in the order in which they are called.
6
5. function prototype(s) which are correct.
void setValue(int &value); ----- reference parameter with name is allowed
void setValue(int &); ----- reference parameter without name is allowed
void setValue(int value, int max=100); ---- default value(max = 100) is allowed
But void setValue(int ++value); is not allowed as incrementation operation is not allowed in the parameter of the function.
6. Calling an overloaded function can result in multiple values being returned to the caller. False
The return type of the overloading function cannot alone implement overloading. There should be difference in the type , number or order of arguments.
7.A void function has no return value(s), but can have many parameter(s). Otherwise a function can return one value(s).
8. Only variables can be passed as reference.----- False
function pointers can also be passed as reference.
9.When writing a C++ program you must be careful to arrange all the functions in the order in which they are called.---True
The functions which are being called should be written earlier to the calling functions.
Do ask if any doubt. Please upvote.
Get Answers For Free
Most questions answered within 1 hours.