Question
void fn( ){
char c;
cin.get(c);
if (c != ‘\n’) {
fn( );
cout.put(c);
}
}
a.
The string entered is printed as it is.
b.
The string entered is printed in reverse order.
c.
It will go in an infinite loop.
d.
It will print an empty line.
Posted under Data Structures and Algorithms
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the following code segment doing? void fn( ){ char c; cin.get(c); if (c != ‘\n’) { fn( ); cout.put(c); } }
Similar Questions
Discover Related MCQs
Q. What is the return value of the following statement if it is placed in C program?
strcmp("ABC", "ABC");
View solution
Q. String concatenation means -
View solution
Q. Which of the following function compares 2 strings with case-insensitively?
View solution
Q. Which pre-defined function returns a pointer to the last occurence of a character in a string?
View solution
Q. String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.
View solution
Q. The return-type used in String operations are
View solution
Q. Strcat function adds null character
View solution
Q. Which of the following function is more appropriate for reading in a multi-word string?
View solution
Q. Which of the following function is used to find the first occurrence of a given string in another string?
View solution
Q. The library function used to find the last occurrence of a character in a string is
View solution
Q. How will you print \n on the screen?
View solution
Q. If the two strings are identical, then strcmp() function returns
View solution
Q. Which of the following function sets first n characters of a string to a given character?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!