adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    void swap(int &a, int &b);
    int main()
    {
        int a = 5, b = 10;
        swap(a, b);
        cout << "In main " << a << b;
        return 0;
    }
    void swap(int &a, int &b)
    {
        int temp;
        temp = a;
        a = b;
        b = temp;
        cout << "In swap " << a << b;
    }

a.

In swap 105 In main 105

b.

In swap 105 In main 510

c.

In swap 510 In main 105

d.

None of the mentioned

Answer: (a).In swap 105 In main 105

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. What does a reference provide?

Q. Identify the correct sentence regarding inequality between reference and pointer.

Q. Void pointer can point to which type of objects?

Q. When does the void pointer can be dereferenced?

Q. The pointer can point to any variable that is not declared with which of these?

Q. A void pointer cannot point to which of these?

Q. What we can’t do on a void pointer?

Q. The data elements in structure are also known as what?

Q. What will be used when terminating a structure?

Q. What will happen when the structure is declared?

Q. The declaration of structure is also called as?

Q. Which of the following is a properly defined structure?

Q. Which of the following accesses a variable in structure *b?

Q. The keyword used to define a structure is _____

Q. When accessing a structure member, the identifier to the left of the dot operator is the name of

Q. Using new may result in less _____ memory than using an array

Q. A difference, between reference variables and pointers is that

Q. The C++ expression p --> val means the same thing as

Q. One way in which a structure differs from an array is that _____

Q. When you declare a pointer, you must give it a _____