What is the output of the program if characters ‘t’, ‘e’, ‘s’ and ‘t’ enter are supplied as input?

What is the output of the program if characters ‘t’, ‘e’, ‘s’ and ‘t’ enter are supplied as input?

#include <iostream>

#include <string>

using namespace std;

int main()

{

string s;

getline( cin, s );

cout << s << " " << s.length();

return (0);

}
A . It prints: test 4
B . It prints: test
C . It prints: test 5
D . It prints: 4

Answer: A

Latest CPA-21-02 Practice Questions with 222 Q&As

Updated Study Material | Instant Download | Detailed Answers and Explanations

Subscribe
Notify of
guest
0 Comments