What is the output of:
String a1 = "Hello";
String a2 = "world!";
String* s1 = &a2;
String& s2 = a1;
s1 = &a1;
s2 = a2;
std::cout << *s1 << " " << s2 << std::endl;
Answers were Sorted based on User's Feedback
Answer / ratan
The output is
world! world!
This is becuase s2 is a reference variable of a1 and we are
assigning s2 value if a2 which is world!.
This is chnaging the value at a1 as well.
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / pokala
world! world! is the right anwer.
Do not confuse with other asnwers.
Same is verified.
| Is This Answer Correct ? | 3 Yes | 0 No |
What do you mean by funtion prototype?
Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()
Why we use #include iostream in c++?
Why is it called c++?
Write a single instruction that will find the remainder of integral division when x is divided by y. Have the answer stored in z.
What is input operator in c++?
what is oops and list its features in c++?
What are the different types of variables in C++?
If a function doesn’t return a value, how do you declare the function?
What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?
What are the two types of comments?
What is difference between class and structure in c++?