CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

void fun (int n)
{
if (n>0)
{
printf("CSE");
fun( n - 1);
}
printf("2020");
printf("2020);
}
The output of the above program when fun(n) is called for some positive integer n

A
n times "CSE" followed by 2(n+1) times "2020"
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
n times "CSE" followed by 2n times "2020" alternatively one after another
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
2n+1 times "2020" followed by n times "CSE"
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
n times "CSE" followed by 2n times "2020"
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A n times "CSE" followed by 2(n+1) times "2020"
(D)
The fun(n) prints n times "CSE" followed by 2n +2 times "2020"

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Fear of the Dark
QUANTITATIVE APTITUDE
Watch in App
Join BYJU'S Learning Program
CrossIcon