C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 3 Topic 1 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 3 Topic 1 Discussion

CPA-21-02 Exam Topic 1 Question 3 Discussion:
Question #: 3
Topic #: 1

What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?

#include

#include

using namespace std;

void f();

int main()

{

f();

return 0;

}

void f()

{

char c;

c = cin.get();

cout << c;

if(c != '\n')

f();

}


A.

It prints: hello


B.

It prints: olleh


C.

It prints: h


D.

It prints: o


Get Premium CPA-21-02 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.