What happens to a function defined inside a class without any complex operations (like looping, a large number of lines, etc)?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
If an argument from the parameter list of a function is defined constant then _______________
What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int fun(int x = 0, int y = 0, int z)
{ return (x + y + z); }
int main()
{
cout << fun(10);
return 0;
}
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); }
Which of the following is the default return value of functions in C++?
In which of the following cases inline functions may not word?
i) If the function has static variables.
ii) If the function has global and register variables.
iii) If the function contains loops
iv) If the function is recursive
Where should default parameters appear in a function prototype?
Which of the following feature is used in function overloading and function with default argument?
What will be the output of the following C++ code?
#include<iostream>
using namespace std;
class Test
{
protected:
int x;
public:
Test (int i):x(i) { }
void fun() const { cout << "fun() const " << endl; }
void fun() { cout << "fun() " << endl; }
};
int main()
{
Test t1 (10);
const Test t2 (20);
t1.fun();
t2.fun();
return 0;
}
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;
}
15 videos|20 docs|13 tests
|
15 videos|20 docs|13 tests
|