New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPP Exam - Topic 6 Question 42 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 42
Topic #: 6
[All CPP Questions]

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: one two three?

#include

#include

using namespace std;

int main ()

{

string a;

cin.getline(a);

cout<

return 0;

}

Program will output:

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Justa
4 months ago
I thought it would just take the first word.
upvoted 0 times
...
Titus
4 months ago
No way, it's not a compilation error!
upvoted 0 times
...
Gail
4 months ago
Wait, are you sure? What if it breaks?
upvoted 0 times
...
Shala
4 months ago
Definitely B, that's how getline works!
upvoted 0 times
...
Sylvie
5 months ago
It will output "one two three".
upvoted 0 times
...
Lavonna
5 months ago
This question seems straightforward, I'm pretty confident I can figure this out.
upvoted 0 times
...
Louis
5 months ago
This question seems straightforward. I'm pretty confident I can answer it correctly.
upvoted 0 times
...
Glory
5 months ago
I think the NCS 2000 Optical Service Channel might be built into the Transport System Controller, but I'm not entirely sure.
upvoted 0 times
...

Save Cancel