What will be the output of the following C++ code? #include <iostream> ...
View Question
What will be the new value of x in the following C++ code?
#include <iostream>
using namespace std;
void fun(int &x)
{
x = 20;
}
int main()
{
int x = 10;
fun(x);
cout << “New value of x is ” << x;
return 0;
}
What will be the new value of x in the following C++ code? #include ...
View Question
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void copy (int& a, int& b, int& c)
{
a *= 2;
b *= 2;
c *= 2;
}
int main ()
{
int x = 1, y = 3, z = 7;
copy (x, y, z);
cout << “x =” << x << “, y =” << y << “, z =” << z;
return 0;
}
What will be the output of the following C++ code? #include <iostream> ...
View QuestionBy default how the value are passed in c++?
a) call by value b) call by reference c) call by pointer d) call by object Answer: a Explanation: ...
View QuestionWhich is used to keep the call by reference value as intact?
a) static b) const c) absolute d) virtual Answer: b Explanation: Because const will not change the value ...
View QuestionHow many ways of passing a parameter are there in c++?
a) 1 b) 2 c) 3 d) 4 Answer: c Explanation: There are three ways of passing a ...
View QuestionWhich of the following is important in a function?
a) Return type b) Function name c) Both return type and function name d) The return type, function ...
View QuestionFrom which function the execution of a C++ program starts?
a) start() function b) main() function c) new() function d) end() function Answer: b Explanation: ...
View Question
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void square (int *x, int *y)
{
*x = (*x) * –(*y);
}
int main ( )
{
int number = 30;
square(&number, &number);
cout << number;
return 0;
}
What will be the output of the following C++ code? #include <iostream> using namespace std; void square (int ...
View Question
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int fun(int=0, int = 0);
int main()
{
cout << fun(5);
return 0;
}
int fun(int x, int y) { return (x+y); }
What will be the output of the following C++ code? #include <iostream> using namespace std; int fun(int=0, ...
View Question