cpp-programming-references Related Question Answers

26. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: void SetValue(int &xx, int &yy) { x = xx ++; y = yy; Display(); } void Display() { cout<< x << " " << y; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; }






27. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: IndiaBix(int &xx, int &yy) { x = xx; y = yy; Display(); } void Display() { cout<< x << " " << y; } }; int main() { int x1 = 10; int &p = x1; int y1 = 20; int &q = y1; IndiaBix objBix(p, q); return 0; }





28. Which of the following statement is correct about the program given below? #include<iostream.h> int i, j; class IndiaBix { public: IndiaBix(int x = 0, int y = 0) { i = x; j = x; Display(); } void Display() { cout<< j <<" "; } }; int main() { IndiaBix objBix(10, 20); int &s = i; int &z = j; i++; cout<< s-- << " " << ++z; return 0; }






29. Which of the following statement is correct about the program given below? #include<iostream.h> int x, y; class BixTest { public: BixTest(int xx = 0, int yy = 0) { x = xx; y = yy; Display(); } void Display() { cout<< x << " " << y << " "; } }; int main() { BixTest objBT(10, 20); int &rx = x; int &ry = y; ry = x; rx = y; cout<< rx--; return 0; }





30. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int a, b, c; public: void SetValue(int x, int y ,int z) { a = x; b = y; c = z; } void Display() { cout<< a << " " << b << " " << c; } }; int main() { IndiaBix objBix; int x = 2; int &y = x; y = 5; objBix.SetValue(x, ++y, x + y); objBix.Display(); return 0; }





31. What will be the output of the program given below? #include<iostream.h> class BixBase { int x; public: BixBase(int xx = 0) { x = xx; } void Display() { cout<< x ; } }; class BixDerived : public BixBase { int y; public: BixDerived(int yy = 0) { y = yy; } void Display() { cout<< y ; } }; int main() { BixBase objBase(10); BixBase &objRef = objBase; BixDerived objDev(20); objRef = objDev; objDev.Display(); return 0; }






32. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: IndiaBix(int xx = 0, int yy = 0) { x = xx; y = yy; } void Display() { cout<< x << " " << y; } IndiaBix operator +(IndiaBix z) { IndiaBix objTemp; objTemp.x = x + z.x; objTemp.y = y + z.y; return objTemp; } }; int main() { IndiaBix objBix1(90, 80); IndiaBix objBix2(10, 20); IndiaBix objSum; IndiaBix &objRef = objSum; objRef = objBix1 + objBix2; objRef.Display(); return 0; }





33. Which of the following statements is correct? Once a reference variable has been defined to refer to a particular variable it can refer to any other variable. A reference is not a constant pointer.





34. Functions can be declared to return a reference type. There are reasons to make such a declaration/Which of the following reasons are correct? The information being returned is a large enough object that returning a reference is more efficient than returning a copy. The type of the function must be a R-value.





35. Which of the following statements is correct? Change a reference changes the referent. We can create an array of references.





36. Which of the following statement is correct about the references?





Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution