Functions
August 29, 2024
Database-Management-System
August 29, 2024
Functions
August 29, 2024
Database-Management-System
August 29, 2024

Functions

Question 52
Consider the following function definition.
void greet (int n)
{
if (n>0)
{
printf(“hello”);
greet(n-1);
}
printf(“world”);
}
If you run greet(n) for some non-negative integer n, what would it print?
A
n times “hello”, followed by n + 1 times “world”
B
n times “hello”, followed by n times “world”
C
n times “helloworld”
D
n + 1 times “helloworld”
E
n times “helloworld”, followed by “world”
Correct Answer: A
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!