Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Question

What is the following function determining?

	int fn(int a, int b)
	{
		if (b==0) return 0;
		if (b==1) return a;
		return a+fn(a, b-1);
	}
	
A a+b where a and b are integers
B a+b where a and b are non-negative integers
C a*b where a and b are integers
D a*b where a and b are non-negative integers
Answer & Explanation
Option: [B]

The above function is a recursive function. The function will return a+b where a and b are non-negative integers

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Random GK Questions

Assam Direct Recruitment Test Series

Computer Science Topics