Exit CPA-21-02 CPA - C++ Certified Associate Programmer
Question 1 of 5
0% complete
Q1 Single choice

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

#include <iostream>

#include <string>

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

Previous Next