Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C++ Programming :: Functions

Home > C++ Programming > Functions > General Questions

1. What is the output of the C++ program?

#include
using namespace std;

void fun(int a, int b, int &c,int &d)
{
c += a + b;
d += a - b;
}

void main () {
int vl = 5, v2 = 10, v3 = 2, v4 = 3;
fun(vl, v2, v3, v4);
cout << v3 << " "<< v4 ;
}

Answer: 17 -2

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

2. What is the output of the C++ program?

#include
using namespace std;

#define SQ(a) a*a
inline int square(int a)
{
return a*a;
}

int main () {
int i, j, k, l;
i = SQ(2 + 3);
j = square(2 + 3);
k = SQ(6 - 1);
l = square(6 - 1);

cout << i << " "<< j << " "<< k << " " << l;
return 0;
}

Answer: 11 25 -1 25

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

3. What is the output of the C++ program?

#include
using namespace std;

class base {
int b;
public:
base (int x) {
b = x;
cout << "Base";
};
class derived : public base
{
double d;
public:
derived(double x, int y)
d = x;
cout << " Derived";
};

void main (){
derived d(23.5, 10);
}

Answer: Compilation error: No appropriate base class constructor available

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

4. A const member function can be overloaded with a

Answer: non-const member function

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

5. A function can make

Answer: as many throws of as many types as necessary.

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

6. When an object-oriented program detects an error within a function, the function

Answer: throws an exception

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

7. A friend function can be called

Answer: like a normal function

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

8. A const member functions

Answer: doesn't change data fields of the object

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

9. Friend function should be declared in the _________part of the class.

Answer: both (a) and (b)

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

10. Static member functions

Answer: can access only static members in the same class

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!