1
Q:

What is the output of this program ?

       #include
        using namespace std;
        int n(char, int);
        int (*p) (char, int) = n;
        int main()
        {
            (*p)('d', 9);
            p(10, 9);
            return 0;
        }
        int n(char c, int i)
        {
            cout << c <<  i;
            return 0;
        }

A) d99 B) d9d9
C) d9 D) compile time error

Answer:   A) d99



Explanation:

In this program, we have declared the values as integer instead of character, So it is printing as d99 but it will not arise an error.

Subject: C++
Q:

What is friend function?

Answer


The function declaration should be preceded by the keyword friend.The function definitions does not use either the keyword or the scope operator :: The functions that are declared with the keyword friend as friend function.Thus, a friend function is an ordinary function or a member of another class.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

2 3911
Q:

What is dynamic binding?

Answer


Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2389
Q:

What is default constructor?

Answer


A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2137
Q:

What is copy constructor?

Answer


Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2652
Q:

What are storage qualifiers in C++ ?

Answer

ConstKeyword indicates that memory once initialized, should not be altered by a program.
Volatile keyword indicates that the value in the memory location can be altered even though nothing in the program.
Mutable keyword indicates that particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2598
Q:

What do you mean by reference variable in c++?

Answer

A reference variable provides an alias to a previously defined variable.
Data -type & reference-name = variable name

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2206
Q:

what is the use of virtual destructor in c++?

Answer

A destructor is automatically called when the object is destroyed. A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 1991
Q:

How variable declaration in c++ differs that in c?

Answer

C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

1 5119