cpp-programming-references Related Question Answers

1. A reference is declared using the _____ symbol.





2. Which of the following statements is correct? A reference is not a constant pointer. A referenced is automatically de-referenced.





3. Which of the following statements is correct? An array of references is acceptable. We can also create a reference to a reference.





4. Which of the following statements is correct? Once the variable and the reference are linked they are tied together. Once the reference of a variable is declared another reference of that variable is not allowed.





5. Which of the following statements is correct? We can return a global variable by reference. We cannot return a local variable by reference.





6. Reference is like a _____.





7. Which of the following statements is correct? Pointer to a reference and reference to a pointer both are valid. When we use reference, we are actually referring to a referent.





8. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 80; int y& = x; x++; cout << x << " " << --y; return 0; }





9. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 80; int &y = x; x++; cout << x << " " << --y; return 0; }





10. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10; int &y = x; x++; cout<< x << " " << y++; return 0; }





11. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10; int &y = x; x = 25; y = 50; cout<< x << " " << --y; return 0; }





12. Which of the following statement is correct about the program given below? #include<iostream.h> enum bix { a=1, b, c }; int main() { int x = c; int &y = x; int &z = x; y = b; cout<< z--; return 0; }





13. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10, y = 20; int ptr = &x; int &ref = y; ptr++; ref++; cout<< x << " " << y; return 0; }






14. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }





15. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int m = 2, n = 6; int &x = m; int &y = n; m = x++; x = m++; n = y++; y = n++; cout<< m << " " << n; return 0; }






16. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int m = 2, n = 6; int &x = m++; int &y = n++; m = x++; x = m++; n = y++; y = n++; cout<< m << " " << n; return 0; }






17. What will be the output of the following program? #include<iostream.h> class BixTest { public: BixTest(int &x, int &y) { x++; y++; } }; int main() { int a = 10, b = 20; BixTest objBT(a, b); cout<< a << " " << b; return 0; }





18. Which of the following statement is correct about the program given below? #include<iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = ++x; q = ++y; r = ++c; cout<< p << q << r; return 0; }





19. Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int arr[] = {1, 2 ,3, 4, 5}; int &zarr = arr; for(int i = 0; i <= 4; i++) { arr[i] += arr[i]; } for(i = 0; i <= 4; i++) cout<< zarr[i]; return 0; }





20. Which of the following statement is correct about the program given below? #include<iostream.h> struct Bix { short n; }; int main() { Bix b; Bix& rb = b; b.n = 5; cout << b.n << " " << rb.n << " "; rb.n = 8; cout << b.n << " " << rb.n; return 0; }





21. What will be the output of the following program? #include <iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = z; p = ++q; q = ++p; z = ++q + p++; cout<< p << " " << q << " " << z; return 0; }





22. Which of the following statement is correct about the program given below? #include<iostream.h> int BixFunction(int m) { m = m; return((10)(m /= m)); } int main() { int c = 9, d = &c, e; int &z = e; e = BixFunction(c-- % 3 ? ++d :(d = d)); z = z + e / 10; cout<< c << " " << e; return 0; }





23. Which of the following statement is correct about the program given below? #include<iostream.h> class Bix { int x, y; public: Bix(int x, int y) { this->x = x; this->y = y; } void Display() { cout<< x << " " << y; } }; int main() { int x = 50; int &y = x ; Bix b(y, x); return 0; }





24. 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; cout<< xx << " " << yy; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; }






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






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